algorithmic modeling for Rhino
If the ray is finite, then just use Curve CP and test whether the distance from the point to the curve is less than, say, 1e-12 or whatever tolerance you're happy with. Never use a distance of zero because chances are there will be some noise in the least significant digits.
If the ray is semi-finite or infinite the answer gets more complex, is this the case?
--
David Rutten
david@mcneel.com
Poprad, Slovakia
That's pretty clean comparitively.
I meant to reply to David but the device I was using died mid-response.
I actually did reply but it was confusing so I deleted it.
Anyways what I realize is I should not have asked to test a point on a ray, but instead an infinite line. Not a curve (and I guess technically not a ray).
But, it looks like both of our methods work as far as I can tell. I might have to adopt yours since it shaves a few components off of mine.
thanks,
-Brian
actually will yours work for an infinite line as opposed to one with an origin point? I'm not too familiar with using vector multiplications.
This is obviously my mistake since I wasn't clear about what I actually needed (line vs. ray intersection).
I think that what your question reduces to is will Andrew's definition work if the points on the infinite line are arbitrarily chosen with respect to the test point. In that case I think you would need to consider the case where the direction of one vector is 180 degrees out of phase with the other ie. its along the same direction but with opposite sense. In other words you must test for -1 as well as 1. Using a(dot)b=|a|*|b|*cos(theta) if vectors a and b are each unitized (each equal to 1) then the dot product returns the cosine of the angle between them. If this is either 1 or -1 (cos(0) or cos(180)) then those vectors are at least parallel and if they have one common point then they are on the same line.
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by