#include </usr1/tp517/Tumble/trunk/src/tumble/spline.h>
Collaboration diagram for QBSpline:
Public Member Functions | |
| QBSpline (const std::vector< ControlPoint > &newd, DataStore *_data_store, bool _closed) | |
| QBSpline (const std::vector< ControlPoint > &newd, const std::vector< double > &newk, DataStore *_data_store, bool _closed) | |
| QBSpline (const std::vector< ControlPoint > &newd, const std::vector< double > &newk, DataStore *_data_store, double _restlength, bool _closed) | |
| ~QBSpline () | |
| Destructor. | |
Maintain list of internal vertexs | |
These help to maintain a list of internal vertexs held in the vector vertexs. We need this mapping from internal knots to vertexs for coarsening. Douglas-Peucker will give us a list of knots to keep. But the coarsener need to be able to translate knot values along a spline into BezierVertexs to keep. There is no where else in the program that this mapping is maintained, so it must be done here. | |
| void | set_bezier_vertex (double u, BezierVertex *v) |
| Set the internal vertex at parameter value u. | |
| void | set_bezier_vertex (int idx, BezierVertex *v) |
| Set the internal vertex at index. | |
Operators | |
These are publically availible operators that can be used to modify a spline. | |
| void | move (Point2D *dp, Point2D *dq, unsigned xCoord, unsigned yCoord) |
| Given a set of velocity vectors move the inernal points of the spline. | |
| void | add_knot (double u, ControlPoint &cp0, ControlPoint &cp1, ControlPoint &cp2) |
| Add a knot to the spline. | |
| void | split (int i, double u, ControlPoint &cp0, ControlPoint &cp1, ControlPoint &cp2) |
| Split a sub-spline. The sub-segment at index i is split, adding a new knot. u here refers to the parameter space of the sub-segment -- it ranges from 0 to 1. We return the three control points thus created. | |
| bool | remove_knot (double u, ControlPoint &cp, double &u0, double &u1) |
| Remove a knot from the spline. | |
Evaluation and Querring Functions | |
| int | get_num_segments () const |
| Get the number of segments |segments| = |deboor| - 2. | |
| int | get_num_deboor () const |
| Get the number of deboor points |deboor| = (|b|+3)/2. | |
| ControlPoint | get_deboor (int i) const |
| Get the ith Deboor point. | |
| void | getip (double i, int *j, double *p) const |
| Given a parameter along the spline find the segment and parameter along the segment containing the point. | |
| Point2D | evaluate (double u) const |
| Evaluates the spline, in the splines parametrization. | |
| Point2D | evaluate_segment (int, double) const |
| Evaluates a segment at a given parameter value. | |
| void | bbox (double *, double *, double *, double *) const |
| Find a bounding box for the spline. | |
| void | print () const |
| Print the spline. | |
| void | douglas_peucker (double tol, hashers::hash_set< BezierVertex * > &keep) const |
| Run the Douglas-Peucker line simplification algorithm. | |
Helper Functions for Construction of meshes | |
These are for the most part messy and poorly written (sorry). They serve almost exclusivly to do the sort of strange reverse lookup types of operations needed by MeshConstrucor::mesh() and MeshInput::read(). Unfortunatly we are bound by the limitations of the external applications in each case, necessitating nasty reverse lookup type hacks. For instance many of the functions in this group use get_closest_knot(), which is necessary because we have some parameter from a text file that has been rounded, and we need to find the knot that would be the closest to that parameter. This is obviously not numerically stable. My recommendation is to never use any of these functions, and to work on replacing code that does depend on them.
| |
| BezierVertex * | get_bezier_vertex (unsigned idx) const |
| Given an index of a D1 Vertex, get the BezierVertex. | |
| unsigned | get_bezier_vertex_idx (const BezierVertex *v) const |
| Given a D1 BezierVertex, find how far along it is on the spline. | |
| ControlPoint | get_control_point_at_idx (unsigned idx) const |
| Given an index of a D0 or D1 Vertex, get the control point back. | |
| ControlPoint | get_edge_center_cp (unsigned u0_idx, unsigned u1_idx) const |
| Given a segment, find the center point of thier segment. | |
| double | get_u_at_idx (unsigned idx) const |
| Given the index of a vertex along the spline, get the knot value. | |
| int | get_closest_knot (double u) const |
| Find the numerically closest knot to the given parameter. | |
| int | get_closest_bezier (double u) const |
| Get the closest segment endpoint to a given knot value This will find the numerically closest knot to the parameter, and return the index in b of the bezier point at that knot. | |
| int | get_edge_cps (double u0, double u1, ControlPoint &cp0, ControlPoint &cp1, ControlPoint &cp2, int &cp0_is_vert, int &cp2_is_vert) const |
| Given u-values, find the control points of the appropriate segment. | |
| ControlPoint | get_segment_center (double u0, double u1) const |
| Given two parameters return the center ControlPoint of thier segment. | |
Public Attributes | |
| std::vector< ControlPoint > | b |
| The Bezier points of the spline. | |
| std::vector< double > | k |
| The knot vector. | |
| std::vector< BezierVertex * > | vertexs |
| The internal BezierVertexs of the spline (D1 vertexs). | |
| bool | closed |
| Determins if the spline is closed. | |
| double | restlength |
| The restlength of the spline. | |
| DataStore * | data_store |
| A pointer to the DataStore used to add/rem ControlPoints. | |
Private Member Functions | |
| void | initialize (const std::vector< ControlPoint > &newd, const std::vector< double > &newk, DataStore *_data_store, double _restlength, bool _closed) |
| QBSpline (const QBSpline &o) | |
| Copy constructor. | |
| QBSpline & | operator= (const QBSpline &o) |
| Assignment operator. | |
Movement helper functions | |
| double | dt (int i) const |
| Compute the parameter range for a segment. | |
| double | ratio (int a, int b) const |
| Compute a ratio. | |
| Point2D * | compute_new_points (Point2D *dp, Point2D *dq) const |
| Formulates a linear system whose solution is new spline. | |
| double ** | solve_system (Matrix &A, double **bs, int cols, int num_vectors) const |
| Given the linear system of the spline motion, solve it. | |
| double ** | solve_small_system (Matrix &A, double **bs, int num_vectors) const |
| A replacement for solve_system() for small systems. | |
Other helper functions | |
| void | evaluate_full (double, Point2D *, Point2D *, Point2D *, int *) const |
| Runs the DeCasteljau Algorithm. | |
| void | simplify (double tol, bool *mark, int j, int z) const |
| A helper function for the Douglas-Peucker algorithm. | |
B-Splines parameterized curves. They are piecewise Bezier curves, with an additional restriction that they maintain a continuous and differentiable mapping from parameter space into geometric space. The are normally charactorized by a set of control points called the deboor points, and a knot sequence.
For our purpouses we will be using Quadratic B-Splines for our boundaries as they are piecewise Quadratic Bezier and they maintain differentiability.
Every BoundaryEdge in the mesh has a QBSpline which represents the geometric embedding of that edge. There will also be several BezierEdges in the BezierMesh which make up the segments of the spline. These BezierEdges will have a pointer to the BoundaryEdge that they represent, and knot values indicating the parametic values of the BezierEdges' endpoints along the given spline.
Additionally, for each knot in the spline there will be a BezierVertex coorsponding to it and sharing a ControlPoint with the spline. These are the D1 vertexs. They will have a pointer to the BoundaryEdge, and a parameter value along the spline.
D0 and D1 Vertexs
An important concept relating to QBSplines are the BezierVertexs in the BezierMesh that coorespond to the even numbered bezier points along the spline. Recall that the BezierVertexs at the end of the spline are D0 vertexs as they coorespond to BoundaryVertexs in the BoundaryMesh. Also recall, that the BezierVertexs that are internal to the spline are the D1 vertexs.
All of the D1 verticies will be stored by the spline in the vector vertexs. The D1 vertexs are needed by the douglas_peucker() algorithm so that it can translate knot values that it wants to keep into BezierVertexs that it likes to keep.
The D0 vertexs are not stored directly by the QBSpline. They can be found by looking at the BoundaryEdge that contains the QBSpline. This BoundaryEdge has pointers to the BoundaryVertexs, which know of thier D0 points.
Bezier points, Deboor points, and Knots
When storing the spline, we are interested in all of the points that make up the control points of the underlying BezierEdges. We call these the bezier points. They are stored in a vector b as a ControlPoints (pointers to Point2Ds). These will be the same ControlPoints as the underlying BezierEdges and BezierVertexs will use. We will also maintain the knot vector k. The knots will represent the parameter values of the underling BezierVertexs.
When creating splines or adding and removing knots, care must be taken to assure that the QBSplines of the BoundaryEdges share the correct ControlPoints with the BezierVertexs and BezierEdges.
Diagrams and Examples
This is a diagram to clarify how the various spline properties are enumerated:
In this example we have a spline with: segments: 4 |b|: 9 |deboor|: 6 |k|: 5 |vertexs|: 3 #Edges: 4 spline o-----x-----o-----x-----o-----x-----o-----x-----o bezier points 0 1 2 3 4 5 6 7 8 deboor points 0 1 2 3 4 5 knots 0 1 2 3 4 internal verts 0 1 2 BeizerEdges <----0----> <----1----> <----2----> <----3---->
In a QBSpline the following invariants hold:
|b| >= 3
if closed then; |b| >= 5
if closed then; b.first = b.last
|deboor| = (|b|+3) / 2
|k| = |deboor| - 1
|segments| = |deboor| - 2
|vertexs| = |deboor| - 3
for 0 <= i < (|k| - 1)
k[i+1] > k[i]
Definition at line 103 of file spline.h.
| QBSpline::QBSpline | ( | const std::vector< ControlPoint > & | newd, | |
| DataStore * | _data_store, | |||
| bool | _closed | |||
| ) |
| QBSpline::QBSpline | ( | const std::vector< ControlPoint > & | newd, | |
| const std::vector< double > & | newk, | |||
| DataStore * | _data_store, | |||
| bool | _closed | |||
| ) |
| QBSpline::QBSpline | ( | const std::vector< ControlPoint > & | newd, | |
| const std::vector< double > & | newk, | |||
| DataStore * | _data_store, | |||
| double | _restlength, | |||
| bool | _closed | |||
| ) |
| QBSpline::QBSpline | ( | const QBSpline & | o | ) | [private] |
| void QBSpline::initialize | ( | const std::vector< ControlPoint > & | newd, | |
| const std::vector< double > & | newk, | |||
| DataStore * | _data_store, | |||
| double | _restlength, | |||
| bool | _closed | |||
| ) | [private] |
| double QBSpline::dt | ( | int | i | ) | const [private] |
Compute the parameter range for a segment.
Given a segment number (starting at 0), find how much the parameterization changes over the segment.
| i | The index of the segment. |
Definition at line 1172 of file spline.C.
References k.
Referenced by getip(), move(), and remove_knot().
| double QBSpline::ratio | ( | int | a, | |
| int | b | |||
| ) | const [private] |
Compute a ratio.
Definition at line 1178 of file spline.C.
References k.
Referenced by compute_new_points().
Formulates a linear system whose solution is new spline.
This functions formulates a linear system whose solution gives back the deboor points of a new spline that via a least squares approximation, fits as close to the apparent motion of the old spline as possible.
| dp | The velocity of the Deboor points | |
| dq | The velocity of the non-deboor points |
Definition at line 689 of file spline.C.
References b, big, closed, constraint_ratio, k, Matrix::m, ratio(), solve_small_system(), and solve_system().
Referenced by move().
Here is the call graph for this function:
| double ** QBSpline::solve_system | ( | Matrix & | A, | |
| double ** | bs, | |||
| int | cols, | |||
| int | num_vectors | |||
| ) | const [private] |
Given the linear system of the spline motion, solve it.
This function is given the linear system from compute_new_points(). It is known that the constriant matrix has a bandwidth of 5, with a cyclic condtion. It is possible to solve this system in time linear in the size of the spline.
This function takes constraint matrix A and array of vectors to solve, bs. A and bs are not modified. The function then computes
and stores it as a Matrix5 (5 banded matrix). Then Crout LU decomposition and a LUsolver [both are in Matrix5] are used to solve for each vector. Since
is actually a cyclic banded matrix the Sherman-Morrison Formula is used to correct for the errors caused by the non-zero off-diagonal elements. Finally the function will return an array of solution vectors.
| A | The constraint matrix | |
| bs | The right hand side | |
| cols | The number of columns in A | |
| num_vectors | The diemention of elements on the RHS |
Definition at line 855 of file spline.C.
References closed, Matrix5::d3, Matrix5::LUsolve(), Matrix::m, Matrix::transpose_times_self(), and Matrix::transpose_times_vector().
Referenced by compute_new_points().
Here is the call graph for this function:
| double ** QBSpline::solve_small_system | ( | Matrix & | A, | |
| double ** | bs, | |||
| int | num_vectors | |||
| ) | const [private] |
A replacement for solve_system() for small systems.
If the spline is very has less than 3 segments, then it is too small for the algorithm in QBSpline::solve_system(). This solves the system directly by finding 
| A | The constraint matrix | |
| bs | The right hand side | |
| num_vectors | The diemention of elements on the RHS |
Definition at line 917 of file spline.C.
References Matrix::inverse(), Matrix::times_vector(), Matrix::transpose_times_self(), and Matrix::transpose_times_vector().
Referenced by compute_new_points().
Here is the call graph for this function:
| void QBSpline::evaluate_full | ( | double | u, | |
| Point2D * | t, | |||
| Point2D * | b1, | |||
| Point2D * | b2, | |||
| int * | i | |||
| ) | const [private] |
Runs the DeCasteljau Algorithm.
This simply runs the DeCasteljau Algorithm given the input parameter u. It also returns the intermediate values and the segment index, which are used when doing a knot insertion.
| u | The parameter in the splines parameter domain | |
| [out] | t | The geometric value at the parameter |
| [out] | b1 | The first intermediate value of the DeCasteljau Algorithm |
| [out] | b2 | The second intermediate value of the DeCasteljau Algorithm |
| [out] | i | The index of the segment in which the parameter value was found |
Definition at line 421 of file spline.C.
Referenced by add_knot().
Here is the call graph for this function:
| void QBSpline::simplify | ( | double | tol, | |
| bool * | mark, | |||
| int | j, | |||
| int | z | |||
| ) | const [private] |
A helper function for the Douglas-Peucker algorithm.
This is a recursive function which impiments the Douglas-Peucker line simplification algorithm. It will decide which nodes should be kept in order to preserve the shape of the spline to within the olerence provided by tol.
It passes arround an array mark which has a boolean for each node. True means that the node should be removed, false means that the node should be kept.
| tol | The tolerence for the algorithm | |
| [out] | mark | An array of makers for the nodes (true=throw away, false=keep) |
| j | The index of the begining of the check | |
| z | The index of the end of the check |
Definition at line 999 of file spline.C.
References b.
Referenced by douglas_peucker().
| void QBSpline::set_bezier_vertex | ( | double | u, | |
| BezierVertex * | v | |||
| ) |
Set the internal vertex at parameter value u.
This function is for updating the vertexs vector or internal verticies, maintained by the spline. Given a prarmeter it sets this to be the internal vertex closest to that parameter value.
| u | The parameter along the spline | |
| v | The vertex to add |
Definition at line 1069 of file spline.C.
References get_closest_knot(), and vertexs.
Referenced by ConformalMesher::create_subsplines(), and BezierVertex::set_bdry().
Here is the call graph for this function:
| void QBSpline::set_bezier_vertex | ( | int | idx, | |
| BezierVertex * | v | |||
| ) |
Set the internal vertex at index.
This function is for updating the vertexs vector or internal verticies, maintained by the spline. Given the value idx which should be the index of the vertex along the spline counting the first endpoint. Thus,
.
| idx | The index along the spline | |
| v | The vertex to add |
Given a set of velocity vectors move the inernal points of the spline.
| dp | The velocity vectors moving the deboor points | |
| dq | The velocity vectors moving the non-deboor points. | |
| xCoord | : Data index for new x position | |
| yCoord | : Data index for new y position |
Definition at line 587 of file spline.C.
References b, compute_new_points(), data_store, dt(), get_deboor(), get_num_deboor(), k, Point2D::x(), and Point2D::y().
Referenced by Simulation::move_().
Here is the call graph for this function:
| void QBSpline::add_knot | ( | double | u, | |
| ControlPoint & | cp0, | |||
| ControlPoint & | cp1, | |||
| ControlPoint & | cp2 | |||
| ) |
Add a knot to the spline.
Given a parameter along the spline, add a new knot at that point.
Adding a knot requires splitting one segment into two, and thus adding two new bezier points. This function uses the DataStore to allocate two new points. It returns the three points which have moved.
If the knot was inserted splitting segment i, the points returned will be the following:
cp0: the deboor point (centerpoint) of new segment i cp1: the bezier point between new segemnts i and i+1 cp2: the deboor point (centerpoint) of new segment i+1
| u | The parameter at which to add the knot | |
| [out] | cp0 | The first affected point |
| [out] | cp1 | The first affected point |
| [out] | cp2 | The first affected point |
Definition at line 467 of file spline.C.
References PersistantList< Value >::iterator::access(), DataStore::add_cp(), b, data_store, evaluate_full(), FATAL_ERROR, k, and vertexs.
Referenced by BezierMesh::insert_edge_midpoint(), and split().
Here is the call graph for this function:
| void QBSpline::split | ( | int | i, | |
| double | u, | |||
| ControlPoint & | cp0, | |||
| ControlPoint & | cp1, | |||
| ControlPoint & | cp2 | |||
| ) |
Split a sub-spline. The sub-segment at index i is split, adding a new knot. u here refers to the parameter space of the sub-segment -- it ranges from 0 to 1. We return the three control points thus created.
Definition at line 437 of file spline.C.
References add_knot(), and k.
Here is the call graph for this function:
| bool QBSpline::remove_knot | ( | double | u, | |
| ControlPoint & | cp, | |||
| double & | u0, | |||
| double & | u1 | |||
| ) |
Remove a knot from the spline.
You cannot attempt to remove endpoints.
This function must be called AFTER the Bezier Edges and vertexs associated with the knot to be removed have been destroyed. This is because the data points are owned by the bezier Edges and vertexs and so must be deleted before the control points are deleted by this function.
| u | Any parameter of the spline that is within the segment to be removed | |
| cp | The new center ControlPoint of the newly formed segment | |
| u0 | The parameter value of the first endpoint of the new segment | |
| u1 | The parameter value of the second endpoint of the new segment |
Definition at line 521 of file spline.C.
References b, data_store, dt(), getip(), k, DataStore::rem_cp(), and vertexs.
Referenced by BezierMesh::remove_vertex().
Here is the call graph for this function:
| int QBSpline::get_num_segments | ( | ) | const |
Get the number of segments |segments| = |deboor| - 2.
Definition at line 1056 of file spline.C.
References k.
Referenced by ConformalMesher::create_subsplines(), and ConformalMesher::reticulate_splines().
| int QBSpline::get_num_deboor | ( | ) | const |
Get the number of deboor points |deboor| = (|b|+3)/2.
Definition at line 1047 of file spline.C.
References b.
Referenced by Visualization::draw_boundary_edge_debug(), move(), BezierMesh::remove_vertex(), and MeshBinaryOutput::write().
| ControlPoint QBSpline::get_deboor | ( | int | i | ) | const |
Get the ith Deboor point.
This function will return the deboor point i. There are (|b|+3) / 2 deboor points. If you enter a negative number it will return the first deboor point, and with a number greater than |deboor|-1 it will return the last deboor point.
| i | Index |
Definition at line 211 of file spline.C.
References b.
Referenced by Visualization::draw_boundary_edge_debug(), move(), ConformalMesher::reticulate_splines(), and MeshBinaryOutput::write().
| void QBSpline::getip | ( | double | t, | |
| int * | i, | |||
| double * | p | |||
| ) | const |
Given a parameter along the spline find the segment and parameter along the segment containing the point.
Returns i==-1 if the parameter t is out of range.
| t | The global parameter along the spline | |
| [out] | i | The index of the segment containing the point |
| [out] | p | The parameter of the point along the segment |
Definition at line 228 of file spline.C.
References closed, dt(), and k.
Referenced by evaluate(), evaluate_full(), and remove_knot().
Here is the call graph for this function:
| Point2D QBSpline::evaluate | ( | double | u | ) | const |
Evaluates the spline, in the splines parametrization.
Simply evaluates the spline geometrically given a value in it's parameter space.
| u | A parameter along the spline (between k[0] and k[k.szie()-1]) |
Definition at line 395 of file spline.C.
References evaluate_segment(), and getip().
Referenced by BezierVertex::get_u().
Here is the call graph for this function:
| Point2D QBSpline::evaluate_segment | ( | int | s, | |
| double | u | |||
| ) | const |
Evaluates a segment at a given parameter value.
Given the index of a segment, and a parameter between 0 and 1, get the geometric value at that point.
| s | The index of the segment (starting at 0 and going to |segments|-1 ) | |
| u | A paramerer between 0 and 1 |
Definition at line 380 of file spline.C.
References b.
Referenced by Visualization::draw_boundary_edge(), Visualization::draw_boundary_edge_debug(), and evaluate().
| void QBSpline::bbox | ( | double * | top, | |
| double * | left, | |||
| double * | bot, | |||
| double * | right | |||
| ) | const |
Find a bounding box for the spline.
This function finds the smallest axis-aligned box containg the spline.
| [out] | top | The top of the box |
| [out] | left | The left of the box |
| [out] | bot | The bot of the box |
| [out] | right | The right of the box |
Definition at line 1031 of file spline.C.
References b.
Referenced by douglas_peucker().
| void QBSpline::douglas_peucker | ( | double | tol, | |
| hashers::hash_set< BezierVertex * > & | keep | |||
| ) | const |
Run the Douglas-Peucker line simplification algorithm.
This function runs the Douglas-Peucker line simplification algorithm, and determines which of the segment endpoints are neccessary to be kept for the spline to maintain its approximate shape. It marks the points it feels are essential by adding them to the keep set.
This keep set is mafe to interact with the coarsening algorithms in BezierMesh
| tol | The tolerance for the algorithm | |
| [out] | keep | A set of vertexs that should be kept |
Definition at line 947 of file spline.C.
References bbox(), k, MAX, simplify(), and vertexs.
Here is the call graph for this function:
| BezierVertex * QBSpline::get_bezier_vertex | ( | unsigned | idx | ) | const |
Given an index of a D1 Vertex, get the BezierVertex.
The index of the D1 vertex is taken as the index with the D0 vertexs included
| idx | The index of the D1 vertex |
Definition at line 1116 of file spline.C.
References vertexs.
Referenced by ConformalMesher::reticulate_splines().
| unsigned QBSpline::get_bezier_vertex_idx | ( | const BezierVertex * | v | ) | const |
Given a D1 BezierVertex, find how far along it is on the spline.
The vertex v must be an internal vertex (a d1 vertex, not a d0). Returns an index for use with get/set_bezier_vertex. This function returns the index of the vertex counting the initial D0 vertex.
| v | The BezierVertex to find the index for. |
Definition at line 1099 of file spline.C.
References vertexs.
| ControlPoint QBSpline::get_control_point_at_idx | ( | unsigned | idx | ) | const |
Given an index of a D0 or D1 Vertex, get the control point back.
This function orders all the D0 and D1 vertexs by thier parameter, and then given an index in this ordering, retunrs the control point at that position.
Definition at line 1127 of file spline.C.
Referenced by ConformalMesher::create_subsplines(), and MeshBinaryInput::read().
| ControlPoint QBSpline::get_edge_center_cp | ( | unsigned | u0_idx, | |
| unsigned | u1_idx | |||
| ) | const |
Given a segment, find the center point of thier segment.
This function takes the index of two D0 and D1 vertexs. It assumes that these two vertexs span a single segment. It then returns the ControlPoint for the center of the segment.
| u0_idx | The first vertex index | |
| u1_idx | The second vertex index |
Definition at line 1143 of file spline.C.
Referenced by MeshBinaryInput::read().
| double QBSpline::get_u_at_idx | ( | unsigned | idx | ) | const |
Given the index of a vertex along the spline, get the knot value.
| idx | The index of the vertex |
Definition at line 1158 of file spline.C.
References k.
Referenced by MeshBinaryInput::read().
| int QBSpline::get_closest_knot | ( | double | u | ) | const |
Find the numerically closest knot to the given parameter.
In some situations, you may have a floating point value which you know is a knot, but are unsure which knot it represents in the sequence. Additionally, the value may have slight rounding errors, making a direct search impossible.
This function will take an approximate knot value and find the index of the knot which most closely matches the given value.
| u | The approximate value of the knot to find |
Definition at line 279 of file spline.C.
References k.
Referenced by get_closest_bezier(), get_segment_center(), and set_bezier_vertex().
| int QBSpline::get_closest_bezier | ( | double | u | ) | const |
Get the closest segment endpoint to a given knot value This will find the numerically closest knot to the parameter, and return the index in b of the bezier point at that knot.
| The | parameter |
Definition at line 301 of file spline.C.
References get_closest_knot().
Referenced by get_edge_cps().
Here is the call graph for this function:
| int QBSpline::get_edge_cps | ( | double | u0, | |
| double | u1, | |||
| ControlPoint & | cp0, | |||
| ControlPoint & | cp1, | |||
| ControlPoint & | cp2, | |||
| int & | cp0_is_vert, | |||
| int & | cp2_is_vert | |||
| ) | const |
Given u-values, find the control points of the appropriate segment.
Furthermoore, this function will check if cp0 or cp2 are at the ends of the spline. This data will be returned via the cp0_is_vert and cp2_is_vert variables. We let (-1 == not a vertex; 0 == vertex0; 1 == vertex1)
This way we can determine where each BezierVertex is in respect to the boundary and can thus set the boundary data correctly with the BezierVertex::set_bdry() functions.
This whole function is only used when reading in from the ruby file format. This is the conssession we must make for not having cached control point values. Since it is only called during the read operation the inefficientcies here are not important.
| u0 | The first parameter value | |
| u1 | The second paramerer value | |
| [out] | cp0 | The first control point of the edge |
| [out] | cp1 | The second control point of the edge |
| [out] | cp2 | The third control point of the edge |
| [out] | cp0_is_vert | Determins if the first cp is an enpoint of the spline |
| [out] | cp2_is_vert | Determins if the third cp is an enpoint of the spline |
Definition at line 333 of file spline.C.
References b, FALSE, get_closest_bezier(), and TRUE.
Referenced by MeshInput::read().
Here is the call graph for this function:
| ControlPoint QBSpline::get_segment_center | ( | double | u0, | |
| double | u1 | |||
| ) | const |
Given two parameters return the center ControlPoint of thier segment.
The main puurpose of this function is for the reconstruction requirements in MeshConstructor::mesh().
| u0 | The first knot | |
| u1 | The second knot |
Definition at line 180 of file spline.C.
References b, get_closest_knot(), and k.
Here is the call graph for this function:
| std::vector<ControlPoint> QBSpline::b |
The Bezier points of the spline.
Definition at line 130 of file spline.h.
Referenced by add_knot(), bbox(), compute_new_points(), BoundaryMesh::delete_edge(), Visualization::draw_boundary_edge(), Visualization::draw_boundary_edge_debug(), evaluate_full(), evaluate_segment(), get_control_point_at_idx(), BoundaryEdge::get_d0_vertex(), get_deboor(), get_edge_center_cp(), get_edge_cps(), get_num_deboor(), get_segment_center(), move(), Simulation::move_(), operator<<(), operator=(), QBSpline(), remove_knot(), simplify(), and MeshBinaryOutput::write().
| std::vector<double> QBSpline::k |
The knot vector.
Definition at line 131 of file spline.h.
Referenced by add_knot(), compute_new_points(), douglas_peucker(), dt(), get_closest_knot(), get_control_point_at_idx(), get_edge_center_cp(), get_num_segments(), get_segment_center(), BezierVertex::get_u(), get_u_at_idx(), getip(), move(), Simulation::move_(), operator<<(), operator=(), QBSpline(), ratio(), remove_knot(), ConformalMesher::reticulate_splines(), BezierVertex::set_bdry(), set_bezier_vertex(), split(), and MeshBinaryOutput::write().
| std::vector<BezierVertex*> QBSpline::vertexs |
The internal BezierVertexs of the spline (D1 vertexs).
Definition at line 132 of file spline.h.
Referenced by add_knot(), douglas_peucker(), get_bezier_vertex(), get_bezier_vertex_idx(), BoundaryEdge::get_d1_vertex(), BoundaryEdge::get_num_d1_vertexs(), BezierVertex::get_u(), operator<<(), operator=(), QBSpline(), remove_knot(), and set_bezier_vertex().
| bool QBSpline::closed |
Determins if the spline is closed.
Definition at line 133 of file spline.h.
Referenced by compute_new_points(), BezierVertex::get_u(), getip(), operator<<(), operator=(), QBSpline(), BezierMesh::remove_vertex(), solve_system(), and MeshBinaryOutput::write().
| double QBSpline::restlength |
The restlength of the spline.
Definition at line 134 of file spline.h.
Referenced by operator<<(), BoundaryEdge::set_restlength(), and MeshBinaryOutput::write().
A pointer to the DataStore used to add/rem ControlPoints.
Definition at line 135 of file spline.h.
Referenced by add_knot(), move(), operator=(), QBSpline(), and remove_knot().
1.5.2