The curvature of a PlinePath arc segment is defined using a quantity
known as bulge. This unit measures the deviation of the curve from
the straight line (chord) joining the two vertices of the segment.
It is defined as the ratio of the arc sagitta (versine) to half the length
of the chord between the two vertices; this ratio is equal to the tangent of
a quarter of the included arc angle between the two polyline vertices.
In this way, a negative bulge indicates that the arc follows a clockwise direction from the first vertex to the next, with a positive bulge describing an anticlockwise oriented arc. A bulge of 0 indicates a straight segment, and a bulge of 1 is a semicircle.
An AutoCAD Arc Entity is defined by a center, radius, start and end angle. The arc is always defined to be anticlockwise oriented, that is, following an anticlockwise direction from the start angle to the end angle.
References:
- Bulge conversions
- lee-mac.com
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionarcRadiusAndCenter(PlineVertex v1, PlineVertex v2) static doublecomputeBulge(double x1, double y1, double x2, double y2, double r) This function will return the bulge value describing an arc with the given radius which starts at the first supplied point pt1, and terminates at the third supplied point pt3.static doublecomputeBulge(double x1, double y1, double x2, double y2, double x3, double y3) This function will return the bulge value describing an arc which starts at the first supplied point pt1, passes through the second supplied point pt2, and terminates at the third supplied point pt3.computeCircle(double x1, double y1, double x2, double y2, double b) This version uses the relationship between the arc sagitta and bulge factor, illustrated by the following diagram:
-
Method Details
-
computeCircle
public static BulgeConversionFunctions.ArcRadiusAndCenter computeCircle(double x1, double y1, double x2, double y2, double b) This version uses the relationship between the arc sagitta and bulge factor, illustrated by the following diagram:. . | . . |s . .∡θ/4 d | . p1-------------+------------p2 \ / \ / r \ ∡θ / c- chord = 2*d = |p1 - p2|
- bulge = b = tan(θ/4)
- angle = θ = 4*arctan(b)
- sagitta = s = b * d
- radius = r = (s^2+d^2)/(2*s) = d*(b^2+1)/(2*b)
- half chord = d = r * sin(θ/2) = |p2 - p1|/2
- c = polar(p1, atan2(p1,p2) + (pi - θ)/2, r)
-
computeBulge
public static double computeBulge(double x1, double y1, double x2, double y2, double x3, double y3) This function will return the bulge value describing an arc which starts at the first supplied point pt1, passes through the second supplied point pt2, and terminates at the third supplied point pt3.The returned bulge value may be positive or negative, depending upon whether the arc passing through the three points traces a clockwise or counter-clockwise path.
- Parameters:
x1- point 1 x-coordinatey1- point 1 y coordinatex2- point 2 x-coordinatey2- point 2 y coordinatex3- point 3 x-coordinatey3- point 3 y coordinate- Returns:
- the bulge
-
computeBulge
public static double computeBulge(double x1, double y1, double x2, double y2, double r) This function will return the bulge value describing an arc with the given radius which starts at the first supplied point pt1, and terminates at the third supplied point pt3.sin(θ/2)=d/r; θ=asin(d/r)*2; bulge=b=tan(θ/4)=tan(asin(d/r)*0.5)
See
computeCircle(double, double, double, double, double)for the formulas used.- Parameters:
x1- point 1 x-coordinatey1- point 1 y coordinatex2- point 2 x-coordinatey2- point 2 y coordinater- the radius of the circle- Returns:
- the bulge
-
arcRadiusAndCenter
public static BulgeConversionFunctions.ArcRadiusAndCenter arcRadiusAndCenter(PlineVertex v1, PlineVertex v2)
-