public void CanKeepEpsilonAtReasonableLevel() { var result = new List <Pnt3D>(); // points spaced by a few 100m result.Add(new Pnt3D { X = 2723729.625, Y = 1251631.61625, Z = 601.388749999984 }); result.Add(new Pnt3D { X = 2723531.44625, Y = 1251727.94, Z = 615.443749999991 }); result.Add(new Pnt3D { X = 2723633.2675, Y = 1251824.26375, Z = 661.388749999984 }); result.Add(result[0]); Plane3D plane1 = Plane3D.FitPlane(result, true); result.Reverse(); Plane3D plane2 = Plane3D.FitPlane(result, true); Assert.Less(plane1.Epsilon, 0.5); Assert.True(plane1.IsParallel(plane2)); // opposite directon normal: Assert.False(plane1.Equals(plane2)); Assert.True(plane1.IsCoincident(plane2)); }
public void CanDetermineInclinedPlaneCoincidenceMirroredAt0() { var result = new List <Pnt3D>(); result.Add(new Pnt3D { X = 2723729.625, Y = 1251631.61625, Z = 601.388749999984 }); result.Add(new Pnt3D { X = 2723531.44625, Y = 1251727.94, Z = 615.443749999991 }); result.Add(new Pnt3D { X = 2723633.2675, Y = 1251824.26375, Z = 661.388749999984 }); result.Add(result[0]); Plane3D plane1 = Plane3D.FitPlane(result, true); for (var i = 0; i < result.Count; i++) { result[i] = result[i] * -1; } result.Reverse(); Plane3D plane2 = Plane3D.FitPlane(result, true); Assert.False(plane1.Equals(plane2)); Assert.True(plane1.IsParallel(plane2)); Assert.False(plane1.IsCoincident(plane2)); }
public void CanDeterminePlaneCoincidenceMirroredAt0() { var x = new double[] { 0, 0, 1, 1, 0 }; var y = new double[] { 0, 1, 1, 0, 0 }; var z = new double[] { 10, 10, 10, 10, 10 }; Plane3D plane1 = FitPlane3D(x, y, z, true); x = new double[] { 0, 0, 1, 1, 0 }; y = new double[] { 0, 1, 1, 0, 0 }; z = new double[] { 10, 10, 10, 10, 10 }; for (var i = 0; i < z.Length; i++) { z[i] = z[i] * -1; } x = x.Reverse().ToArray(); y = y.Reverse().ToArray(); Plane3D plane2 = FitPlane3D(x, y, z, true); Assert.False(plane1.Equals(plane2)); Assert.False(plane1.IsCoincident(plane2)); }
public void CanDeterminePlaneCoincidenceHorizontal() { var x = new double[] { 0, 0, 1, 1, 0 }; var y = new double[] { 0, 1, 1, 0, 0 }; var z = new double[] { 7, 7, 7, 7, 7 }; Plane3D plane1 = FitPlane3D(x, y, z, true); x = new double[] { 460, 24350, 23451, 451, 2210 }; y = new double[] { 65476570, 351, 2341, 2340, 98760 }; z = new double[] { 7, 7, 7, 7, 7 }; Plane3D plane2 = FitPlane3D(x, y, z, true); Assert.False(plane1.Equals(plane2)); Assert.True(plane1.IsCoincident(plane2)); }
public void CanDeterminePlaneCoincidence() { var x = new double[] { 0, 0, 1, 1, 0 }; var y = new double[] { 0, 1, 1, 0, 0 }; var z = new double[] { 0, 10, 10, 0, 0 }; Plane3D plane1 = FitPlane3D(x, y, z, true); var points2 = new List <Pnt3D>(); points2.Add(new Pnt3D(234, 567, plane1.GetZ(234, 567))); points2.Add(new Pnt3D(987, 654, plane1.GetZ(987, 654))); points2.Add(new Pnt3D(-432, 881, plane1.GetZ(432, 881))); Plane3D plane2 = Plane3D.FitPlane(points2); Assert.False(plane1.Equals(plane2)); Assert.True(plane1.IsCoincident(plane2)); }