/// <summary> /// Geo Arc Constructor: Vertex, Vertex, Vertex (V3) /// The V3 Constructor takes three vertices that the arc must pass through and /// calculates all of the other properties of the arc /// </summary> /// <param name="vertex0">The Starting Vertex</param> /// <param name="middleVertex">The Middle Vertex</param> /// <param name="vertex1">The Ending Vertex</param> public GeoArc(Vertex vertex0, Vertex middleVertex, Vertex vertex1) { // Vertex 0 _vertex0 = vertex0; Vertex0.PropertyChanged += Vertex0OnPropertyChanged; // Middle Vertex _arcMiddleVertex = middleVertex; MiddleVertex.PropertyChanged += MiddleVertexOnPropertyChanged; // Vertex 1 _vertex1 = vertex1; Vertex1.PropertyChanged += Vertex1OnPropertyChanged; // Center Vertex _centerVertex = CalcCenterVertex(Vertex0, MiddleVertex, Vertex1); CenterVertex.PropertyChanged += CenterVertexOnPropertyChanged; // Starting Angle _startAngle = Vector.AngleBetweenVectors( new Vector(CenterVertex, vertex0), UnitVectors.XUnitVector ); // Ending Angle _endAngle = Vector.AngleBetweenVectors( new Vector(CenterVertex, Vertex1), UnitVectors.XUnitVector ); // Total Angle Angle = EndAngle - StartAngle; // Bulge _bulge = Bulge.CalcBulge(Angle); // Radius _radius = GeoMath.Distance(CenterVertex, vertex0); // Geometric Properties Length = CalcLength(); Area = CalcArea(); }
/// <summary> /// GeoArc Constructor: Center Vertex, Starting Angle, Ending Angle and Radius (CAAR) /// </summary> /// <param name="centerVertex">The Center Vertex of the GeoArc</param> /// <param name="startAngle">The Starting Angle (Radians)</param> /// <param name="endAngle">The Ending Angle (Radians)</param> /// <param name="radius">The Radius of the Arc</param> public GeoArc(Vertex centerVertex, double startAngle, double endAngle, double radius) { // Set Type GeometryEntityType = GeometryEntityTypes.GeoArc; // Center Vertex _centerVertex = centerVertex; CenterVertex.PropertyChanged += CenterVertexOnPropertyChanged; // Start Angle _startAngle = startAngle; // End Angle _endAngle = endAngle; // Radius _radius = radius; // Angle Angle = EndAngle - StartAngle; // Bulge _bulge = Bulge.CalcBulge(Angle); // Vertex0 _vertex0 = CalcPointOnArc(CenterVertex, StartAngle, Radius); Vertex0.PropertyChanged += Vertex0OnPropertyChanged; // Vertex1 _vertex1 = CalcPointOnArc(CenterVertex, EndAngle, Radius); Vertex1.PropertyChanged += Vertex1OnPropertyChanged; // Middle Vertex _arcMiddleVertex = CalcMiddlePoint(); MiddleVertex.PropertyChanged += MiddleVertexOnPropertyChanged; Length = CalcLength(); Area = CalcArea(); }
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(); }
/// <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))); }