Project curve to a plane along axis...?


#1

Hi guys,

Having a brain fart here… can’t find the function I want.

I want to project a curve (in this case planar and on the world XY plane, but it could be otherwise) to an arbitrary tilted plane - BUT, I want to project it along a specific axis (such as world Z).

XFormPlanarProjection “pulls” the curve to the plane along the plane’s normal which is not what I want. I want something like Curve.ProjectToBrep, but without actually having to create a planar Brep to project onto… What am I missing?

Thanks,
–Mitch


(Menno Deij - van Rijswijk) #2

I think I know what you mean :wink:

If you know the axis vector and the plane, you could calculate the intersection of the line from each control point along the axis with the plane. Then update each control point location to its intersection position.


#3

Ouch, that’s a lot of work. It’s also possible to create a rather large PlaneSurface using the plane and then use ProjectToBrep (just need to get the interval large enough so that the plane surface covers the whole projection area) or extrude the curve an arbitrarily length (long enough) and then intersect it with the plane (BrepPlaneIntersection)… Both of those also seem rather long workarounds for this simple function, though.

Thanks, --Mitch


(Menno Deij - van Rijswijk) #4

I’m not aware of a simpler method than what I proposed (but I’m far from omniscient).

NurbsCurve crv;
Plane p;
Vector axis;

for (int i = 0; i < crv.Points.Count; ++i)
{
    ControlPoint cp = crv.Points[i];
    Line l = new Line(cp, cp + axis);
    double t;
    Intersection.LinePlane(l, p, out t);
    cp = new ControlPoint(l.PointAt(t), cp.Weight);
    crv.Points[i] = cp;
}

(David Rutten) #5

There’s a Grasshopper component that does what you need. RhinoCommon doesn’t directly expose this sort of transformation. It’s called [Project Along].


#6

Hi Mitch,

i´ve asked for this a few years ago, would be nice to have.

c.


#7

Hey David,
I thought Grrasshopper was based on RhinoCommon… :smile:

Anyway @dale @stevebaer this is a wish for RhinoCommon and if possible Rhinoscriptsyntax, etc.

Thanks, --Mitch


(Steve Baer) #8

I created an issue for this
http://mcneel.myjetbrains.com/youtrack/issue/RH-28683

@DavidRutten I made you the assignee since this looks like something you may be able to just move into RhinoCommon for V6. Please let me know if I’m confused.


(David Rutten) #9

Well, it is, but I added a lot of geometric algorithms of my own as well, most notably Delaunay, Voronoi and Metaballs, as well as a bunch of special transformations and spacemorphs.