Grasshopper

algorithmic modeling for Rhino

How to determine a point on a 3D curve if only x,y are known

I have a curve in 3d.  I know what the x,y coordinates on the world plane are of a point that would be on that curve, but I don't know what the z value is.

Any suggestions on how to find the z value of the curve point that would match up with x,y known values?

Views: 1127

Replies to This Discussion

hi,

you can make a line ("Line" component). First point of your line will be the point X/Y/0. Set the second point X/Y/1000 or more.

Then use the "Curve Proximity" component. Plug in your first curve (the 3d one) and the second line.

Read your point.

Hope this helps,

Raul

Thanks Raul.  I tried this and it worked.  The only thing I did different was rather than using the Curve Proximity component I used the Curve|Line intersect component.  That worked because the xy of the line matched the xy of the curve I'm trying to discover the z for.

Option number 2:

  1. Project the curve onto the world XY plane.
  2. Use Curve CP with the projected curve and the point. This gives you a t value on the curve.
  3. Evaluate the original curve at the same t value and you have your 3D point.

--

David Rutten

david@mcneel.com

Ah, yes, makes sense David.  In following your same train of thought I took the world xy point that I know, and used the Project Point component to place that point on the curve I'm trying to read z for (since I know the projection direction has to be z).  That gave me my 3D point to evaluate.

Looks like both methods work.  Are there any caveats to either method, or is it simply a matter of taste?

I prefer my option as it relies on Curve|Point proximity instead of Curve|Curve proximity. The latter is a more involved algorithm that is more likely to go wrong and take longer.

Also it's not always clear how long you should make the vertical lines. They need to extend beyond the boundingbox of the curve, which means additional components if you want to make this work for all cases.

You can also get away with projecting the original curve once, meaning you don't have to create a new curve for every point you're sampling, but that should only become a consideration if you're doing this for thousands upon thousands of coordinates.

--

David Rutten

david@mcneel.com

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service