Beispiel #1
0
        public void Test_XYZTests_GetTriangleHeightEx_Pathological1()
        {
            var bottom = new XYZ(0, 0, 0);
            var top    = new XYZ(0, 0, 0);
            var right  = new XYZ(0, 0, 0);

            XYZ.GetTriangleHeight(bottom, top, right, 0, 0).Should().Be(Consts.NullDouble);
        }
Beispiel #2
0
        public void Test_XYZTests_GetTriangleHeightEx_Pathological2(double probeX, double probeY, double result)
        {
            var one   = new XYZ(0, 1, 0);
            var two   = new XYZ(0, -1, 0);
            var three = new XYZ(10000, 0, 0);

            XYZ.GetTriangleHeight(one, two, three, probeX, probeY).Should().Be(result);
            XYZ.GetTriangleHeight(two, three, one, probeX, probeY).Should().Be(result);
            XYZ.GetTriangleHeight(three, one, two, probeX, probeY).Should().Be(result);
            XYZ.GetTriangleHeight(three, two, one, probeX, probeY).Should().Be(result);
            XYZ.GetTriangleHeight(two, one, three, probeX, probeY).Should().Be(result);
            XYZ.GetTriangleHeight(one, three, two, probeX, probeY).Should().Be(result);
        }
Beispiel #3
0
        public void Test_XYZTests_GetTriangleHeightEx()
        {
            XYZ bottom = new XYZ(0, 0, 0);
            XYZ top    = new XYZ(0, 10, 0);
            XYZ right  = new XYZ(10, 10, 0);

            Assert.Equal(0.0, XYZ.GetTriangleHeight(bottom, top, right, 1.0, 9.0));

            bottom.Z = 10;
            top.Z    = 10;
            right.Z  = 10;

            Assert.Equal(10.0, XYZ.GetTriangleHeight(bottom, top, right, 1.0, 9.0));
        }
Beispiel #4
0
        public void Test_XYZTests_GetTriangleHeightExWrong()
        {
            //GetTriangleHeight and GetTriangleHeightEx should return the same result. The latter is an optimized version of the former.

            var v0 = new XYZ(947908.950000, 367225.330000, 1652.360962);
            var v1 = new XYZ(947904.870000, 367219.890000, 1652.048950);
            var v2 = new XYZ(947913.370000, 367217.510000, 1653.223999);
            var x  = 947909.29000000015;
            var y  = 367221.93;
            var z  = 1652.5344904049828;

            Assert.Equal(z, XYZ.GetTriangleHeight(v0, v1, v2, x, y));
            //Currently GetTriangleHeightEx returns 1652.749808195186
            Assert.Equal(z, XYZ.GetTriangleHeightEx(ref v0, ref v1, ref v2, x, y));
        }
Beispiel #5
0
 private double GetHeight(Triangle tri, double X, double Y)
 {
     return(XYZ.GetTriangleHeight(vertexItems[tri.Vertex0], vertexItems[tri.Vertex1], vertexItems[tri.Vertex2], X, Y));
 }
Beispiel #6
0
 public double GetHeight(double X, double Y) => XYZ.GetTriangleHeight(Vertices[0].XYZ, Vertices[1].XYZ, Vertices[2].XYZ, X, Y);