Curve2D Class Reference
Superclass for 2-dimensional space curves: f(t) = ( x(t), y(t) ). More...
#include <labelingmath.h>
Inheritance diagram for Curve2D:
Public Member Functions | |
| Curve2D () | |
| Default constructor. | |
| virtual | ~Curve2D () |
| Destructor. Frees all allocated resources. | |
| bool | setCtrlPoints (std::vector< tgt::vec2 > &ctrlPoints, float curveLength=0.f) |
| Sets the control points of the curve. | |
| std::vector< tgt::vec2 > | getCtrlPoints () |
| Returns the control point array. | |
| virtual tgt::vec2 | getCurvePoint (float t)=0 |
| Returns the curve point at parameter t. | |
| virtual tgt::vec2 | getTangent (float t)=0 |
| Returns the tangent vector at parameter t. | |
| virtual float | getTangentMagnitude (float t)=0 |
| Returns the magnitude of the tangent vector at parameter t. | |
| virtual float | getSegmentLength (float t1, float t2)=0 |
| Returns the length of the curve segment between parameters t1 and t2. | |
| virtual tgt::vec2 | getNextPoint (float &curParam, float offset)=0 |
Returns the curve point at parameter t that satisfies the following condition:
| |
| virtual void | shift (tgt::vec2 shiftVector)=0 |
| Shifts the whole curve by shiftVector. | |
Protected Member Functions | |
| virtual bool | calcFunction (float curveLength=0)=0 |
| Calculates the curve from the prior set control points. | |
Protected Attributes | |
| std::vector< tgt::vec2 > | ctrlPoints_ |
| The curve's control points. | |
| float | paramScale_ |
| Scale and shift parameters for mapping parameter range of curve segment to [0;1]. | |
| float | paramShift_ |
Detailed Description
Superclass for 2-dimensional space curves: f(t) = ( x(t), y(t) ).
The curve is determined by an array of control points.
Definition at line 137 of file labelingmath.h.
Member Function Documentation
| virtual bool calcFunction | ( | float | curveLength = 0 |
) | [protected, pure virtual] |
Calculates the curve from the prior set control points.
- Parameters:
-
curveLength specifies the length of the curve segment whose parameter range is mapped to [0;!]
| virtual tgt::vec2 getNextPoint | ( | float & | curParam, | |
| float | offset | |||
| ) | [pure virtual] |
Returns the curve point at parameter t that satisfies the following condition:
- getSegmentLength(curParam, t) == offset.
- Note:
- This is just an approximation.
- Parameters:
-
c curParam is set to t afterwards.
Implemented in Curve2DPolynomial.
| bool setCtrlPoints | ( | std::vector< tgt::vec2 > & | ctrlPoints, | |
| float | curveLength = 0.f | |||
| ) |
Sets the control points of the curve.
Internally the curve's parameters are calculated from these control points.
- Parameters:
-
curveLength the length of the curve segment, whose parameter range range is mapped to [0;1]. The segment is centered around the control points. If no length is supplied, the segment runs from the first to the last control point (these points are only approximated, since this is a least-squares-fit)
- Returns:
- true, if parameter calculation was successful