Ardour  9.0-pre0-582-g084a23a80d
ArdourCanvas::InterpolatedCurve Class Reference

#include <interpolated_curve.h>

Inheritance diagram for ArdourCanvas::InterpolatedCurve:
[legend]

Public Types

enum  SplineType { CatmullRomUniform , CatmullRomCentripetal }
 

Static Protected Member Functions

static void interpolate (const Points &coordinates, uint32_t points_per_segment, SplineType curve_type, bool closed, Points &results)
 

Static Private Member Functions

static double __interpolate (double p[4], double time[4], double t)
 
static void _interpolate (const Points &points, Points::size_type index, int points_per_segment, SplineType curve_type, Points &results)
 

Detailed Description

Definition at line 27 of file interpolated_curve.h.

Member Enumeration Documentation

◆ SplineType

Enumerator
CatmullRomUniform 
CatmullRomCentripetal 

Definition at line 30 of file interpolated_curve.h.

Member Function Documentation

◆ __interpolate()

static double ArdourCanvas::InterpolatedCurve::__interpolate ( double  p[4],
double  time[4],
double  t 
)
inlinestaticprivate

Calculate the same values but introduces the ability to "parameterize" the t values used in the calculation. This is based on Figure 3 from http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf

Parameters
pAn array of double values of length 4, where interpolation occurs from p1 to p2.
timeAn array of time measures of length 4, corresponding to each p value.
tthe actual interpolation ratio from 0 to 1 representing the position between p1 and p2 to interpolate the value.

Definition at line 155 of file interpolated_curve.h.

◆ _interpolate()

static void ArdourCanvas::InterpolatedCurve::_interpolate ( const Points points,
Points::size_type  index,
int  points_per_segment,
SplineType  curve_type,
Points results 
)
inlinestaticprivate

Given a list of control points, this will create a list of points_per_segment points spaced uniformly along the resulting Catmull-Rom curve.

Parameters
pointsThe list of control points, leading and ending with a coordinate that is only used for controlling the spline and is not visualized.
indexThe index of control point p0, where p0, p1, p2, and p3 are used in order to create a curve between p1 and p2.
points_per_segmentThe total number of uniformly spaced interpolated points to calculate for each segment. The larger this number, the smoother the resulting curve.
curve_typeClarifies whether the curve should use uniform, chordal or centripetal curve types. Uniform can produce loops, chordal can produce large distortions from the original lines, and centripetal is an optimal balance without spaces.
resultsList of calculated coordinates that define the CatmullRom curve between the points defined by index+1 and index+2.

Definition at line 185 of file interpolated_curve.h.

◆ interpolate()

static void ArdourCanvas::InterpolatedCurve::interpolate ( const Points coordinates,
uint32_t  points_per_segment,
SplineType  curve_type,
bool  closed,
Points results 
)
inlinestaticprotected

This method will calculate the Catmull-Rom interpolation curve, returning it as a list of Coord coordinate objects. This method in particular adds the first and last control points which are not visible, but required for calculating the spline.

Parameters
coordinatesThe list of original straight line points to calculate an interpolation from.
points_per_segmentThe integer number of equally spaced points to return along each curve. The actual distance between each point will depend on the spacing between the control points.
Returns
The list of interpolated coordinates.
Parameters
curve_typeChordal (stiff), Uniform(floppy), or Centripetal(medium)
closedSpecify if the shape is open or closed
resultsList of calculated coordinates
Exceptions
gov.ca.water.shapelite.analysis.CatmullRomExceptionif points_per_segment is less than 2.

Definition at line 56 of file interpolated_curve.h.


The documentation for this class was generated from the following file: