// 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); }
/// <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); }
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))); }
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))); }
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))); }
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))); }
public Scientrace.Line getIntersectionLineWith(Scientrace.PlaneBorder anotherPlane) { return(this.tPlane.getIntersectionLineWith(anotherPlane.tPlane)); }