Grasshopper

algorithmic modeling for Rhino

Hi All, 

I'm hoping someone can explain what is happening here. I'm sampling a point along a curve and using the tangent of that point to make a plane. When I compare that plane to itself there seems to be a slight difference in orientation, but this only happens for some places along the curve and doesn't happen on all curves. 

Usually such a small variation wouldn't matter to me but I'm using these planes to offset curves and I think this is the reason some of my curves are exploding after offset. 

Views: 486

Replies to This Discussion

That is disconcerting, I can repeat it, I'll have a look why it doesn't always return 0.0

--

David Rutten

david@mcneel.com

Poprad, Slovakia

Well, it's just a matter of the dot-product not giving an exact answer. In order to compute the angle between two vectors in 3D space the dotproduct is computed (should be 1.0 in my test case but it ends up being 0.99999999999999989). The dot product between two normalised vectors equals the cosine of the angle. It's just another example of the inaccuracy of floating point numbers in computing.

I can of course special case identical vectors so they always return an angle of zero, but all the other angles you compute will have a similar amount of noise to them.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

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