40 #ifndef NURBS3DCurve_H 41 #define NURBS3DCurve_H 77 label nrmOrientation_;
83 label sgn(
const scalar val)
const;
85 scalar abs(
const scalar val)
const;
87 label mod(
const label
x,
const label interval)
const;
105 const label spacingCorrInterval,
106 const scalar tolerance
205 const label lenAcc = 25,
206 const label maxIter = 10,
207 const label spacingCorrInterval = -1,
208 const scalar tolerance = 1.
e-5
221 const vector& targetPoint,
222 const label maxIter = 1000,
223 const scalar tolerance = 1.
e-13
230 const vector& targetPoint,
231 const scalar initGuess,
232 const label maxIter = 1000,
233 const scalar tolerance = 1.
e-13
239 const vector nrm2D(
const scalar zVal,
const scalar u)
const;
245 const label nPts = 100,
246 const label lenAcc = 25,
247 const label maxIter = 10,
248 const label spacingCorrInterval=-1,
249 const scalar tolerance = 1.
e-5
358 return nrmOrientation_;
364 return givenInitNrm_;
const List< scalar > & getParametricCoordinates() const
Get parametric coordinates.
A class for handling file names.
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.
const List< vector > & getCPs() const
Get CPs.
vector curvePoint(const scalar u) const
Curve point cartesian coordinates at ui.
const word & getName() const
Get name.
~NURBS3DCurve()=default
Destructor.
const vector & givenInitNrm() const
Return the initial normal given to compare to the Curve's normals.
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...
scalar length() const
Calculate length for the entire curve length.
void buildCurve()
Build curve.
void flipNrmOrientation()
Flip the orientation of the nrm.
const dimensionedScalar e
Elementary charge.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
vector curveDerivativeU(const scalar u) const
Curve derivative wrt u at point ui.
vector curveDerivativeUU(const scalar u) const
Curve second derivative wrt u at point ui.
void setNrm3DOrientation(const vector &givenNrm, const vector &givenTan)
Take a given normal and use to determine if NURBS normals should be reversed. Computation taken from ...
A class for handling words, derived from Foam::string.
bool checkRange(const scalar u, const label CPI, const label degree) const
Check if given parametric coordinate u and CP are linked.
const vector nrm2D(const scalar zVal, const scalar u) const
void setCPs(const List< vector > &CPs)
Set CPs.
NURBSbasis function. Used to construct NURBS curves, surfaces and volumes.
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.
const vector nrm3D(const vector &refTan, const scalar u) const
Find the normal to the curve, with the option of forcing a z-plane.
void invert()
Invert CPs order and re-build curve.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
const List< scalar > & getWeights() const
Get weights.
vector curveDerivativeWeight(const scalar u, const label CPI)
Curve derivative wrt CPII at point u.
void setNrm2DOrientation(const vector &givenNrm, const scalar zVal)
scalar lengthDerivativeU(const scalar uStart, const scalar uEnd, const label nPts)
Calculate length from starting to ending indices via computational evaluation using trapezoid rule...
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.
void insertKnot(const scalarField &oldKnots, const scalar uBar, const label kInsert)
Insert a knot by re-computing the control points.
label nrmOrientation() const
Return the nrm sgn relation to the u=0 nrm.
void setName(const word &name)
Set name.
scalar curveDerivativeCP(const scalar u, const label CPI)
Curve derivative wrt b at point ui: scalar since dx/dX = dy/dY = dz/dZ.
void write()
Write curve to file.
void setWeights(const List< scalar > &weights)
Set weights.
const NURBSbasis & getBasisFunction() const
Get basis function.