コード例 #1
0
        private void RenderConnections()
        {
            // Render the connections between the edges
            foreach (Connection connection in _connections)
            {
                Point firstStart = connection.StartPoly.Vertices[connection.StartEdgeIndex.Start];
                Point firstEnd   = connection.StartPoly.Vertices[connection.StartEdgeIndex.End];
                float length1    = EdgeIndex.Length(firstStart, firstEnd);

                Point secondStart = connection.EndPoly.Vertices[connection.EndEdgeIndex.Start];
                Point secondEnd   = connection.EndPoly.Vertices[connection.EndEdgeIndex.End];
                float length2     = EdgeIndex.Length(secondStart, secondEnd);

                if (length1 <= length2)
                {
                    Point point = LineSegment.GetMiddle(firstStart, firstEnd);
                    PrimitiveDrawer.DrawFilledCircle(point, 15, new Color(0, 0, 1, 1));
                }
                else
                {
                    Point point = LineSegment.GetMiddle(secondStart, secondEnd);
                    PrimitiveDrawer.DrawFilledCircle(point, 15, new Color(0, 0, 1, 1));
                }
            }
        }
コード例 #2
0
        public LineSegment GetShortestEdge()
        {
            Point firstStart = StartPoly.Vertices[StartEdgeIndex.Start];
            Point firstEnd   = StartPoly.Vertices[StartEdgeIndex.End];
            float length1    = EdgeIndex.Length(firstStart, firstEnd);

            Point secondStart = EndPoly.Vertices[EndEdgeIndex.Start];
            Point secondEnd   = EndPoly.Vertices[EndEdgeIndex.End];
            float length2     = EdgeIndex.Length(secondStart, secondEnd);

            if (length1 <= length2)
            {
                return(new LineSegment(firstStart, firstEnd));
            }
            else
            {
                return(new LineSegment(secondStart, secondEnd));
            }
        }