public override void Inject(List<RenderItem> items, Matrix4 transform, params string[] args) { Point3 p = new Point3(0.0d, 0.0d, 0.0d); p.Transform(transform); Point3 q = new Point3(Maths.Sqrt_3, Maths.Sqrt_3, Maths.Sqrt_3); q.TransformNonShift(transform); items.Add(new Sphere(p, q.Length, this.DefaultMaterial)); }
public void TestInvTransformNonShift() { for(int i = 0x00; i < TestParameters.PointTest; i++) { Point3 p = Point3.Random(); Matrix4 M = new Matrix4(Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble(), Maths.RandomGenerator.NextDouble()); Point3 q = new Point3(p); q.TransformNonShift(M); q.InvTransformNonShift(M); Assert.IsTrue(Math.Abs(p.X-q.X) <= Maths.GlobalEpsilon); Assert.IsTrue(Math.Abs(p.Y-q.Y) <= Maths.GlobalEpsilon); Assert.IsTrue(Math.Abs(p.Z-q.Z) <= Maths.GlobalEpsilon); } }