A NURBS 3D curve. More...
Public Member Functions | |
NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const List< scalar > &weights, const scalarField &u, const label nPts, const word name="NURBS3DCurve") | |
NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const List< scalar > &weights, const label nPts, const word name="NURBS3DCurve") | |
Construct from control points, weights and basis order. More... | |
NURBS3DCurve (const NURBSbasis &basis, const List< vector > &CPs, const label nPts, const word name="NURBS3DCurve") | |
Construct from control points and basis order. More... | |
NURBS3DCurve (const NURBS3DCurve &) | |
Construct as copy. More... | |
~NURBS3DCurve ()=default | |
Destructor. More... | |
void | setNrm3DOrientation (const vector &givenNrm, const vector &givenTan) |
void | setNrm2DOrientation (const vector &givenNrm, const scalar zVal) |
void | flipNrmOrientation () |
Flip the orientation of the nrm. More... | |
void | setCPs (const List< vector > &CPs) |
Set CPs. More... | |
void | setWeights (const List< scalar > &weights) |
Set weights. More... | |
void | setName (const word &name) |
Set name. More... | |
void | buildCurve () |
Build curve. More... | |
void | invert () |
Invert CPs order and re-build curve. More... | |
void | insertKnot (const scalarField &oldKnots, const scalar uBar, const label kInsert) |
Insert a knot by re-computing the control points. More... | |
void | makeEquidistant (const label lenAcc=25, const label maxIter=10, const label spacingCorrInterval=-1, const scalar tolerance=1.e-5) |
Make curve points equidistant in cartesian space. More... | |
vector | curvePoint (const scalar u) const |
Curve point cartesian coordinates at ui. More... | |
scalar | findClosestCurvePoint (const vector &targetPoint, const label maxIter=1000, const scalar tolerance=1.e-13) |
scalar | findClosestCurvePoint (const vector &targetPoint, const scalar initGuess, const label maxIter=1000, const scalar tolerance=1.e-13) |
const vector | nrm3D (const vector &refTan, const scalar u) const |
Find the normal to the curve, with the option of forcing a z-plane. More... | |
const vector | nrm2D (const scalar zVal, const scalar u) const |
scalarList | genEquidistant (const label nPts=100, const label lenAcc=25, const label maxIter=10, const label spacingCorrInterval=-1, const scalar tolerance=1.e-5) |
bool | checkRange (const scalar u, const label CPI, const label degree) const |
Check if given parametric coordinate u and CP are linked. More... | |
bool | checkRange (const scalar u, const label CPI) const |
scalar | length (const label uIStart, const label uIEnd) const |
scalar | length (const scalar uStart, const scalar uEnd, const label nPts) const |
scalar | length () const |
Calculate length for the entire curve length. More... | |
vector | curveDerivativeU (const scalar u) const |
Curve derivative wrt u at point ui. More... | |
vector | curveDerivativeUU (const scalar u) const |
Curve second derivative wrt u at point ui. More... | |
scalar | curveDerivativeCP (const scalar u, const label CPI) |
vector | curveDerivativeWeight (const scalar u, const label CPI) |
Curve derivative wrt CPII at point u. More... | |
scalar | lengthDerivativeU (const scalar uStart, const scalar uEnd, const label nPts) |
const NURBSbasis & | getBasisFunction () const |
Get basis function. More... | |
const List< vector > & | getCPs () const |
Get CPs. More... | |
const List< scalar > & | getWeights () const |
Get weights. More... | |
const List< scalar > & | getParametricCoordinates () const |
Get parametric coordinates. More... | |
const word & | getName () const |
Get name. More... | |
label | nrmOrientation () const |
Return the nrm sgn relation to the u=0 nrm. More... | |
const vector & | givenInitNrm () const |
Return the initial normal given to compare to the Curve's normals. More... | |
void | write () |
Write curve to file. More... | |
void | write (const word fileName) |
void | write (const fileName dirName, const fileName fileName) |
void | writeWParses () |
void | writeWParses (const word fileName) |
void | writeWParses (const fileName dirName, const fileName fileName) |
Public Member Functions inherited from Field< vector > | |
constexpr | Field () noexcept |
Construct null. More... | |
Field (const label len) | |
Construct given size. More... | |
Field (const label len, const vector &val) | |
Construct given size and initial value. More... | |
Field (const label len, const Foam::zero) | |
Construct given size and initial values of zero. More... | |
Field (const Foam::one, const vector &val) | |
Construct with length=1, copying the value as the only content. More... | |
Field (const Foam::one, vector &&val) | |
Construct with length=1, moving the value as the only content. More... | |
Field (const Foam::one, const Foam::zero) | |
Construct with length=1, initializing content to zero. More... | |
Field (const Field< vector > &fld) | |
Copy construct. More... | |
Field (const UList< vector > &list) | |
Copy construct from UList<Type> More... | |
Field (const IndirectListBase< vector, Addr > &list) | |
Copy construct from IndirectList. More... | |
Field (Field< vector > &&fld) | |
Move construct from Field. More... | |
Field (List< vector > &&list) | |
Move construct from List. More... | |
Field (DynamicList< vector, SizeMin > &&list) | |
Move construct from DynamicList. More... | |
Field (const UList< vector > &mapF, const labelUList &mapAddressing) | |
Construct by 1 to 1 mapping from the given field. More... | |
Field (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing) | |
Construct by 1 to 1 mapping from the given tmp field. More... | |
Field (const UList< vector > &mapF, const labelListList &mapAddressing, const scalarListList &weights) | |
Construct by interpolative mapping from the given field. More... | |
Field (const tmp< Field< vector >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights) | |
Construct by interpolative mapping from the given tmp field. More... | |
Field (const UList< vector > &mapF, const FieldMapper &map, const bool applyFlip=true) | |
Construct by mapping from the given field. More... | |
Field (const UList< vector > &mapF, const FieldMapper &map, const vector &defaultValue, const bool applyFlip=true) | |
Construct by mapping from the given field. More... | |
Field (const UList< vector > &mapF, const FieldMapper &map, const UList< vector > &defaultValues, const bool applyFlip=true) | |
Construct by mapping from the given field. More... | |
Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const bool applyFlip=true) | |
Construct by mapping from the given tmp field. More... | |
Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const vector &defaultValue, const bool applyFlip=true) | |
Field (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const UList< vector > &defaultValues, const bool applyFlip=true) | |
Field (Field< vector > &fld, bool reuse) | |
Copy construct or re-use as specified. More... | |
Field (const tmp< Field< vector >> &tfld) | |
Copy or move construct from tmp. More... | |
Field (Istream &is) | |
Construct from Istream. More... | |
Field (const word &keyword, const dictionary &dict, const label len) | |
Construct from a dictionary entry. More... | |
tmp< Field< vector > > | clone () const |
Clone. More... | |
void | map (const UList< vector > &mapF, const labelUList &mapAddressing) |
1 to 1 map from the given field More... | |
void | map (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing) |
1 to 1 map from the given tmp field More... | |
void | map (const UList< vector > &mapF, const labelListList &mapAddressing, const scalarListList &weights) |
Interpolative map from the given field. More... | |
void | map (const tmp< Field< vector >> &tmapF, const labelListList &mapAddressing, const scalarListList &weights) |
Interpolative map from the given tmp field. More... | |
void | map (const UList< vector > &mapF, const FieldMapper &map, const bool applyFlip=true) |
Map from the given field. More... | |
void | map (const tmp< Field< vector >> &tmapF, const FieldMapper &map, const bool applyFlip=true) |
Map from the given tmp field. More... | |
void | autoMap (const FieldMapper &map, const bool applyFlip=true) |
Map from self. More... | |
void | rmap (const UList< vector > &mapF, const labelUList &mapAddressing) |
1 to 1 reverse-map from the given field More... | |
void | rmap (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing) |
1 to 1 reverse-map from the given tmp field More... | |
void | rmap (const UList< vector > &mapF, const labelUList &mapAddressing, const UList< scalar > &weights) |
Interpolative reverse map from the given field. More... | |
void | rmap (const tmp< Field< vector >> &tmapF, const labelUList &mapAddressing, const UList< scalar > &weights) |
Interpolative reverse map from the given tmp field. More... | |
void | negate () |
Negate this field (negative). More... | |
tmp< Field< cmptType > > | component (const direction) const |
Return a component field of the field. More... | |
void | replace (const direction, const UList< cmptType > &) |
Replace a component field of the field. More... | |
void | replace (const direction, const tmp< Field< cmptType >> &) |
Replace a component field of the field. More... | |
void | replace (const direction, const cmptType &) |
Replace a component field of the field. More... | |
VSForm | block (const label start) const |
tmp< Field< vector > > | T () const |
Return the field transpose (only defined for second rank tensors) More... | |
void | writeEntry (const word &keyword, Ostream &os) const |
Write the field as a dictionary entry. More... | |
void | operator= (const Field< vector > &) |
Copy assignment. More... | |
void | operator= (const tmp< Field< vector >> &) |
void | operator= (const UList< vector > &) |
void | operator= (const SubField< vector > &) |
void | operator= (Field< vector > &&rhs) |
Move assignment. More... | |
void | operator= (List< vector > &&rhs) |
void | operator= (DynamicList< vector, SizeMin > &&rhs) |
void | operator= (const vector &val) |
Value assignment. More... | |
void | operator= (const Foam::zero) |
void | operator= (const VectorSpace< Form, Cmpt, nCmpt > &) |
void | operator= (const tmp< Field > &rhs) |
void | operator+= (const UList< vector > &) |
void | operator+= (const tmp< Field< vector >> &) |
void | operator+= (const vector &) |
void | operator-= (const UList< vector > &) |
void | operator-= (const tmp< Field< vector >> &) |
void | operator-= (const vector &) |
void | operator*= (const UList< scalar > &) |
void | operator*= (const tmp< Field< scalar >> &) |
void | operator*= (const scalar &) |
void | operator/= (const UList< scalar > &) |
void | operator/= (const tmp< Field< scalar >> &) |
void | operator/= (const scalar &) |
Additional Inherited Members | |
Public Types inherited from Field< vector > | |
typedef pTraits< vector >::cmptType | cmptType |
Component type. More... | |
typedef SubField< vector > | subField |
Declare type of subField. More... | |
Static Public Member Functions inherited from Field< vector > | |
static const Field< vector > & | null () |
Return nullObject reference field. More... | |
static autoPtr< Field< vector > > | New (Istream &is) |
Return a pointer to a new Field created on freestore. More... | |
static tmp< Field< vector > > | NewCalculatedType (const Field< Type2 > &f) |
NURBS3DCurve | ( | const NURBSbasis & | basis, |
const List< vector > & | CPs, | ||
const List< scalar > & | weights, | ||
const scalarField & | u, | ||
const label | nPts, | ||
const word | name = "NURBS3DCurve" |
||
) |
Construct from control points, weights and basis order and parametric coordinates
Definition at line 210 of file NURBS3DCurve.C.
NURBS3DCurve | ( | const NURBSbasis & | basis, |
const List< vector > & | CPs, | ||
const List< scalar > & | weights, | ||
const label | nPts, | ||
const word | name = "NURBS3DCurve" |
||
) |
Construct from control points, weights and basis order.
Uniform coordinate distribution is implied
Definition at line 236 of file NURBS3DCurve.C.
NURBS3DCurve | ( | const NURBSbasis & | basis, |
const List< vector > & | CPs, | ||
const label | nPts, | ||
const word | name = "NURBS3DCurve" |
||
) |
Construct from control points and basis order.
Uniform coordinate distribution and unit weights are implied
Definition at line 262 of file NURBS3DCurve.C.
NURBS3DCurve | ( | const NURBS3DCurve & | ) |
Construct as copy.
|
default |
Destructor.
Take a given normal and use to determine if NURBS normals should be reversed. Computation taken from u = 0.
Definition at line 291 of file NURBS3DCurve.C.
References Foam::endl(), Foam::Info, Foam::tan(), and Foam::Zero.
void setNrm2DOrientation | ( | const vector & | givenNrm, |
const scalar | zVal | ||
) |
Definition at line 317 of file NURBS3DCurve.C.
References Foam::endl(), Foam::Info, Foam::tan(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.
void flipNrmOrientation | ( | ) |
Flip the orientation of the nrm.
Definition at line 346 of file NURBS3DCurve.C.
Set CPs.
Definition at line 359 of file NURBS3DCurve.C.
void setWeights | ( | const List< scalar > & | weights | ) |
Set weights.
Definition at line 365 of file NURBS3DCurve.C.
void setName | ( | const word & | name | ) |
Set name.
Definition at line 371 of file NURBS3DCurve.C.
References Foam::name().
void buildCurve | ( | ) |
Build curve.
Definition at line 377 of file NURBS3DCurve.C.
References NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, VectorSpace< Vector< Cmpt >, Cmpt, 3 >::zero, and Foam::Zero.
Referenced by NURBS3DCurve::invert().
void invert | ( | ) |
Invert CPs order and re-build curve.
Definition at line 408 of file NURBS3DCurve.C.
References NURBS3DCurve::buildCurve(), Foam::endl(), Foam::Info, and Foam::Zero.
void insertKnot | ( | const scalarField & | oldKnots, |
const scalar | uBar, | ||
const label | kInsert | ||
) |
Insert a knot by re-computing the control points.
The basis' insertKnot function must have beem called first to correctly provide the required info.
Definition at line 646 of file NURBS3DCurve.C.
References Foam::Zero.
void makeEquidistant | ( | const label | lenAcc = 25 , |
const label | maxIter = 10 , |
||
const label | spacingCorrInterval = -1 , |
||
const scalar | tolerance = 1.e-5 |
||
) |
Make curve points equidistant in cartesian space.
Definition at line 430 of file NURBS3DCurve.C.
vector curvePoint | ( | const scalar | u | ) | const |
Curve point cartesian coordinates at ui.
Definition at line 457 of file NURBS3DCurve.C.
References NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.
scalar findClosestCurvePoint | ( | const vector & | targetPoint, |
const label | maxIter = 1000 , |
||
const scalar | tolerance = 1.e-13 |
||
) |
Find curve point which is closest to given point using Newton-Raphson. Returns the param coordinate.
Definition at line 484 of file NURBS3DCurve.C.
References Foam::bound(), Foam::endl(), forAll, Foam::mag(), and WarningInFunction.
scalar findClosestCurvePoint | ( | const vector & | targetPoint, |
const scalar | initGuess, | ||
const label | maxIter = 1000 , |
||
const scalar | tolerance = 1.e-13 |
||
) |
Find curve point which is closest to given point using Newton-Raphson. Returns the param coordinate.
Definition at line 554 of file NURBS3DCurve.C.
References Foam::bound(), Foam::endl(), Foam::mag(), and WarningInFunction.
Find the normal to the curve, with the option of forcing a z-plane.
Definition at line 612 of file NURBS3DCurve.C.
References NURBS3DCurve::curveDerivativeU(), Vector< Cmpt >::normalise(), and Foam::Zero.
const vector nrm2D | ( | const scalar | zVal, |
const scalar | u | ||
) | const |
Definition at line 631 of file NURBS3DCurve.C.
References NURBS3DCurve::curveDerivativeU(), Foam::mag(), Foam::tan(), Vector< Cmpt >::x(), Vector< Cmpt >::y(), Vector< Cmpt >::z(), and Foam::Zero.
scalarList genEquidistant | ( | const label | nPts = 100 , |
const label | lenAcc = 25 , |
||
const label | maxIter = 10 , |
||
const label | spacingCorrInterval = -1 , |
||
const scalar | tolerance = 1.e-5 |
||
) |
Generate points on the curve which are evenly spaced in cartesian coordinate distances.
Definition at line 688 of file NURBS3DCurve.C.
References U, and Foam::Zero.
bool checkRange | ( | const scalar | u, |
const label | CPI, | ||
const label | degree | ||
) | const |
Check if given parametric coordinate u and CP are linked.
Definition at line 719 of file NURBS3DCurve.C.
bool checkRange | ( | const scalar | u, |
const label | CPI | ||
) | const |
Definition at line 729 of file NURBS3DCurve.C.
References NURBSbasis::checkRange(), and NURBSbasis::degree().
scalar length | ( | const label | uIStart, |
const label | uIEnd | ||
) | const |
Calculate Length from starting to ending indices via computational evaluation using trapezoid rule.
Definition at line 736 of file NURBS3DCurve.C.
References NURBS3DCurve::curveDerivativeU(), forAll, NURBS3DCurve::length(), Foam::mag(), and Foam::Zero.
scalar length | ( | const scalar | uStart, |
const scalar | uEnd, | ||
const label | nPts | ||
) | const |
Calculate length from starting to ending parametric coordinates via computational evaluation using trapezoid rule.
Definition at line 762 of file NURBS3DCurve.C.
References forAll, Foam::mag(), and Foam::Zero.
scalar length | ( | ) | const |
Calculate length for the entire curve length.
Definition at line 792 of file NURBS3DCurve.C.
Referenced by NURBS3DCurve::length().
vector curveDerivativeU | ( | const scalar | u | ) | const |
Curve derivative wrt u at point ui.
Definition at line 800 of file NURBS3DCurve.C.
References NURBSbasis::basisDerivativeU(), NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.
Referenced by NURBS3DCurve::length(), NURBS3DCurve::nrm2D(), and NURBS3DCurve::nrm3D().
vector curveDerivativeUU | ( | const scalar | u | ) | const |
Curve second derivative wrt u at point ui.
Definition at line 825 of file NURBS3DCurve.C.
References NURBSbasis::basisDerivativeU(), NURBSbasis::basisDerivativeUU(), NURBSbasis::basisValue(), NURBSbasis::degree(), forAll, and Foam::Zero.
scalar curveDerivativeCP | ( | const scalar | u, |
const label | CPI | ||
) |
Curve derivative wrt b at point ui: scalar since dx/dX = dy/dY = dz/dZ.
Definition at line 864 of file NURBS3DCurve.C.
References forAll, and Foam::Zero.
vector curveDerivativeWeight | ( | const scalar | u, |
const label | CPI | ||
) |
Curve derivative wrt CPII at point u.
Definition at line 886 of file NURBS3DCurve.C.
References forAll, and Foam::Zero.
scalar lengthDerivativeU | ( | const scalar | uStart, |
const scalar | uEnd, | ||
const label | nPts | ||
) |
Calculate length from starting to ending indices via computational evaluation using trapezoid rule
Definition at line 912 of file NURBS3DCurve.C.
References forAll, Foam::mag(), and Foam::Zero.
|
inline |
Get basis function.
Definition at line 325 of file NURBS3DCurve.H.
Get CPs.
Definition at line 331 of file NURBS3DCurve.H.
|
inline |
Get weights.
Definition at line 337 of file NURBS3DCurve.H.
|
inline |
Get parametric coordinates.
Definition at line 343 of file NURBS3DCurve.H.
|
inline |
Get name.
Definition at line 349 of file NURBS3DCurve.H.
|
inline |
Return the nrm sgn relation to the u=0 nrm.
Definition at line 355 of file NURBS3DCurve.H.
|
inline |
Return the initial normal given to compare to the Curve's normals.
Definition at line 361 of file NURBS3DCurve.H.
void write | ( | ) |
Write curve to file.
Definition at line 954 of file NURBS3DCurve.C.
void write | ( | const word | fileName | ) |
Definition at line 961 of file NURBS3DCurve.C.
References Foam::endl(), field(), forAll, and UPstream::master().
Definition at line 1010 of file NURBS3DCurve.C.
References Foam::endl(), field(), forAll, and UPstream::master().
void writeWParses | ( | ) |
Definition at line 1059 of file NURBS3DCurve.C.
void writeWParses | ( | const word | fileName | ) |
Definition at line 1066 of file NURBS3DCurve.C.
References Foam::endl(), field(), forAll, and UPstream::master().
Definition at line 1117 of file NURBS3DCurve.C.
References Foam::endl(), field(), forAll, and UPstream::master().