Grasshopper

algorithmic modeling for Rhino

I am trying to move some elements along a curve. I am doing this by taking the t value of points alnog the curve, and adding numbers to it. Since it's all between 0.0 and 1.0 these values are very small.

On the first picture, you see the value x (relative to the world system) which i wanted to extract and turn into the curve system (t 0.0 - 1.0). However it seems that the decimals are being rounded too soon (only 3 decimals in the sine function) and thus leading to imprecise results.

In order to translate these values i did the following:

multiplied the sine with a real world length, and then divided the result with the curve's length.

Views: 367

Attachments:

Replies to This Discussion

Why do you think the values get rounded? The display of numbers often displays rounded values instead of the actual values otherwise it would be very hard to read most numbers.

Can you post a screenshot of your document? Adding a value to a curve parameter might cause your parameter to go beyond the end of the curve. A number between 0.0 and 1.0 is not necessarily small, it depends on how big the curve domain is (might be 0.0 to 0.1, might be 0.0 to 1e18).

--
David Rutten
david@mcneel.com
Seattle, WA
But if reparametrize is ticked on the curve, it will always be 0.0-1.0?
The numbers are much more precise, just what we see in the note and output gets rounded so it easier to read?
Yes, if you want to see the exact binary numbers, then feed your numbers through an f(x) component and use the expression:

Format("{0:R}", x)

The "R" stands for "RoundTrip formatting" which means that the resulting string does not discard any digits.

--
David Rutten
david@mcneel.com
Seattle, WA
Yes, if you reparameterize the curve, the domain will be set to {0.0 -> 1.0}.

--
David Rutten
david@mcneel.com
Seattle, WA
Thank you!

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service