|
#include <NurbsSurface.h>
Public Member Functions | |
NurbsSurface () | |
NurbsSurface (const std::vector< double > &knotsU, const std::vector< double > &knotsV, const std::vector< std::vector< Vec3D >> &controlPoints, const std::vector< std::vector< double >> &weights) | |
NurbsSurface (const std::vector< std::vector< Vec3D >> &controlPoints, const std::vector< std::vector< Mdouble >> &weights, unsigned int degreeU, unsigned int degreeV, bool clampedAtStartU=true, bool clampedAtEndU=true, bool clampedAtStartV=true, bool clampedAtEndV=true) | |
Create a NurbsSurface. This will create uniform knot vectors in u and v (clamped by default). More... | |
Vec3D | evaluate (double u, double v) const |
void | evaluateDerivatives (double u, double v, std::array< std::array< Vec3D, 3 >, 3 > &S) const |
bool | getDistance (Vec3D P, double radius, double &distance, Vec3D &normal) const |
void | set (const std::vector< double > &knotsU, const std::vector< double > &knotsV, const std::vector< std::vector< Vec3D >> &controlPoints, const std::vector< std::vector< double >> &weights) |
void | setClosedInU (bool closedInU) |
void | setClosedInV (bool closedInV) |
void | flipOrientation () |
void | closestPoint (Vec3D position, double &u, double &v) const |
void | splitSurface (int spanU, int spanV) |
double | getLowerBoundU () const |
double | getUpperBoundU () const |
double | getLowerBoundV () const |
double | getUpperBoundV () const |
const std::vector< std::vector< Vec3D > > & | getControlPoints () const |
const std::vector< std::vector< Mdouble > > & | getWeights () const |
const std::vector< Mdouble > & | getKnotsU () const |
const std::vector< Mdouble > & | getKnotsV () const |
void | makePeriodicContinuousInU () |
This will make the surface repeat itself and ensure continuity over periodic boundaries. More... | |
void | makePeriodicContinuousInV () |
This will make the surface repeat itself and ensure continuity over periodic boundaries. More... | |
void | makeClosedInU () |
This will make the surface close around on itself and ensure continuity. More... | |
void | makeClosedInV () |
This will make the surface close around on itself and ensure continuity. More... | |
void | unclampKnots (bool inU, bool atStart) |
Unclamps the knot vector by changing the control points, weights and knots. More... | |
void | moveControlPoint (unsigned int indexU, unsigned int indexV, Vec3D dP, bool includingClosedOrPeriodic) |
Private Member Functions | |
void | wrapAroundInU (unsigned int numStartToEnd, unsigned int numEndToStart, bool forceBothEndsUniform=false) |
Copies control points from the start and adds to the end and vice versa. The first and last control points are ignored, as they are used the indicate the distance to be shifted by. More... | |
void | wrapAroundInV (unsigned int numStartToEnd, unsigned int numEndToStart, bool forceBothEndsUniform=false) |
Copies control points from the start and adds to the end and vice versa. The first and last control points are ignored, as they are used the indicate the distance to be shifted by. More... | |
Private Attributes | |
std::vector< Mdouble > | knotsU_ |
mu knots More... | |
std::vector< Mdouble > | knotsV_ |
mv knots More... | |
std::vector< std::vector< Vec3D > > | controlPoints_ |
nu x nv control points More... | |
std::vector< std::vector< Mdouble > > | weights_ |
nu x nv weights More... | |
unsigned int | degreeU_ |
degree pu = mu-nu-1, pv = mv-nv-1 More... | |
unsigned int | degreeV_ |
bool | closedInU_ |
make it a periodic system More... | |
bool | closedInV_ |
bool | periodicInU_ |
bool | periodicInV_ |
std::vector< Vec3D > | startingPoints_ |
std::vector< Mdouble > | startingKnotsU_ |
std::vector< Mdouble > | startingKnotsV_ |
Friends | |
std::ostream & | operator<< (std::ostream &os, const NurbsSurface &a) |
Adds elements to an output stream. More... | |
std::istream & | operator>> (std::istream &is, NurbsSurface &a) |
Adds elements to an input stream. More... | |
NurbsSurface::NurbsSurface | ( | ) |
Create a NurbsSurface
NurbsSurface::NurbsSurface | ( | const std::vector< double > & | knotsU, |
const std::vector< double > & | knotsV, | ||
const std::vector< std::vector< Vec3D >> & | controlPoints, | ||
const std::vector< std::vector< double >> & | weights | ||
) |
Create a NurbsSurface
knotsU | Knot vector in u-direction |
knotsV | Knot vector in v-direction |
controlPoints | 2D vector of control points |
weights | 2D vector of weights |
NurbsSurface::NurbsSurface | ( | const std::vector< std::vector< Vec3D >> & | controlPoints, |
const std::vector< std::vector< Mdouble >> & | weights, | ||
unsigned int | degreeU, | ||
unsigned int | degreeV, | ||
bool | clampedAtStartU = true , |
||
bool | clampedAtEndU = true , |
||
bool | clampedAtStartV = true , |
||
bool | clampedAtEndV = true |
||
) |
Create a NurbsSurface. This will create uniform knot vectors in u and v (clamped by default).
controlPoints | 2D vector of control points |
weights | 2D vector of weights |
degreeU | Degree in u |
degreeV | Degree in v |
clampedAtStartU | Clamp knots in u at start |
clampedAtEndU | Clamp knots in u at end |
clampedAtStartV | Clamp knots in v at start |
clampedAtEndV | Clamp knots in v at end |
References NurbsUtils::createUniformKnotVector().
Evaluate point on a NURBS surface
u | Parameter to evaluate the surface at |
v | Parameter to evaluate the surface at |
References NurbsUtils::bsplineBasis(), NurbsUtils::findSpan(), and Global_Physical_Variables::Nu.
Referenced by main(), and NurbsWall::writeVTK().
void NurbsSurface::evaluateDerivatives | ( | double | u, |
double | v, | ||
std::array< std::array< Vec3D, 3 >, 3 > & | S | ||
) | const |
Evaluate derivatives of a NURBS curve
[in] | u | Parameter to evaluate derivatives at |
[in] | v | Parameter to evaluate derivatives at |
[out] | S | Contains position, first order derivatives and second order derivatives |
References A, NurbsUtils::bsplineDerBasis(), NurbsUtils::findSpan(), constants::i, and Global_Physical_Variables::Nu.
void NurbsSurface::flipOrientation | ( | ) |
|
inline |
Find projection onto surface, return distance (and contactPoint)
References Vec3D::dot(), Vec3D::getLengthSquared(), constants::i, constants::inf, logger, Global_Physical_Variables::P, VERBOSE, and WARN.
Referenced by NurbsWall::getDistanceAndNormal().
|
inline |
References knotsU_.
Referenced by WearableNurbsWall::getVolumeUnderSurface(), and WearableNurbsWall::processDebris().
|
inline |
References knotsV_.
Referenced by WearableNurbsWall::getVolumeUnderSurface(), and WearableNurbsWall::processDebris().
|
inline |
References degreeU_, and knotsU_.
Referenced by NurbsWall::writeVTK().
|
inline |
References degreeV_, and knotsV_.
Referenced by NurbsWall::writeVTK().
|
inline |
|
inline |
|
inline |
References weights_.
Referenced by WearableNurbsWall::getVolumeUnderSurface(), WearableNurbsWall::processDebris(), and NurbsWall::writeWallDetailsVTK().
void NurbsSurface::makeClosedInU | ( | ) |
This will make the surface close around on itself and ensure continuity.
The first and last control point are assumed to already be in the same position, then degree-1 control points are copied from the start to the end. Resulting in degree amount of control points are overlapping, which ensures continuity. When both ends of the original knot vector weren't uniform, this will change the shape of the surface a bit, however the inner most surface remains intact.
void NurbsSurface::makeClosedInV | ( | ) |
This will make the surface close around on itself and ensure continuity.
The first and last control point are assumed to already be in the same position, then degree-1 control points are copied from the start to the end. Resulting in degree amount of control points are overlapping, which ensures continuity. When both ends of the original knot vector weren't uniform, this will change the shape of the surface a bit, however the inner most surface remains intact.
void NurbsSurface::makePeriodicContinuousInU | ( | ) |
This will make the surface repeat itself and ensure continuity over periodic boundaries.
The first and last control point are assumed to be close to or exactly on the periodic boundaries. Degree-1 amount of control points are copied from both sides to the other. On both sides this results in degree amount of control points "overlapping", which ensures continuity. When both ends of the original knot vector weren't uniform, this will change the shape of the surface a bit, however the inner most surface remains intact.
Referenced by WearableNurbsWall::set().
void NurbsSurface::makePeriodicContinuousInV | ( | ) |
This will make the surface repeat itself and ensure continuity over periodic boundaries.
The first and last control point are assumed to be close to or exactly on the periodic boundaries. Degree-1 amount of control points are copied from both sides to the other. On both sides this results in degree amount of control points "overlapping", which ensures continuity. When both ends of the original knot vector weren't uniform, this will change the shape of the surface a bit, however the inner most surface remains intact.
Referenced by WearableNurbsWall::set().
void NurbsSurface::moveControlPoint | ( | unsigned int | indexU, |
unsigned int | indexV, | ||
Vec3D | dP, | ||
bool | includingClosedOrPeriodic | ||
) |
Referenced by WearableNurbsWall::moveControlPoint(), and WearableNurbsWall::processDebris().
void NurbsSurface::set | ( | const std::vector< double > & | knotsU, |
const std::vector< double > & | knotsV, | ||
const std::vector< std::vector< Vec3D >> & | controlPoints, | ||
const std::vector< std::vector< double >> & | weights | ||
) |
Create a NurbsSurface
knotsU | Knot vector in u-direction |
knotsV | Knot vector in v-direction |
controlPoints | 2D vector of control points |
weights | 2D vector of weights |
References ERROR, NurbsUtils::evaluate(), constants::i, INFO, NurbsUtils::isKnotVectorMonotonic(), logger, and NurbsUtils::normalizeKnotVector().
void NurbsSurface::setClosedInU | ( | bool | closedInU | ) |
void NurbsSurface::setClosedInV | ( | bool | closedInV | ) |
Unclamps the knot vector by changing the control points, weights and knots.
inU | Whether to unclamp the knots in u-direction or the knots in v-direction |
atStart | Whether to unclamp the knots at the start or the end |
References constants::i, n, and NurbsUtils::normalizeKnotVector().
|
private |
Copies control points from the start and adds to the end and vice versa. The first and last control points are ignored, as they are used the indicate the distance to be shifted by.
numStartToEnd | Amount to copy from start and add to end |
numEndToStart | Amount to copy from end and insert before start |
forceBothEndsUniform | When only copying to one side, whether or not the other end should remain untouched |
References NurbsUtils::extendKnotVector(), and constants::i.
|
private |
Copies control points from the start and adds to the end and vice versa. The first and last control points are ignored, as they are used the indicate the distance to be shifted by.
numStartToEnd | Amount to copy from start and add to end |
numEndToStart | Amount to copy from end and insert before start |
forceBothEndsUniform | When only copying to one side, whether or not the other end should remain untouched |
References NurbsUtils::extendKnotVector(), and constants::i.
|
friend |
Adds elements to an output stream.
Adds all elements of the vector to an output stream. NB: this is a global function and a friend of the Vec3D class!
[in] | os | the output stream, |
[in] | a | The vector of interest |
|
friend |
Adds elements to an input stream.
Reads all elements of a given vector from an input stream. NB: this is a global function and a friend of the Vec3D class!
[in,out] | is | the input stream |
[in,out] | a | the vector to be read in |
|
private |
make it a periodic system
|
private |
|
private |
nu x nv control points
Referenced by getControlPoints().
|
private |
degree pu = mu-nu-1, pv = mv-nv-1
Referenced by getLowerBoundU(), and getUpperBoundU().
|
private |
Referenced by getLowerBoundV(), and getUpperBoundV().
|
private |
mu knots
Referenced by getKnotsU(), getLowerBoundU(), and getUpperBoundU().
|
private |
mv knots
Referenced by getKnotsV(), getLowerBoundV(), and getUpperBoundV().
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
nu x nv weights
Referenced by getWeights().