public void TestFailingRealIntersections() { Scientrace.Object3dEnvironment env = DummySources.dEnv(); Scientrace.CylindricalBorder cb = new Scientrace.CylindricalBorder(new Scientrace.Location(0, -0.07, 0), new Scientrace.NonzeroVector(0, -0.57, 0), 0.5); Scientrace.ParabolicMirror pm = new Scientrace.ParabolicMirror(env , Scientrace.PerfectMirror.Instance, new Scientrace.Location(0.354861881099294, -0.57, 0.276718350209505) , new Scientrace.UnitVector(-0.343710964996787, 0.900014703397015, -0.268022958363946), 2, cb); Scientrace.Line tl = new Scientrace.Line(-0.184140645666577, -0.0383229578843359, -0.3, 0.343710966184079, -0.900014705907235, 0.268022948412108); // pm.trf.transform(tl); // Scientrace.IntersectionPoint[] tips = pm.realIntersections(tl); //Assert.AreEqual(new Scientrace.Location(0,0,0), tips[0].loc); Scientrace.VectorTransform trf = pm.trf; Scientrace.Line trfline = trf.transform(tl - pm.loc); //transform location AND direction Scientrace.IntersectionPoint[] ips = pm.baseintersections(trfline); //Scientrace.IntersectionPoint tip; Scientrace.IntersectionPoint[] retips = new Scientrace.IntersectionPoint[2]; for (int ipi = 0; ipi < ips.GetLength(0); ipi++) { if (ips[ipi] == null) { retips[ipi] = null; continue; } //check below removed for performance reasons if (!trfline.throughLocation(ips[ipi].loc, 0.00001)) { string warning = @"ERROR: GOING DOWN! \n baseintersections " + trfline + " FAILED!"; throw new ArgumentOutOfRangeException(warning + ips[ipi].loc.trico() + " not in line " + trfline); } } }
public void TestFailingRealIntersectionsForloop() { Scientrace.Object3dEnvironment env = DummySources.dEnv(); Scientrace.CylindricalBorder cb = new Scientrace.CylindricalBorder(new Scientrace.Location(0, -0.07, 0), new Scientrace.NonzeroVector(0, -0.57, 0), 0.5); Scientrace.ParabolicMirror pm = new Scientrace.ParabolicMirror(env , Scientrace.PerfectMirror.Instance, new Scientrace.Location(0.354861881099294, -0.57, 0.276718350209505) , new Scientrace.UnitVector(-0.343710964996787, 0.900014703397015, -0.268022958363946), 2, cb); for (double a = -0.184140645666577; a >= -0.5; a = a - 0.01) { Scientrace.Line tl = new Scientrace.Line(a, -0.0383229578843359, -0.3, 0.343710966184079, -0.900014705907235, 0.268022948412108); // Scientrace.Line tl = new Scientrace.Line(-0.284140645666577, -0.0383229578843359, -0.3, 0.343710966184079, -0.900014705907235, 0.268022948412108); try { pm.realIntersections(tl, false); } catch { throw new Exception(a + " is f****d"); } } //Assert.AreEqual(new Scientrace.Location(0,0,0), tips[0].loc); }