algorithmic modeling for Rhino

I want to extract the 2d representations of NURBS curves by mapping them into the 2d coordinates of the client space.

I'm using Rhino.Display.RhinoViewport.WorldToClient

I'm doing this so that I can translate NURBS curves into SVG paths.

Once I map it to the 2D space, I have a choice between different ways of converting the Curve into the SVG path specification geometry:

Cubic Bezier

Quadratic Bezier

So here's my questions:

  1. Do you have any advice on mapping from world space to client space?
  2. Do you have any advice on converting NURBS curves to Cubic or Quadratic Beziers?


Views: 1029

Reply to This

Replies to This Discussion

Hi Ben,

You'll probably want to call BezierCurve.CreateCubicBeziers as a first try.  Of course that isn't going to get you very far since I haven't exposed anything on the BezierCurve class (I'm working on that right now.)



Thanks Steve!

Steve, that looks like it would probably work great, since I assume I can feed it anything that inherits from the Curve Class.

When you say you "haven't exposed anything", does that mean that with a little vars() or other introspection I wouldn't be able to see, nor would I be able to use, the attributes and methods, or does that just mean that it is not visible in the SDK docs?

Also I notice that Bezier Curve inherits directly from System.Object, I guess that means it doesn't inherit from Curve, and therefore doesn't share the same attributes (or maybe the inheritance is just hidden).

So, I guess I still have an important geometry question, which is:

If I translate each control point of a NURBS curve into client space to form a new 2D NURBS curve, will that curve be an accurate 2D representation of the view of the original 3D curve?

Hi Ben,

There are no properties or methods yet on the BezierCurve class.  There just isn't anything there yet to work with.  That being said, I just committed a bunch of additions to the BezierCurve class in RhinoCommon so you should have a usable class in next week's beta (I think I missed the deadline for this week's beta.)

The CreateCubicBeziers function attempts to create "fit" Bezier curves to a NURBS curve within given tolerances  so the 2D representation.



Thanks Steve!

Will the SDK docs update online, or if not, will the new members be exposed to something like dir()?

I'm going on vacation for a long weekend, but when I get back I'll update the online docs.  dir() will just work.

great, that'll work fine for me. I'm in no rush. Have a great vacation!






  • Add Photos
  • View All

© 2018   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service