Bezier to pdf and back again?


#1

I often use a small, but very good, program to rough out boats. It draws the hull and deck up using bezier splines.
Here is what it looks like.

You can see the control points used to create the splines. They are the red and yellow dots.
I then use the forms function to make pdfs of the forms I use to recreate the hull in rhino by importing the resultant pdfs.

The imported pdf curves are actually a large number of straight lines. Here is what I mean. Here is the curve with the points turned on. I know they are straight lines because the curvature graph shows nothing, and the rebuild function shows them as degree 1.

I am unable to recreate the bezier splines in rhino. The rebuild function gives results that are much different to the pdf curves. Here is the same curve as an example of what I mean.

Is there a rhino curve function that will:

  1. convert the series of straight lines into a curve, and
  2. enable a recreation, or close to, the original bezier spline?

For some added clarification, here is that original curve shown on a grid.


#2

Looks like your exporter tessellates the Bézier splines into polylines before exporting - unfortunate, as PDF’s do support Béziers.

Rebuild (as you show) is one way, there are a few others, but none of them will be ideal I think. CurveThroughPolyline will fit a NURBS curve through the polyline points, but it will have the same control or interpolated points as the original - that is to say lots. It will be pretty close to the original though, but not very smooth (noisy) nor easy to edit.

So it’s probably best to stick with Rebuild in this case, but you will either need more than 4 points to get close to your original - in this case I had more success with something like 6 - or rebuild with 4 points and then noodle the control points of the result to get what you want - you can get extremely close, but it’s manual work for each curve. Make a copy of the originals and then lock them leaving them visible, then edit the copies using the locked curves as a visual guide.

The degree 3 4 point curves will be single-span, smoothest and easiest to edit, but I don’t know how smooth you need in this case.

Edit - I guess the question to ask here as well is if your program supports some other export method that preserves the splines?

–Mitch


#3

i believe FitCrv is what you want.

to try this i exported a logarithm curve from grapher with high resolution which are difficult to rebuild due to the continuos monotonous change of tangency and this gave me the best solution also in regard of the continuity.

i tried Rebuild but anything at least near close to FitCrv needs a multiple times more amount of points and still was not accurate enough due to its iteration which breaks the continuity.

at least with the settings shown below it gave me a 100% accuracy you can also try 2nd degree but the point count goes up and you may also increase the angle tolerancy to keep the point count lower

oh and exporting from rhino to pdf is not a good idea, it rebuilds the curves again, use dxf instead.


#4

I’ve never used it but I was interested how to get over this problem should it occur in the future when I need to rebuild or recreate forms.

Have a look here: http://www.blueheronkayaks.com/phpBB2/viewtopic.php?f=2&t=2470

Andy


(David Cockey) #5

FitCrv is my first choice when converting a polyline to a spline. From the FitCrv help"
When the input to the FitCrv command is a polyline, the FitCrv command treats the polyline vertices as a list of points, and it tries to compute a curve that goes near the points but has a reasonable number of control points. The FitCrv command is meant for polylines with many closely spaced points.

If you need a single span degree 3 curve (4 control points) you might try using FitCrv to convert to a degree 3 NURBS curve. Then use RebuildCrvNonuniform to rebuild maximum of 4 points.

Alternatively try RebuildCrvNonunifom directly from the polyline.


#6

Hi Hugo

For third degree Beziers, maybe GH may help.
Using the extreme points and two more points to define the curve tangents, we can try to find the internal CVs position with the sliders …

bezier.gh (10.1 KB)

( Very raw definition … I’m not a GH usual user … sorry )


#8

I saw this pop up again, I’ve never used _FitCrv and wondered how I would have approached this without that knowledge.

in the past where I’ve had to rebuild things for artwork I’ve used the _BlendCrv command. I guess in this instance, if you can extend the last section of the two extreme curves and use those as the points to blend from.

You can eyeball it and move both points be pressing shift at the same time.

http://screencast-o-matic.com/watch/cDXiQTjLMM

_
Andy


#9

I’ve had poor results with FitCrv and polylines in the past - it wouldn’t hold the tolerances specified - which is why I did not suggest it in the first place. It’s been a long time since I used it that way though, so perhaps it has been improved, will try again…

–Mitch


#10

I wonder if there is a way to add functionality to the _BlendCrv command for WIP6 by allowing the user to snap to a couple of points along the length of the curve?

Using my example above, if I’d overlaid that on top of the existing gemotery with lots of little lines and was able to snap to a point along the length it would output a perfectly accurate alternative.

I’m thinking of it in a similar way to using circle tangent to 3 curves and as an addition/alternative to using the handles.

Andy


(David Cockey) #11

I’ve had the same happen with FitCrv as well as RebuildCrvNonUniform, but usually in situations where there are large angle changes between segements of the polyline. For a polyline such as shown in the first post I’d expect good results with either.

Rebuild has the advantage that with enough points it can rebuild almost any polyline or curve within a resonable tolerance. The disadvantage of Rebuild is it “equally” spaces the control points which can result in many more control points in “flatter” or “smoother” areas than needed.

RebuildCrvNonUniform and FitCrv try to concentrate control points where needed, though not always successfully.

In some situations I’ve used Rebuild and then manually removed knots in areas where they are not needed, checking the revised curve against the original to make sure it didn’t deviate too much.