Tulip  5.1.0
Large graphs analysis and drawing
tlp::GlCatmullRomCurve Class Reference

#include <GlCatmullRomCurve.h>

Inherits AbstractGlCurve.

Public Member Functions

 GlCatmullRomCurve (const std::vector< Coord > &controlPoints, const Color &startColor, const Color &endColor, const float startSize, const float endSize, const bool closedCurve=false, const unsigned int nbCurvePoints=200, const ParameterizationType paramType=CENTRIPETAL)
 
void drawCurve (std::vector< Coord > &controlPoints, const Color &startColor, const Color &endColor, const float startSize, const float endSize, const unsigned int nbCurvePoints=200)
 
void setClosedCurve (const bool closedCurve)
 
void setParameterizationType (const ParameterizationType paramType)
 

Protected Member Functions

Coord computeCurvePointOnCPU (const std::vector< Coord > &controlPoints, float t)
 
void computeCurvePointsOnCPU (const std::vector< Coord > &controlPoints, std::vector< Coord > &curvePoints, unsigned int nbCurvePoints)
 
void setCurveVertexShaderRenderingSpecificParameters ()
 

Detailed Description

A class to draw a Catmull-Rom curve.

This class allow to draw a Catmull-Rom curve, a smooth curve which passes through all its control points. Catmull-Rom splines are a family of cubic interpolating splines formulated such that the tangent at each control point is calculated using the previous and next control point point of the spline. Catmull-Rom splines have C^1 continuity, local control, and interpolation, but do not lie within the convex hull of their control points.

Definition at line 42 of file GlCatmullRomCurve.h.

Constructor & Destructor Documentation

tlp::GlCatmullRomCurve::GlCatmullRomCurve ( const std::vector< Coord > &  controlPoints,
const Color &  startColor,
const Color &  endColor,
const float  startSize,
const float  endSize,
const bool  closedCurve = false,
const unsigned int  nbCurvePoints = 200,
const ParameterizationType  paramType = CENTRIPETAL 
)

GlCatmullRomCurve constructor.

Parameters
controlPointsa vector of control points (size must be greater or equal to 4)
startColorthe color at the start of the curve
endColorthe color at the end of the curve
startSizethe width at the start of the curve
endSizethe width at the end of the curve
closedCurveif true, the curve will be closed and a bezier segment will be drawn between the last and first control point
paramTypecurve parameterization type (GlCatmullRomCurve::UNIFORM | GlCatmullRomCurve::CENTRIPETAL | GlCatmullRomCurve::CHORD_LENGTH (default))
nbCurvePointsthe number of curve points to generate