예제 #1
0
        public static ObliqueTriangle ConstructFromVertexPositions(
            Point Pos1, Point Pos2, Point Pos3)
        {
            // setup the left most vertex, then the upper vertex and lower vertex.
            var   rv  = ObliqueTriangle.SplitLeftMostPoint(new Point[] { Pos1, Pos2, Pos3 });
            Point pt1 = rv.Item1; // pt1 is left most point

            var   rv2 = ObliqueTriangle.SplitTopMostPoint(rv.Item2);
            Point pt2 = rv2.Item1; // pt2 is top most point of pt2 and pt3.
            Point pt3 = rv2.Item2[0];

            // Create lines between the points. Line numbers match the number of the opposite
            // point.
            LineCoordinates line1 = new LineCoordinates(pt2, pt3);
            LineCoordinates line2 = new LineCoordinates(pt1, pt3);
            LineCoordinates line3 = new LineCoordinates(pt1, pt2);

            // the angle of each vertex.
            var ang1 = LineCoordinates.AngleBetween(line2, line3);
            var ang2 = LineCoordinates.AngleBetween(line1, line3);
            var ang3 = LineCoordinates.AngleBetween(line2, line1);

            var vertex1 = new TriangleVertex()
            {
                Angle    = ang1,
                Location = pt1,
                Line     = line1
            };

            var vertex2 = new TriangleVertex()
            {
                Angle    = ang2,
                Location = pt2,
                Line     = line2
            };

            var vertex3 = new TriangleVertex()
            {
                Angle    = ang3,
                Location = pt3,
                Line     = line3
            };

            var ot = new ObliqueTriangle()
            {
                Vertex1 = vertex1,
                Vertex2 = vertex2,
                Vertex3 = vertex3
            };

            return(ot);
        }
예제 #2
0
        public TriangleVertex OppositeVertex(TriangleLine TriLine)
        {
            var startCoor = TriLine.StartLine.LineCoor;
            var endCoor   = TriLine.EndLine.LineCoor;
            var loc       = LineCoordinates.CommonEndPoint(startCoor, endCoor);
            var angle     = LineCoordinates.AngleBetween(startCoor, endCoor);

            var oppVertex = new TriangleVertex()
            {
                Angle    = angle,
                Line     = TriLine.LineCoor,
                Location = loc
            };

            return(oppVertex);
        }