continue renderSuite toolkit development
This commit is contained in:
parent
d606f6994f
commit
03bbb6e4c5
|
@ -4,8 +4,7 @@ import renderSuite.Vec3;
|
|||
import renderSuite.Util;
|
||||
import renderSuite.Ray;
|
||||
|
||||
public class Sphere {
|
||||
Vec3 p, c;
|
||||
public class Sphere extends Surface {
|
||||
double r;
|
||||
|
||||
public Sphere(Vec3 position, Vec3 color, double radius) {
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
package renderSuite;
|
||||
|
||||
import renderSuite.Vec3;
|
||||
//import renderSuite.Util;
|
||||
//import renderSuite.Ray;
|
||||
|
||||
public class Surface {
|
||||
Vec3 p, c;
|
||||
|
||||
public void main() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
public boolean intersect(Ray r) {
|
||||
// OLD
|
||||
//double dist = Util.d(ray_position, position);
|
||||
//return (Util.d(ray_position, position) <= radius);
|
||||
|
||||
// using RTX
|
||||
Vec3 l = new Vec3(this.p.x - r.p.x,
|
||||
this.p.y - r.p.y,
|
||||
this.p.z - r.p.z);
|
||||
|
||||
Vec3 nl = l.get_norm();
|
||||
double cosine = Util.dot(r.f, nl);
|
||||
|
||||
// >90 degrees = no intersection
|
||||
if (cosine < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
double tc = l.len() * cosine;
|
||||
double d = Math.sqrt( l.len()*l.len() - tc*tc );
|
||||
|
||||
return (d < this.r);
|
||||
}
|
||||
*/
|
||||
}
|
Loading…
Reference in New Issue