Ejemplo n.º 1
0
        private double _radius;          // The radius of the arc

        #endregion

        #region Constructors

        /// <summary>
        ///     GeoArc from Starting Vertex (<paramref name="vertex0" />)
        ///     ending Vertex (<paramref name="vertex1" />) and a bulge
        /// </summary>
        /// <param name="vertex0">First Vertex</param>
        /// <param name="vertex1">Second Vertex</param>
        /// <param name="bulge">The Bulge</param>
        public GeoArc(Vertex vertex0, Vertex vertex1, double bulge)
        {
            // Set type
            GeometryEntityType = GeometryEntityTypes.GeoArc;
            // Set Variables
            // Vertex0
            _vertex0 = vertex0;
            Vertex0.PropertyChanged += Vertex0OnPropertyChanged;
            // Vertex1
            _vertex1 = vertex1;
            Vertex1.PropertyChanged += Vertex1OnPropertyChanged;
            // Bulge
            _bulge = bulge;
            // Angle
            Angle = Bulge.Angle(BulgeValue);
            // Radius
            _radius = Bulge.Radius(Vertex0, Vertex1, Angle);
            // Center Vertex
            _centerVertex = CalcCenterVertex(Vertex0, Vertex1, BulgeValue);
            CenterVertex.PropertyChanged += CenterVertexOnPropertyChanged;
            // Start Angle
            _startAngle = Vector.AngleBetweenVectors(
                new Vector(CenterVertex, Vertex0), UnitVectors.XUnitVector
                );
            // End Angle
            _endAngle = Vector.AngleBetweenVectors(
                new Vector(CenterVertex, Vertex1), UnitVectors.XUnitVector
                );
            // Middle Vertex
            _arcMiddleVertex              = CalcMiddlePoint();
            MiddleVertex.PropertyChanged += MiddleVertexOnPropertyChanged;

            // Calculate Geometry
            Length = CalcLength();
            Area   = CalcArea();
        }
Ejemplo n.º 2
0
 /// <summary>
 ///     Calculates the distance between two points as it follows
 ///     an arc that is defined by a bulge.
 /// </summary>
 /// <param name="v0">The First Vertex</param>
 /// <param name="v1">The Second Vertex</param>
 /// <param name="bulge">The Bulge</param>
 /// <returns>
 ///     A double values that represents the length
 ///     along the arc defined by the two points and
 ///     the Bulge
 /// </returns>
 public static double Distance(Vertex v0, Vertex v1, double bulge)
 {
     return(Bulge.Length(Bulge.Radius(v0, v1, Bulge.Angle(bulge)), Bulge.Angle(bulge)));
 }