Rebuild tool for curves

Hi all,
I would like to Know if is possible to make what Rebuild UV for surfaces do the equivalent or similar for curves.
In my opinion, it would be interesting to be able at least to get this results:

That makes depending on the shape and the approach to get automatically a better aproximation and a cleaner curve in regard of control point distribution (in the example the best option would be by curvature) .
It would save me a lot of time in some occasions for example in rebuilding complex intersections, projections… which Rebulid tool is not good enough and requires a lot of manual work to get a decent control point distribution.

I hope what I exposed is understandable, otherwise I could post a real example.

4 Likes

Another option that would be very convenient (maybe is more complicated to be implemented) is to be able while using the rebuild tool to place knots in a desired position of the curve or freeze the existing knots you want to keep.

Are you familiar with RebuildCrvNonUniform?
https://docs.mcneel.com/rhino/7/help/en-us/index.htm#commands/rebuildcrvnonuniform.htm?Highlight=rebuild

1 Like

I am not familiar with that. I will check it out and see the results.
Thanks.

Hi Mr Brock;
The main point of this threat is to have a tool similar to RebuildUV for curves. Maybe the options that may offer such a tool must be reoriented for that purpose:

-Arc lenght: Distribution of control points equidistant
-Curvature:(see the image above)
-Normal: Follows the original parameterization.

By the way, RebuildCrvNonUniform has partly something to do with the second post, but in a very limited way.

Thank you in advance.

@jordi.rovira I’m trying to collect info about the deficiencies of Rebuild for either curves or surfaces. I guess I am especially interested in cases where we get a poor result. I need to .3dm files for examples.

The way I instictively look at Rebuild is it should get a curve which is optimally close to the target
with the desired CV count and degree.

Rebuild for both curves and surfaces should be based on “fitting” to minimize deviation with appropriate constaints, not interpolation through a discrete set of points. I’ll post a more detailed description when I have a bit more time.

Thanks David I look forward to your testcases.

Hi @jordi.rovira you might be interested in this post

By asking for testcases you show that you entirely missed the point of what David was suggesting.

The process of creating accurate uniform sampling algorithms is a well-studied area of mathematics. You don’t need testcases almost any case will do.

There are very few testcases where “interpolation through a discrete set of points” as David so well described what the Rebuild command has been doing for the last 25 years will produce the most accurate resampling result.

The basic problem with the way rebuild works is that it creates distortion due to high frequency artifacts.

There is no good reason for the uniform points along a curve that is being rebuilt to be treated as some sort of sacred cows that the result must adhere exactly to those points at the expense of all other points on the curve. The only case where the current rebuild resampling algorithm works is those cases where the curve is already so smooth rebuilding is unnecessary.

1 Like

In case, the above statement needs clarification here is an example file:
RebuildCrv.3dm (28.6 KB)

The black curve in the file is the original curve.
The red curve is after rebuilding to 8 points (max deviation=0.00617)
The blue curve is the red after a little control point editing ( deviation =0.001635)

If you run ConvertToBezier on the red curve CrvDeviation will show that all the deviation from the original black curve is around the middle of each Bezier segment. The ends of each bezier segment are precisely on the black curve.

If you run ConvertToBezier on the blue curve CrvDeviation will show that the deviation is now spread out over each bezier segment. The fact that the deviation is no longer localized to the center of each bezier span means one can get a result curve that is both more accurate and more smooth.

Thanks Jim I added your testcase and comments to RH-69586 Rebuild: Point spacing by curvature. Your example will be helpfull. Especially since it is degree 3 multispan. Most example I have are a higher degree single span.

You can be assured that having testcases is not contrary to an implementation

based on “fitting” to minimize deviation with appropriate constaints

As David suggested.

1 Like

@GregArden Test case - a simple degree 3 single span curve.
CurveExampleB.3dm (1.9 MB)
The file includes the results of Rebuild to degree 3 and degree 5 curves with 1 to 7 spans. If the shape and curvature matters then the results range from ugly to not good.

@GregArden Another test case - a degree 3 polycurve with 5 spans.
CurveExampleA.3dm (1.9 MB)
The file includes the results of Rebuild to degree 3 and degree 5 curves with 10 to 18 control points. The reults generally contain oscillations, which are worse with degree 5.

Haha, that looks fun! Reminds of this:

@davidcockey , regarding CurveExampleB. I’m confused why you would use Rebuild on this curve. If you desired degree 3 with more spans you could just insert knots at locations of your choosing. To get degree 5 curves you start with increase degree and then insert knots.

However I do think our results are atrocious. We could have gotten the right result even with our simplistic interpolation scheme. We must have reprameterized by arc length and then did our interpolation.

I think the goal is to minimize the error and in these cases that means 0 error. Notice as of now rebuilding to multiple spans always makes curves with uniform knot spacing so the answer is unique.

@GregArden CurveExampleB was provided as a simplified test case which would make problems obvious. If a command has problems with this simple case then it will have problems with at least some more complex cases.

Uniform knot spacing is not required for the answer to be unique. Interpolation of a spline through a set of points with a specified knot spacing should generally have a unique answer. Perhaps what you meant was the uniform knot spacing helps make the solution for the interpolated spline well conditioned.

What I meant was if the knot locations were parameters then the solution would not be unique. These are indeed good simple examples that should work. Sounds like we agree on what the right answer is.