Table of Contents
You can connect two or more Control Points by creating a Connection.
Splines are curves, created by some weird math formulas. Give em some reference points (called “Control Points” or CP in Curvy) and a time value and they return a point in space. When you call that formulas with diffent time values (say 0, 0.1, 0.2 up to 1), you get a set of points. Those points connected build the curve you want to work with.
Some spline types need more reference points than others, some spline types take additional parameters to define the curvation, but basically it works the same way.
If you want to know more, see here for a start. Otherwise just enjoy curves with Curvy.
ControlPoints vs. Segments
Say we have three Control Points and we use the simplest spline type - a linear “curve” aka lines, we got a spline with two segments. Add another CP (totals 4) and the resulting spline has three segments. Think of vertices and edges between them.
In Curvy, Control Points and segments are the same components (CurvySplineSegment). So a segment is nothing else than a ControlPoint that spans a curve to another Control Point. In other words: each segment is a ControlPoint, but not vice versa. Once you work with it, you'll find this quite intuitive.
A spline segment point is calculated by entering a time (from 0 to 1) into the spline formula, so all API methods dealing with segments have a parameter “F” (for “fragment”). Don't misread this as percentage, F isn't proportional to length, so F=0.5 doesn't mean half of the curve segment length-wise. So, F=0 identifies the start of a curve segment (the position of a Control Point) and F=1 refers to the end of that curve segment (the position of the next Control Point).
Like F for segments, all API methods dealing with the whole spline use “TF” (“Total Fragment) to identify a point on the curve. TF=0 refers to the starting CP of the first segment, while TF=1 refers to the end CP of the last segment. Like with F, TF isn't proportional to length, too!
While F and TF are great to identify points on the curve, most users wan't to work with actual world unit lengths. Fortunately Curvy can convert between distances and fragments, so you're free to use the units you like. In Curvy's API, localDistance parameters span over the length of a segment (for segment level methods) while distance spans over the total curve length (for spline level methods).
Keep in mind that internally Curvy uses fragments (F,TF) only, so each method accepting distances needs to convert to fragments internally. Usually you can ignore conversions CPU cost, but if you plan to move thousands of objects each frame, you should consider working with fragments only or at least reduce conversion calls to the minimum.
Each Curvy spline uses one of the following spline types:
Well, not much to say about this spline type. Did you know? It's the fastest of all splines types.
CR Splines are fast to calculate, easy to work with and result in natural paths. Unlike linear splines they need at least four Control Points to calculate a segment (by default Curvy calculates the two missing CP's at the spline's start and end automatically!).
Kochanek Bartels Splines are much like CR-splines, but use three additional parameters to define the curvation: Tension, Continuity, Bias (hence the name “TCB splines”). Playing with those parameters you can achieve very weird looking curves…
Bezier splines are different than CR and TCB splines, because a segment's curvation isn't affected by more than the two Control Points directly forming a segment. Instead each Control Point has two handles - incoming and outgoing - and the curvation of a segment is determined by manipulating a CP's outgoing handle and the next CP's incoming handle. If you ever worked with Unity's AnimationCurve, you know Bezier splines inside out!
Working with custom data
To store custom data for a curve, use Metadata.