Geometry Question - CircularArc2d

Geometry Question - CircularArc2d

Anonymous
Not applicable
963 Views
4 Replies
Message 1 of 5

Geometry Question - CircularArc2d

Anonymous
Not applicable
Given I have a valid CircularArc2d object:
CircularArc2d ca2d = new CircularArc2d(bulgevertex.Vertex, mPolygonLoop[j + 1].Vertex, bulgevertex.Bulge, false);


what is the formula for finding the midpoint on the arc?

... I am challenged geometrically.

dennis
0 Likes
964 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable
This is in vba but it is the math you want.
[code]
Function MidPtofPolyArc(iSeg As Integer) As Variant

Dim P1 As Variant, P2 As Variant
Dim MidPt(2) As Double
Dim dBulge As Double
Dim Height As Double, Dist As Double
Dim deltaX As Double, deltaY As Double
Dim Slope As Double
Dim dLength As Double
Dim MidArc(2) As Double

P1 = oPline.Coordinate(iSeg)
P2 = oPline.Coordinate(iSeg + 1)

deltaX = P1(0) - P2(0)
deltaY = P1(1) - P2(1)

Dist = Length(P1, P2) / 2

If deltaY >= 0 Then
Dist = -Dist
End If

MidPt(0) = (P1(0) + P2(0)) / 2
MidPt(1) = (P1(1) + P2(1)) / 2
MidPt(2) = oPline.Elevation

dBulge = oPline.GetBulge(iSeg)
Height = dBulge * Dist

If deltaY = 0 Then
MidArc(0) = MidPt(0)
MidArc(1) = MidPt(1) + Height
ElseIf deltaX = 0 Then
MidArc(0) = MidPt(0) + Height
MidArc(1) = MidPt(1)
Else
Slope = deltaY / deltaX
Slope = -1 / Slope 'Invert slope for perpendicular bisector
'X = X1 + distance / dLength * DX
'proving for DeltaX=1 in slope direction
'slope=DeltaY / 1 => DeltaY=slope
dLength = Sqr(Slope ^ 2 + 1)
MidArc(0) = MidPt(0) + (Height / dLength) * 1
MidArc(1) = MidPt(1) + (Height / dLength) * Slope
End If

MidPtofPolyArc = MidArc

End Function

[/code]
0 Likes
Message 3 of 5

jbooth
Advocate
Advocate
Try using the GetPointAtDist function (I might be wrong though).

I'm pretty sure there's a function in the curve class (CircularArc2d derives from it) that can help you.
0 Likes
Message 4 of 5

Anonymous
Not applicable
Point2d midpoint = ca2d.EvaluatePoint( 0.5 );

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5866798@discussion.autodesk.com...
Given I have a valid CircularArc2d object:
CircularArc2d ca2d = new CircularArc2d(bulgevertex.Vertex, mPolygonLoop[j + 1].Vertex, bulgevertex.Bulge, false);


what is the formula for finding the midpoint on the arc?

... I am challenged geometrically.

dennis
0 Likes
Message 5 of 5

Anonymous
Not applicable
thanks to all for responding ...

EvalutePoint() is exactly what was needed.

... but I am still challenged geometrically 😉

dennis
0 Likes