Esempio n. 1
0
        private static bool IsTriangleNeighbourOfLine(TriangleHL triangle, LineHL line)
        {
            var firstTriangle  = line.Edge.First;
            var secondTriangle = line.Edge.Second;
            var isNeighbour    = firstTriangle == triangle || secondTriangle == triangle;

            return(isNeighbour);
        }
Esempio n. 2
0
        private static bool IsLineInTrianglePlane(LineHL line, TriangleHL triangle)
        {
            var start     = line.Edge.Start;
            var end       = line.Edge.End;
            var distStart = start.DistancePositionToPlane(triangle.P1, triangle.Normal);
            var distEnd   = end.DistancePositionToPlane(triangle.P1, triangle.Normal);
            var isInPlane = distStart.EqualsTo(0.0) && distEnd.EqualsTo(0.0);

            return(isInPlane);
        }
Esempio n. 3
0
        private static TriangleHL ConvertTriangle(Triangle triangle, FaceHL face, Matrix44D cameraBodyFrame, double nearPlane)
        {
            // var normal = cameraBodyFrame * triangle.Normal;
            var p1 = cameraBodyFrame * triangle.P1.Point.Position;
            var p2 = cameraBodyFrame * triangle.P2.Point.Position;
            var p3 = cameraBodyFrame * triangle.P3.Point.Position;

            var ex     = p2 - p1;
            var ey     = p3 - p1;
            var normal = (ex & ey).Normalize();

            var triangleHL = new TriangleHL()
            {
                Normal   = normal,
                P1       = p1,
                P2       = p2,
                P3       = p3,
                Face     = face,
                Spin     = DetermineTriangleSpin(p1, p2, p3, nearPlane),
                Triangle = triangle
            };

            return(triangleHL);
        }
Esempio n. 4
0
 private static bool IsTriangleVisible(TriangleHL triangle)
 => triangle.Spin == TriangleSpin.counter_clockwise;