Geometric constraint -- Line tangent to circle

The purpose of this thread is to discover the upmost simple way to demonstrate how to constrain a line tangent to a circle with GH.

Any takers are welcome.

Here’s the mess I have so far:


simple_line_tangent_to_circle.gh (12.7 KB)

This type of constraint, in the CAD world, is so basic and so simple, that even a newcomer should be able to figure it out in 5 minutes.

GH has a long way to go. But maybe I’m missing something, if not another 10 or so years of education maybe :sweat_smile:

I’ll be adding this project to my list, hopefully I figure it out this week.

If any experts out there want to show me the light, I’d appreciate it… Cheers :beers:

I’m not convinced by this definition:

Although maybe formatting it differently will help.

1 Like

1 Like

Interesting, but this isn’t really the simplest way to illustrate this particular constraint.

Still room for refinement.

K this is getting interesting…

I guess I’m trying to figure out how to constrain a point onto the circle, so that the tangent curve will move wile remaining tangent…

Not seeing a perpendicular constraint… :sleepy:

Something like this, I guess-
TangentToCircle.gh (6.5 KB)

Make two point objects and assign to the circle center and line end point.
CurveTangentToCircle.gh (10.8 KB)
CurveTangentToCircle.3dm (46.6 KB)

-Pascal

1 Like

Idk, I got a weird err…

I’ll try that…

K this is interesting:

Although, as a user I’d like to interact with the two points, I suppose having them assigned this way allows me to drag them around in the workspace directly, which is probably ideal.

It would be cooler if GH could calculate the equations in realtime during the dragging of the points however.

Not sure I set the points right…

I think it would be interesting to get a point to be residing along the circle somehow, for experimentation. It might not make sense for certain circumstances but, it would in fact be a good ‘constraint’ to have in the future.

tangent_lines.gh (7.3 KB)

Solution based on trigonometry. Uses arccosine to calculate the angle between the line from A to center and the edge of the cicle.

1 Like

That sounds cool. I was thinking someone would take it in this direction eventually :slightly_smiling_face:

I look forward to checking it out :beers:

Been getting weird err’s today, not sure what I’m missing…

This is very interesting. I didn’t realize panels can work as inputs :exploding_head:

I noticed the ‘internalized’ center point of the circle kinda acts like an ‘anchor’ constraint…

I think your trig antiquated the circle :sweat_smile:

This is a pretty cool example:

I like how it constrains the point to the circle, position of the curve at the point of tangency and length of curve, and size of the circle. Really cool :sunglasses:

I guess what’s missing is center of circle position, and maybe a couple other things. It’s hard to say how to turn these things into universal constraints however.

Center of the circle is the ‘P’ (Plane) input. Trivial, not missing at all.

1 Like

interesting :face_with_monocle: :thinking: :thought_balloon: :exploding_head:

We’re definitely getting somewhere. I’ll be checking this out more later this week. :beers:

Grasshopper operates (mainly) as a Directed Acyclic Graph (DAG). This means dependencies flow one-way only, and there are no dependency loops. Updates flow only downstream.
When people talk about geometric constraints they usually mean some system where different elements can be interacted with while maintaining specified geometric relationships between them. This is in direct conflict with the DAG approach, because the interactions between the elements need to be bidirectional.
Say you have a pair of lines you want to keep parallel, but also to be able to drag the points of either one. This is not possible to set up as a one directional dependency.

Some geometric constructions can be set up in a directed parametric way, but this is not the same thing as a constraint solver in the way that term is typically used, and if you want to switch which elements drive and which are driven, it generally requires making a new GH definition.

All this is not to say it’s impossible to include loops, bidirectional relationships or constraints in Grasshopper, but just to point out how these things require something beyond its main way of working.

The one-way dependency is an important part of Grasshopper’s conceptual clarity though, so anything which goes outside of this faces UI challenges in making it clear and easy to use.

Kangaroo tackles this by containing all the cyclic/bidirectional dependency inside one self-updating component on the canvas, with everything upstream and downstream of it keeping to the regular Grasshopper one-way system; the relationship setup as Goals upstream and the processing of results downstream.

This works well for some things, but for some types of geometric constrained systems it becomes very cumbersome compared to conventional constrained sketch setup, where the creation of relationships happens mainly by clicking on the geometry itself.

The Constraints project aims to tackle this within the Rhino interface. There has also been some discussion of new ways of setting these things up within GH2. This is all still WIP stuff though.

5 Likes


circle_tangent_2024Jan10a.gh (13.8 KB)

Inside the AzAlt (Azimuth Altitude) cluster:

1 Like

The AzAlt (Azimuth Altitude) cluster accepts a plane as input and has a plane output, so can be chained together for a multi-axis system. This model from 2.5 years ago uses one AzAlt for the bottom cylinder, a second AzAlt for the top cylinder and a control to rotate the box at the top end. Cool. :sunglasses:


Azimuth_Altitude_2021Aug7b.gh (15.6 KB)

2 Likes

Thank you for the knowledge, this is very interesting.

This gives me hope and I still think it’s all possible.

I really appreciate your insight. This still gives me hope, and I very much look forward to the future of Rhino and GH.

I really hope we don’t limit ourselves to the concept of “sketches”. I think “sketches” is a limiting concept. Unless, it means “3D all the time” – per say.

I’m speechless, but I’m glad you’re sharing insight :slightly_smiling_face:

This stuff is really cool :sunglasses: