コード例 #1
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);
        }
コード例 #2
0
 public static XElement ToXElement(this TriangleVertex Vertex, XName Name)
 {
     if (Vertex == null)
     {
         return(new XElement(Name, null));
     }
     else
     {
         XElement xe = new XElement(Name,
                                    new XElement("Angle", Vertex.Angle),
                                    Vertex.Location.ToXElement("Location"),
                                    Vertex.Line.ToXElement("Line")
                                    );
         return(xe);
     }
 }
コード例 #3
0
        public static TriangleVertex ToTriangleVertex(
            this XElement Elem, XNamespace Namespace)
        {
            TriangleVertex vertex = null;

            if (Elem != null)
            {
                var angle    = Elem.Element(Namespace + "Angle").DoubleOrDefault(0).Value;
                var location = Elem.Element(Namespace + "Location").ToPoint(Namespace);
                var line     = Elem.Element(Namespace + "Line").ToLineCoordinates(Namespace);
                vertex = new TriangleVertex( )
                {
                    Angle    = angle,
                    Location = location,
                    Line     = line
                };
            }
            return(vertex);
        }