Equal Distribution of Control Points between two curves

rhino

#1

Equal - not to be conflated with “evenly”.

Usefulness : When coming from two different objects that needs to be bridged.

Has anyone created a script that can take one curve, and to apply the other curve an equal number of Control Points - AND distribute them equally along the curve? Something like so:

Fig. Example (although the curves in this case belong to the same object) illustrated by @Stratosfear,
https://discourse.mcneel.com/uploads/default/optimized/3X/8/f/8fee564760ae1a6a39219ee223e3ff4ede133a37_1_690x426.jpg

// Rolf


(Dale Fugier) #2

Hi Rolf,

How about rebuilding each curve with the same number of control points? See the Rhino help file for information on the Rebuild command.

– Dale


#3

My intent was twofold. As I pointed out, I would (of course) first make sure that both curve has the same number of points (using Rebuild). But after that I would also want to distribute those CPs spaced exactly (individual distances between points) as the template curve. The rebuild operation wouldn’t know anything about a separate template curve.

// Rolf


#4

Hi Rolf,

I didn’t find a script that does this, but one approach may be:

  1. Find the closest points on target curves to the edit points (not control points) of template curve.
  2. Create an interpolated curve through each curve set of points.

Steve


#5

Hi @spb,
Thank you for this hint. It may be helpful, even in a script.

BTW, what is the difference between edit points and control points?

// Rolf


(David Cockey) #6

http://docs.mcneel.com/rhino/mac/help/en-us/popup_moreinformation/controlpoint.htm

http://docs.mcneel.com/rhino/mac/help/en-us/popup_moreinformation/editpoint.htm


#7

Thank you @davidcockey for the links.

I’m pondering on what the difference means to scripting the manipulation of curves and surfaces.

If I for instance wants to rearrange the boundaries (edges) of a trimmed surface’ so as to make it “untrimmed” in the technical sense, is it even possible to attack the problem via edit points, or is it the control points that needs to be dealt with?

// Rolf


(David Cockey) #8

If trimmed edges align with isocurves use ShrinkTrimmedSrf or ShrinkTrimmedSrfToEdge

If the surface has four edges (including zero length edges) but the trimmed edges do not align with isocurves then I believe you will need to rebuild the surface. Extract the trimmed edges using DupEdge and then use the resulting curve in rebuilding the surface.

(edited) A surface with more than four edges cannot be modeled as a single untrimmed surface. In some cases the appearance of more than four edges can be created by stacking control points to create kinks in the edges.


(David Cockey) #9

In Rhino only curves have edit points. Surfaces do not have edit points.


#10

@davidcockey: Yes, that’s the case I’m thinking about (the extracted edge-curves I’m referring to in the header although I didn’t say that).

So, in effect, it is the control points of a surface I want to modify (based on the structure of the extracted boundary curves) in order to arrive at an “untrimmed” surface where the isocurves are not aligned with the edges, right?

Edit: If so, are the Edit Points (of the curves) and the Control Points of the surfaces “compatible” so that aligning the surface edges with the curves (and evening out the CPs in between end points) would always result in the same edge positions?

Edit: The problem I describe above illustrated :

It’s obvious from the picture (at “A” and “B”) that DuplicateEdge, for instance, doesn’t result in curves that reflects the surface’ structure at the edges. The degree is preserved in the curve(s), but not the edit point structure.

At detail “4” I drew (black) interpolate curves through the surface’ control points, and then comparing the curves and the surface’ structure at 6:B shows that interpolate curves are not a big help in constructing a structure to which the trimmed surface (from “3”) can be reduced (or “shrinked”) into an untrimmed surface.

// Rolf


(David Cockey) #11

The untrimmed edges of a surface are isocurves. No exceptions are possible

The trim curve of a trimmed surface which is not an isocurve, such as the curve in your illustration, will usually have a different structure than the surface. The different sturcture may be needed for the trim curve to lie on the surface (within the absolute tolerance). A curve with the same structure as the surface which is not an isocurve will frequently not lie on the surface.

To create the untrimmed surface in your example a set of curves which define the untrimmed surface is needed, and then the surface would need to be created using that set of curves.


#12

OK, and given my intent, is it then correct to conclude that the untrimmed surface cannot be constructed based on any curves created with or duplicated with existing Rhino commands from the trimmed surface itself?

// Rolf


(David Cockey) #13

What do you mean by “the untrimmed surface”? If you mean an untrimmed surface which is exactly the same as a trimmed surface, with the edges of the untrimmed surface coinciding with the edges of the trimmed surface, then it is not possible unless the trimmed edges lie on isocurves. This is due to the mathematics of NURBS surfaces.

It is possible using existing Rhino commands to create an untrimmed suface which matches within a specified tolerance a trimmed suface with four edges. However the structure of the untrimmed surface may be different The method to do so and commands used will depend on the shape of the untrimmed surface and the desired accuracy of matching.


#14

Yes, that’s what I meant.

OK, so all this means that if I model something and trims a surface (to be joined into a polysurface), I will have to count on re-matching any such (re)created untrimmed surface. Even very tight tolerances tends to not produce perfect continuity unless running the MatchSrf command.

Edit: But if going very low level, calculating Knot data should give exact positions even on trimmed edges, and the corresponding Control Points. I have only read the article referred to from the Rhino Help file on NURBS (had to look up the Archive Wayback Machine version in order to find a version with pictures preseved, link here ) which didn’t go into surfaces though, only curves.

// Rolf


(David Cockey) #15

I agree that running MatchSrf on any new surfaces which need to match other surfaces is good practice. The one exception would be if the match needs to be position only and the new surface was created using the edge to be matched of the existing surface.