algorithmic modeling for Rhino
Hi.
At a point I need to add a Curve of a certain length along a direction.
I've made the following code work, but I am not sure how elegant it is, especially the conversion from Line to LineCurve to Curve. I need a Curve, because I do a CurveCurve intersection check later and this function doesn't accept a Line as a parameter. And since there is no constructor for Curve, I did it like this...
directionVector *= distance; // set Vector length
Line ln = new Line(point, directionVector);
Curve crv = new LineCurve(ln).DuplicateCurve();
I would appreciate your input and a better solution.
Cheers
Eirik
Tags:
You don't have to duplicate the LineCurve, LineCurve already implements the abstract Curve class:
Curve crv = new LineCurve(ln);
--
David Rutten
david@mcneel.com
Poprad, Slovakia
Shorter still:
Curve crv = new LineCurve(point, point + directionVector * distance);
--
David Rutten
david@mcneel.com
Poprad, Slovakia
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