Grasshopper

algorithmic modeling for Rhino

Hi!
Could anybody help me with this question:
if I have a planar curve, no matter how it looks, and a point, which is in the same plane but not on the curve, how to find the normal to this curve through the given point?
of course if the curve meanders enough, there are multiple normals to this curve going through the point.
it´s easy creating the normal from a given point on the curve, but i can´t seem to find a way to solve this.
i would be greatfull for your help!
thomas

Views: 3178

Replies to This Discussion

Try Curve CP component.
thanks, but i had already tried this, but this only created the closest point - which doens´t form a normal to the curve when connected to the original point...
more suggestions?
Well then I am missing something, please take a look at this definition. I found the closest point on a curve, then created a normal line from the same point on the curve with the same length as the closest point distance and the end of the line has the same co-ordinates as the original point. I moved the point around and the co-ordinates remained the same.

Maybe my logic is wrong though.
Attachments:
thanks for double-checking that - you seem to be right, that the shortest-distance-curve is a normal as well.
do you have any idea how i could find out the other normal through this point? - imagine the normal wandering to the righthandside of the curve in your posted image: it will cross the point once at least.
thank you again!
thomas
You can use the combination of Curve CP and Curve Frame to get the normals to the curve.

If you look at the components of the curve frame, the X-axis vector will be the tangent, the Y-axis vector will be the normal in plane and the Z-axis vector will be the normal to the plane at that point.


Is that what you are looking for?
Attachments:
Thanks Sameer
Sure thing
thats correct... the line is normal to the curve.
the problem is, i need all the normals going true the point.
i have added an image:
the red lines and point are created with the setup you gave me (thanks for that again).
i have added the other normals (not acurate, just in photoshop) to show the other normals i am looking for.
i had two ideas to solve this but they are not realy satisfying:
1. give the external point a dimension (a circle or a surface), then divide the curve in 1000 points and create the normals from this point. then look if they intersect with the circle. delete them if they don´t, keep them if they do.
but this is inacurate.
2. divide the curve in 1000 subcurves. apply the CP component to these curve. create a normal through the closest points. check if they go through my external point.
both are trial an error ways and i don´t really like them.
there must be a way to define geometricly what i´m looking for....
Attachments:
This problem is something that's best solved recursively, which is something that GH really doesn't like to do. Natively in GH, you may get close with a lot of divisions of the curve, but you'll never be very accurate with finding something that's truly 90 degrees from the curve. With a recursive approach, you can refine areas and get as accurate as you'd like.
I think this requires a loop, so VB script component. I will see if I can get some purely GH way, but can't promise anything.
As Damien has mentioned, the more divisions you have the closer you will get. Alternatively, you can increase the tolerance of your "normal" and find points that result in almost 90 degrees.

One quick attempt is demonstrated where you can come closer to true normals depending on the number of divisions you go with and your tolerance. This is a purely GH solution. I am sure a scripted solution would be more efficient.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service