# Why is the maximum of a curve domain different from curve length?

crv_dom_max_vs_crv_length.gh (5.8 KB)

Domain and curve length are independent of eachother. Domain relates to the knot vector.

2 Likes

Pfff I guess I have to dig deeper into what nurbs are.

This is so counter-intuitive.

Can you (anyone) show me practical examples of curve domain usage?

The curve domain isnâ€™t a feature, itâ€™s how the nurbs equations work, thereâ€™s no getting away from it.

Think of the standard sine graph as a parallel. It goes up and down forever, but we can turn it into a finite curve by adding a domain, say from [0.0, 5.0]. We now have a 2D curve which starts at the coordinate (0.0, 0.0) and ends at coordinate (5.0, \text{sin}(5.0)).

Every number in between zero and five is a parameter on the interior of this curve. We can describe the curve (letâ€™s restrict ourselves to two dimensions only for now) parameterically using two equations: x(t) = t and y(t) = \text{sin}(t). If you want to know the coordinate of this curve at a given parameter, you just plug that parameter into the equations for x and y and out pops the coordinate.

How long is this curve? Thatâ€™s not so easy to answer. Certainly longer than five though. Also, if you imagine picking any parameter t on the interior and then evaluating the curve coordinate at t and t+dt (where dt is a small number), youâ€™ll get two points close together. But how close together? It depends on the value of t. At some places on the curve where it is very nearly horizontal, the distance between C(t) and C(t+dt) will be very close to dt. However at other places where the sine wave is travelling at about 45 degrees as it crosses the x-axis, the distance will instead be close to \sqrt{2} \cdot dt. A constant step in the parameter space does not result in a constant step in xy space. Curves are squished and stretched in space in ways that have little to do with the lengths along the curve.

Sine curves and nurbs curve like to work in parameter-space, not length-space. It is the mathematically natural way to think about these shapes. Lengths are difficult and often impossible to compute, they have to be approximated instead using iterative algorithms that improve upon a solution until weâ€™re happy with the tolerance weâ€™ve reached.

6 Likes

Have some fun with C# on curve matters

Trim_Curves_AndOtherStuff_V1.gh (124.7 KB)

1 Like

Thanks David,

Geometrical approximation of a trochoid:

I guess you never really think about whatâ€™s inside the CAD when start working with it.

@ivelin.peychev
I remember telling you this at least twice. Just saying. You might start to believe me now?

2 Likes

Clearly itâ€™s a matter of the Garmin alternative thingy (and that avatar). Solution: want respect? use this :

2 Likes

I just named me tomtom because some idiot already named himself tom.
Didnâ€™t expect me becoming so famousâ€¦

Genau! I do have trust issues.

1 Like

Peter, if Tom uses this as avatar then heâ€™ll be your master

1 Like

Fear not > thereâ€™s Plan B > let the Emperor do the dirty work > then > just kill > elementary my dear Watson.

BTW: Get some hypo curves stuff (and modify the code and do some â€śanimationâ€ť)

Curves_Hypo_V2.gh (130.2 KB)

2 Likes