.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Geometry Question - CircularArc2d

4 REPLIES 4
Reply
Message 1 of 5
djonio
489 Views, 4 Replies

Geometry Question - CircularArc2d

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
4 REPLIES 4
Message 2 of 5
Bryco
in reply to: djonio

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]
Message 3 of 5
jbooth
in reply to: djonio

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.
Message 4 of 5
Anonymous
in reply to: djonio

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
Message 5 of 5
djonio
in reply to: djonio

thanks to all for responding ...

EvalutePoint() is exactly what was needed.

... but I am still challenged geometrically 😉

dennis

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost