Grasshopper

algorithmic modeling for Rhino

Circle Circle Intersection or Curve Curve Intersection or Tangent Circle Point

Hello
I have two OnCircle objects , and I need to find intersect points.
I tried to convert OnCircle to OnNurbsCurve and used .IntersectCurve, but I hope there is an easy way how to do it.
Thanks.

or:

I have a On3dPoint and I want to find its tangent point on the circle or on curve.
like On3dPoint.TangentTo(circle)
Thanks.

Views: 5274

Replies to This Discussion

Here is a part of my class in GH I hope it will help for easy understanding and use. Have a fun!
Lukas
Attachments:

Hi, 

 

Does anybody know how to get the tangent points of any curve,

 

Thanks!

 

 

Hi,

Following up on the suggestion to use a mathematical solution to find the intersection points,
here is a vb function that should work for 2 circles on the world xy plane:

'This is based on Paul Bourke's "Intersection of Two Circles"

Dim r0, r1 As Double
r0 = x.radius
r1 = y.radius

Dim p0, p1 As On3dPoint
p0 = x.Center
p1 = y.Center

Dim d As Double
d = p0.DistanceTo(p1)

Dim a, h As Double
a = ((r0 * r0) - (r1 * r1) + (d * d)) / (2 * d)
h = math.sqrt((r0 * r0) - (a * a))

Dim p2x, p2y As Double
p2x = p0.x + a * (p1.x - p0.x) / d
p2y = p0.y + a * (p1.y - p0.y) / d

Dim xPt1 As New On3dpoint()
xPt1.x = p2x + h * (p1.y - p0.y) / d
xPt1.y = p2y - h * (p1.x - p0.x) / d

Dim xPt2 As New On3dpoint()
xPt2.x = p2x - h * (p1.y - p0.y) / d
xPt2.y = p2y + h * (p1.x - p0.x) / d

ptA = xPt1 'A changed to ptA
ptB = xPt2


Hope it helps

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service