#include <include/Biarc.h>
Public Member Functions | |
Biarc () | |
Biarc (const Vector &p, const Vector &t) | |
Biarc (const Biarc< Vector > &b) | |
~Biarc () | |
const Vector & | getPoint () const |
const Vector & | getTangent () const |
const Vector & | getMidPoint () const |
const Vector & | getMidTangent () const |
void | setPoint (const Vector &p) |
void | setMidPoint (const Vector &p) |
void | setMidTangent (const Vector &p) |
void | setTangentUnnormalized (const Vector &t) |
void | setTangent (const Vector &t) |
void | get (Vector &p, Vector &t) const |
void | set (const Vector &p, const Vector &t) |
void | clear () |
void | reverse () |
int | isProper () const |
int | isBiarc () const |
void | setBiarc () |
void | make (float Gamma) |
float | arclength0 () const |
float | arclength1 () const |
float | biarclength () const |
float | radius0 () const |
float | radius1 () const |
int | id () const |
void | setId (const int i) |
void | setCurve (Curve< Vector > *c) |
const Curve< Vector > * | getCurve () |
void | setIdAndCurve (const int i, Curve< Vector > *c) |
Vector | pointOnArc0 (float s) const |
Vector | pointOnArc1 (float s) const |
Vector | pointOnBiarc (float arclength) const |
Vector | tangentOnBiarc (float arclength) const |
void | getBezierArc0 (Vector &b0, Vector &b1, Vector &b2) const |
void | getBezierArc1 (Vector &b0, Vector &b1, Vector &b2) const |
void | getBezier (Vector &b0_0, Vector &b1_0, Vector &b2_0, Vector &b0_1, Vector &b1_1, Vector &b2_1) const |
Vector | a0 (float tau) const |
Vector | a1 (float tau) const |
const Biarc< Vector > & | getNext () const |
const Biarc< Vector > & | getPrevious () const |
void | setNext (const Biarc< Vector > &b) |
void | setPrevious (const Biarc< Vector > &b) |
void | setNextNULL () |
void | setPreviousNULL () |
Biarc< Vector > | operator* (const float s) const |
Biarc< Vector > | operator+ (const Vector &v) const |
Biarc< Vector > | operator- (const Vector &v) const |
Biarc< Vector > & | operator= (const Biarc< Vector > &b) |
Biarc< Vector > & | operator+= (const Vector &v) |
Biarc< Vector > & | operator-= (const Vector &v) |
Biarc< Vector > & | operator/= (const float d) |
Biarc< Vector > & | operator*= (const float d) |
void | print (ostream &out) const |
int | operator== (const Biarc< Vector > &b) const |
int | operator!= (const Biarc< Vector > &b) const |
This class is used to store a single data point of an entire space curve in . A biarc object contains a point and the tangent at this particular point. Aligning one biarc after another makes up a biarc approximated space-curve.
The space-curve is a linked-list of Biarc elements. Every biarc element in the "curve list" has two neighbours on its left and right side, reachable by getNext() and getPrevious(). If the point is the start or endpoint of an open curve, then it will only have a single neighbour. The other pointer will be set to NULL.
Default constructor. Initializes this instance of a Biarc to <0,0,0> for the point and <0,1,0> for the tangent.
Referenced by Biarc< Vector >::operator*(), Biarc< Vector >::operator+(), and Biarc< Vector >::operator-().
Constructor sets the point to p and the tangent to t. Normalizes the tangent.
Copy Constructor. Copies only the point and the tangent. Doesn't care if we have an interpolated biarc or not.
const Vector & Biarc< Vector >::getPoint | ( | ) | const [inline] |
Returns the point of the biarc as a Vector.
Referenced by Biarc< Vector >::a1(), Biarc< Vector >::isProper(), Biarc< Vector >::pointOnBiarc(), Curve< Vector >::radius_pt(), and Biarc< Vector >::tangentOnBiarc().
const Vector & Biarc< Vector >::getTangent | ( | ) | const [inline] |
Returns the tangent of the biarc as a Vector.
Referenced by Biarc< Vector >::isProper(), Curve< Vector >::radius_pt(), and Biarc< Vector >::tangentOnBiarc().
const Vector & Biarc< Vector >::getMidPoint | ( | ) | const [inline] |
Returns the matching point of this biarc, if we have interpolated biarcs. Posts a warning message and returns a zero vector if not.
Referenced by Biarc< Vector >::tangentOnBiarc().
const Vector & Biarc< Vector >::getMidTangent | ( | ) | const [inline] |
Returns the matching tangent of this biarc, if we have interpolated biarcs. Posts a warning message and returns a zero vector if this is not a valid biarc.
Referenced by Biarc< Vector >::tangentOnBiarc().
void Biarc< Vector >::setPoint | ( | const Vector & | p | ) | [inline] |
Set point to p.
void Biarc< Vector >::setMidPoint | ( | const Vector & | p | ) | [inline] |
Set midpoint to p.
void Biarc< Vector >::setMidTangent | ( | const Vector & | p | ) | [inline] |
Set midtangent to p.
References Biarc< Vector >::getNext().
void Biarc< Vector >::setTangentUnnormalized | ( | const Vector & | t | ) | [inline] |
Set tangent of the biarc. No normalization of the tangent is done.
void Biarc< Vector >::setTangent | ( | const Vector & | t | ) | [inline] |
Set tangent of the biarc to t. Tangent automatically normalized.
void Biarc< Vector >::get | ( | Vector & | p, | |
Vector & | t | |||
) | const [inline] |
Recover point/tangent data from this biarc and put it into p and t.
void Biarc< Vector >::set | ( | const Vector & | p, | |
const Vector & | t | |||
) | [inline] |
Set point/tangent data for this biarc to p and t.
void Biarc< Vector >::clear | ( | ) | [inline] |
Sets the biarc data to : point <0,0,0> and tangent <0,1,0>.
void Biarc< Vector >::reverse | ( | ) | [inline] |
Sets the biarc point P to -P.
int Biarc< Vector >::isProper | ( | ) | const [inline] |
Checks if the Biarc is proper. Returns 1 if this is true. Posts a warning message and returns 0 if the biarc is not proper.
A biarc is proper, if the point-tangent data pair satifies
and
This implies that for a Biarc b with point p and tangent t and its following biarc (obtained with Biarc::getNext()), with point p' and tangent t', the previous condition must hold.
References Biarc< Vector >::getNext(), Biarc< Vector >::getPoint(), and Biarc< Vector >::getTangent().
Referenced by Biarc< Vector >::make().
int Biarc< Vector >::isBiarc | ( | ) | const [inline] |
Returns true (=1) if the current biarc is interpolated, and 0 if not. Here interpolated means, that a valid matching point has been computed using this biarc and its following neighbour.
Referenced by Biarc< Vector >::getBezierArc0(), and Biarc< Vector >::getBezierArc1().
void Biarc< Vector >::setBiarc | ( | ) | [inline] |
Sets the "interpolated" flag to be true.
void Biarc< Vector >::make | ( | float | Gamma | ) | [inline] |
This function computes the matching point of this biarc. It uses the point/tangent data of current biarc as starting point and the point/tangent data of the next biarc as the end point.
Giving a value for Gamma, it is possible to compute a point (matching point), that links the two data points by two circular arcs of circles. For each arc the control points of a Bezier curve are computed and can be recovered by getBezier().
The appropriate rule that computes the matching point is still an open question (since the matching point of a biarc is not unique but located on a particular arc of circle defined by the data points and tangents).
For now, this function takes as input Gamma, where Gamma is a parameter related to the ratio of the Bezier triangles over the two arcs of circles.
More details can be found in Jana Smutny's PhD Thesis at
http://lcvmwww.epfl.ch/~lcvm/articles/thesis.html
References Biarc< Vector >::getNext(), and Biarc< Vector >::isProper().
float Biarc< Vector >::arclength0 | ( | ) | const [inline] |
Returns the arclength of the first arc of circle.
Referenced by Biarc< Vector >::tangentOnBiarc().
float Biarc< Vector >::arclength1 | ( | ) | const [inline] |
Returns the arclength of the second arc of circle.
Referenced by Biarc< Vector >::tangentOnBiarc().
float Biarc< Vector >::biarclength | ( | ) | const [inline] |
Returns the arclength of the current biarc. This is the sum of the arcs one and two.
float Biarc< Vector >::radius0 | ( | ) | const [inline] |
Compute and return the radius of the first arc.
float Biarc< Vector >::radius1 | ( | ) | const [inline] |
Compute and return the radius of the second arc.
int Biarc< Vector >::id | ( | ) | const [inline] |
Returns the position if this Biarcs is in a Curve object. -1 otherwise.
void Biarc< Vector >::setId | ( | const int | i | ) | [inline] |
Private routine. Sets _BiarcInCurve value.
Private routine. Sets _Curve value.
Private routine. Get curve pointer.
void Biarc< Vector >::setIdAndCurve | ( | const int | i, | |
Curve< Vector > * | c | |||
) | [inline] |
Private routine. Sets _BiarcInCurve and _Curve values.
Vector Biarc< Vector >::pointOnArc0 | ( | float | s | ) | const [inline] |
Returns point on arc one of the biarc, here s is arc-length parametrization.
We have , where
is the arc-length of the current biarc's first arc.
No check is done if we have a valid biarc interpolation!
References Biarc< Vector >::a0(), Vector3::dot(), Vector3::norm(), and Vector3::normalize().
Referenced by Biarc< Vector >::pointOnBiarc().
Vector Biarc< Vector >::pointOnArc1 | ( | float | s | ) | const [inline] |
Returns point on arc one of the biarc, here s is arc-length parametrization.
We have , where
is the arc-length of the current biarc's second arc.
No check is done if we have a valid biarc interpolation!
References Biarc< Vector >::a1(), Vector3::dot(), Biarc< Vector >::getNext(), Vector3::norm(), and Vector3::normalize().
Referenced by Biarc< Vector >::pointOnBiarc().
Vector Biarc< Vector >::pointOnBiarc | ( | float | arclength | ) | const [inline] |
Returns the point on the biarc. Here s is arc-length parametrization.
We have , where
is the total arc-length of the current biarc.
References Biarc< Vector >::getNext(), Biarc< Vector >::getPoint(), Biarc< Vector >::pointOnArc0(), and Biarc< Vector >::pointOnArc1().
Referenced by Biarc< Vector >::tangentOnBiarc().
Vector Biarc< Vector >::tangentOnBiarc | ( | float | arclength | ) | const [inline] |
Returns tangent vector at a(s) on the biarc
References Biarc< Vector >::arclength0(), Biarc< Vector >::arclength1(), Biarc< Vector >::getMidPoint(), Biarc< Vector >::getMidTangent(), Biarc< Vector >::getNext(), Biarc< Vector >::getPoint(), Biarc< Vector >::getTangent(), and Biarc< Vector >::pointOnBiarc().
void Biarc< Vector >::getBezierArc0 | ( | Vector & | b0, | |
Vector & | b1, | |||
Vector & | b2 | |||
) | const [inline] |
This function is used to extract the Bezier curve control points of the first arc of circle of the biarc and put them into b0,b1,b2.
References Biarc< Vector >::isBiarc().
Referenced by Biarc< Vector >::getBezier().
void Biarc< Vector >::getBezierArc1 | ( | Vector & | b0, | |
Vector & | b1, | |||
Vector & | b2 | |||
) | const [inline] |
This function is used to extract the Bezier curve control points of the second arc of circle of the biarc and put them into b0,b1,b2.
References Biarc< Vector >::getNext(), and Biarc< Vector >::isBiarc().
Referenced by Biarc< Vector >::getBezier().
void Biarc< Vector >::getBezier | ( | Vector & | b0_0, | |
Vector & | b1_0, | |||
Vector & | b2_0, | |||
Vector & | b0_1, | |||
Vector & | b1_1, | |||
Vector & | b2_1 | |||
) | const [inline] |
This method is used to get the Bezier representation of the biarc. The corners of an isosceles triangle over a circular arc are known as the Bezier points.
From a biarc interpolated curve it is easy to compute the Bezier curve control points for each particular arc.
The Bezier points of arc one comes into the Vector objects b0_0,b1_0,b2_0 and arc two comes in b0_1,b1_1,b2_1.
References Biarc< Vector >::getBezierArc0(), and Biarc< Vector >::getBezierArc1().
Vector Biarc< Vector >::a0 | ( | float | tau | ) | const [inline] |
Given a value tau between 0 and 1, this function returns the point on the first arc of circle of the biarc. Where
is a non-arclength parametrization of an arc of circle.
For arc-length parametrized arcs use one of the pointOn* functions.
Referenced by Biarc< Vector >::pointOnArc0().
Vector Biarc< Vector >::a1 | ( | float | tau | ) | const [inline] |
Given a value tau between 0 and 1, this function returns the point on the second arc of circle of the biarc. Where
is a non-arclength parametrization of an arc of circle.
For arc-length parametrized arcs use one of the pointOn* functions.
References Biarc< Vector >::getNext(), and Biarc< Vector >::getPoint().
Referenced by Biarc< Vector >::pointOnArc1().
Returns a pointer to the next biarc. We get NULL if the current biarc is the last point on the curve (i.e. the end of the linked-list).
Referenced by Biarc< Vector >::a1(), Biarc< Vector >::getBezierArc1(), Biarc< Vector >::isProper(), Biarc< Vector >::make(), Biarc< Vector >::pointOnArc1(), Biarc< Vector >::pointOnBiarc(), Biarc< Vector >::setMidTangent(), and Biarc< Vector >::tangentOnBiarc().
Returns a pointer to the previous biarc. We get NULL if the current biarc is the first point of the curve (i.e. the first element of the linked-list).
Sets the next neighbour of this biarc to b.
Sets the previous neighbour of this biarc to b.
void Biarc< Vector >::setNextNULL | ( | ) | [inline] |
Deletes the link to the next neighbour by setting the pointer to NULL.
void Biarc< Vector >::setPreviousNULL | ( | ) | [inline] |
Deletes the link to the previous neighbour by setting the pointer to NULL.
Returns a biarc whose point value is multiplied by s.
References Biarc< Vector >::Biarc().
Biarc< Vector > Biarc< Vector >::operator+ | ( | const Vector & | v | ) | const [inline] |
Returns a by v translated biarc. Tangent remains unchanged.
References Biarc< Vector >::Biarc().
Biarc< Vector > Biarc< Vector >::operator- | ( | const Vector & | v | ) | const [inline] |
Returns a by -v translated biarc. Tangent remains unchanged.
References Biarc< Vector >::Biarc().
Biarc< Vector > & Biarc< Vector >::operator= | ( | const Biarc< Vector > & | b | ) | [inline] |
Assign operator. Copies the values of the point and the tangent and sets the biarc flag _BIARC_ to zero.
References Biarc< Vector >::_BIARC_, Biarc< Vector >::_Curve, Biarc< Vector >::_Point, and Biarc< Vector >::_Tangent.
Adds v to the point value of this biarc and returns an instance to itself.
Subtracts v from the point value of this biarc and returns an instance to itself.
Divides the point value of this biarc by d and returns an instance to itself.
Multiplies the point value of this biarc by d and returns an instance to itself.
void Biarc< Vector >::print | ( | ostream & | out | ) | const [inline] |
Prints starting point, tangent, matching point and matching tangent onto the stream out. If the biarc is not valid, it only prints the point/tangent data of this biarc and if this biarc data point is the last of the curve, then the tag --NULL-- is printed at the end.
Compares this instance to a biarc b. Returns 1 if both biarcs agree in point and tangent, 0 otherwise.
References Biarc< Vector >::_Point, and Biarc< Vector >::_Tangent.
Compares this instance to a biarc b. Returns 1 if the biarcs disagree in point or tangent or both, 0 otherwise.