Ejemplo n.º 1
0
 // Constructor: plane, sphereCenterLoc, sphereRadius
 protected PlanoConvexLens(Scientrace.Object3dCollection parent, Scientrace.MaterialProperties mprops,
                           Scientrace.PlaneBorder lensPlane, Scientrace.Location sphereCenterLoc, double sphereRadius)
     : base(parent, mprops)
 {
     this.lensPlane       = lensPlane;
     this.sphereCenterLoc = sphereCenterLoc;
     this.sphereRadius    = sphereRadius;
     this.dummySphere     = new Scientrace.Sphere(null, null, sphereCenterLoc, sphereRadius);
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Returns true if two Plane-instances cover the same area
 /// </summary>
 /// <returns><c>true</c> if planes overlap, <c>false</c> otherwise.</returns>
 /// <param name="anotherPlane">the other plane.</param>
 public bool overlapsWithPlane(Scientrace.PlaneBorder anotherPlane)
 {
     if ((this.allowedDirNormal.normalized().toVector() - anotherPlane.allowedDirNormal.normalized().toVector()).length > MainClass.SIGNIFICANTLY_SMALL)
     {
         return(false);        //Normals differ significantly. Nuff said.
     }
     // Normals are considered equal. Are the planes locations in space?
     Scientrace.Location loc1 = (this.lineThroughPlane(new Line(Location.ZeroLoc(), this.getNormal())));
     Scientrace.Location loc2 = (anotherPlane.lineThroughPlane(new Line(Location.ZeroLoc(), this.getNormal())));
     // if these locations are considered the same, the planes overlap.
     return((loc1 - loc2).length < MainClass.SIGNIFICANTLY_SMALL);
 }
Ejemplo n.º 3
0
 public void testPlaneBorderSide()
 {
     Scientrace.PlaneBorder pb = new Scientrace.PlaneBorder(
         new Scientrace.Location(0,0,1),
         new Scientrace.NonzeroVector(0,0,-1));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0,0,0)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0,0,0.5)));
     Assert.IsFalse(pb.contains(new Scientrace.Location(0,0,1.5)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0,0,1)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(1,0,0)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0,2,0.5)));
     Assert.IsFalse(pb.contains(new Scientrace.Location(3,0,1.5)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(5,6,1)));
 }
Ejemplo n.º 4
0
 public void testPlaneBorderSide()
 {
     Scientrace.PlaneBorder pb = new Scientrace.PlaneBorder(
         new Scientrace.Location(0, 0, 1),
         new Scientrace.NonzeroVector(0, 0, -1));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0, 0, 0)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0, 0, 0.5)));
     Assert.IsFalse(pb.contains(new Scientrace.Location(0, 0, 1.5)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0, 0, 1)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(1, 0, 0)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(0, 2, 0.5)));
     Assert.IsFalse(pb.contains(new Scientrace.Location(3, 0, 1.5)));
     Assert.IsTrue(pb.contains(new Scientrace.Location(5, 6, 1)));
 }
Ejemplo n.º 5
0
        public void testPlaneBorderSide2()
        {
            Scientrace.PlaneBorder pb = new Scientrace.PlaneBorder(
                new Scientrace.Location(1,1,1),
                new Scientrace.NonzeroVector(1,1,1));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0,0,3.1)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(3.1,0,0)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0,3.1,0)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(0,0,0)));

            Assert.IsTrue(pb.contains(new Scientrace.Location(1,1,1)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(1.1,1.1,1.1)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(1,0,0)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0,0,3.1)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(0,0,1.9)));
        }
Ejemplo n.º 6
0
        public void testPlaneBorderSide2()
        {
            Scientrace.PlaneBorder pb = new Scientrace.PlaneBorder(
                new Scientrace.Location(1, 1, 1),
                new Scientrace.NonzeroVector(1, 1, 1));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0, 0, 3.1)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(3.1, 0, 0)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0, 3.1, 0)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(0, 0, 0)));

            Assert.IsTrue(pb.contains(new Scientrace.Location(1, 1, 1)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(1.1, 1.1, 1.1)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(1, 0, 0)));
            Assert.IsTrue(pb.contains(new Scientrace.Location(0, 0, 3.1)));
            Assert.IsFalse(pb.contains(new Scientrace.Location(0, 0, 1.9)));
        }
Ejemplo n.º 7
0
 public Scientrace.Line getIntersectionLineWith(Scientrace.PlaneBorder anotherPlane)
 {
     return(this.tPlane.getIntersectionLineWith(anotherPlane.tPlane));
 }