algorithmic modeling for Rhino
Well, since I found no other sollution, I just figured out a geometric attempt should suffice.
Here's the deffinition I wrote.
I still don't get why the IVRay fails when a point is in one of the axis (any zero coordinate). Maybe the problem could be solved with another type of intersection but, for the time being, this should do.
I guess someone could find a more efficient approach and will be happy to hear about it.
Cheers!
Could you provide a screenshot of what you're looking for, geometry-wise?
There goes a screenshot.
Given an ellipse and an external point (Point A), both in the same plane, find points B and C where AB and AC are tangent lines to the ellipse.
Don't know if that's detail enough but will be happy to provide more.
(just thought it could find non planar tangent lines by simply projecting the first point to the plane and back)
My first thought is that native Grasshopper might have trouble with that. That is, grasshopper doesn't excel at "searching", which is what you're essentially doing. If you solved this problem by hand, you'd swing your ruler around point A until it touched a point on the ellipse, which is your point B or C. This is a searching procedure in which you scan through the infinite points on the ellipse with your eye and ruler till you find the tangent.
Now, of course, it can certainly be done. However, this is when good old fashioned math comes in handy. I'd just go ahead and define an ellipse parametrically with 't' (parametrics here being here being traditional textbook parametrics, not grasshopper parametrics), take the first derivative, with respect to t, then find the equilibrium solutions (t=t1, t=t2) where the lines between the points defined by t1 and t2 and the point A have the correct derivatives.
Grasshopper should be able to do this, but you'd just have to do it all mathematically with functions.
However, if you don't need an EXACT answer, then just create a large amount of tangents around the ellipse, maybe 1000, and then have grasshopper find the ones that come closest to your point.
Well, yeah, I agree with you. Using good old math processes could be a solution. What I did was using a set of graphics to solve it (with radius X trace a circle here and there, find the intersections, etc.), which is what I posted above.
Using a "Search" strategy could be too much of a memory killer and approximating could end up with unexpected kinks (I'm actually making plans for steel plates) so I'll have to stick to the graphic manner until someone, since I'm way too bad with maths, finds an equational (does that even exist?) way of solving it.
Cheers!
Try this :
http://www.grasshopper3d.com/forum/topics/create-arcs-tangent-to-3d...
and file attached...
Man, that is a clever approach!
I still don´t exactly get what the cross product does bu I'll find it out.
Anyway, I compared the method you gave and the graph based one I did and got a slight difference (about 0.5%), which can be reduced increasing the count of vectors to interpolate, increasing the computation time to somewhere near where I was.
I'll still have to look if I can break apart your solution to find out how to get to a, say, more accurate solution.
You mean Dot product... it'll be 1 if the vectors are collinear, -1 if they're opposite (and 0 if they're perpendicular). So I just plot the curve and solve it graphically , since I'm too damn lazy to write a search algorithm!
Don't waste time, you'll never be able to find a perfect solution with this method because of the interpolation of the dot product values. There is no reason why the real dotX curve would fit a deg 3 spline.
Of course in the case of an ellipse you can make a construction like you did, and get a neat result, but the advantage of this method is that you can use it with any curve.
If it's speed your looking for, you might as well script it anyway, and use the new python awesome parallel stuff and use those cores...
:) Niiicely done Fred! I just had to say it.
...I was attempting this with TryGetBetweenCurve and a minor cheat (Point becomes ArcCurve with radius near 0) in VB... ha!
Thanks for the ScaleNU eye-re-opener. Good one.
I must say, I was skeptical. I tried this same thing last night but apparently didn't try hard enough. I just remade your script myself, and I'm pretty sure you're correct. This doesn't appear to just look like tangents, and I think it's the best way by far.
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