public Sphere(Point3 center, double radius, Material material) : base(material) { this.Center = center; this.Radius = radius; this.Rinv = 1.0d/Radius; this.material = material; }
public Triangle (Point3 a, Point3 b, Point3 c, Point3 na, Point3 nb, Point3 nc, Point3 ta, Point3 tb, Point3 tc, Material material) : base(material) { this.p0 = a; this.p1 = b; this.p2 = c; if(na == null || nb == null || nc == null) { Point3 norm = new Point3(); Point3.Cross(p1.X-p0.X, p1.Y-p0.Y, p1.Z-p0.Z, p2.X-p0.X, p2.Y-p0.Y, p2.Z-p0.Z, out norm.X, out norm.Y, out norm.Z); norm.Normalize(); this.n0 = this.n1 = this.n2 = norm; } else { this.n0 = na; this.n1 = nb; this.n2 = nc; } if(ta == null || tb == null || tc == null) { this.t0 = Point3.DummyPoint; this.t1 = Point3.DummyPoint; this.t2 = Point3.DummyPoint; this.bumpx = Point3.DummyPoint; this.bumpy = Point3.DummyPoint; } else { this.t0 = ta; this.t1 = tb; this.t2 = tc; double txa = tb.X-ta.X; double tya = tb.Y-ta.Y; double txb = tc.X-ta.X; double tyb = tc.Y-ta.Y; double frac = txb*tya-txa*tyb; double alpha, beta, gamma; if(Math.Abs(frac) >= Maths.GlobalEpsilon) { frac = 1.0d/frac; alpha = -tyb*frac; beta = tya*frac; gamma = 1.0d-alpha-beta; this.bumpx = new Point3(a.X*gamma+b.X*alpha+c.X*beta, a.Y*gamma+b.Y*alpha+c.Y*beta, a.Z*gamma+b.Z*alpha+c.Z*beta); this.bumpx.Normalize(); alpha = txb*frac; beta = -txa*frac; gamma = 1.0d-alpha-beta; this.bumpy = new Point3(a.X*gamma+b.X*alpha+c.X*beta, a.Y*gamma+b.Y*alpha+c.Y*beta, a.Z*gamma+b.Z*alpha+c.Z*beta); this.bumpy.Normalize(); } else { this.bumpx = Point3.DummyPoint; this.bumpy = Point3.DummyPoint; } } }
public Face(double a, double b, double c, double d, Material material) : base(material) { this.Normal = new Point3(a, b, c); this.D = d; }
public Triangle (Point3 a, Point3 b, Point3 c, Material material) : this(a,b,c,null,null,null,null,null,null,material) { }
public OrderingRenderItem(Material material) : base(material) { }
public void Copy(double t, Point3 norm, Material material, Point3 tu) { this.T = t; this.Normal.SetValues(norm); this.TU.SetValues(tu); }
public RenderItem(Material material) { this.Material = material; }