Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 67 additions & 2 deletions gotools-core/include/GoTools/geometry/SplineSurface.h
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,16 @@ class GO_API SplineSurface : public ParamSurface
const BsplineBasis& basis(int i) const
{ return (i==0) ? basis_u_ : basis_v_; }


/// Query the number of control points along the specified parameter direction
/// \param pardir specify whether to return the number of coefs for the first
/// parameter (0) or for the second parameter (1).
/// \return the number of control points along the specified parameter direction
int numCoefs(int pardir) const
{
return (pardir == 0) ? basis_u_.numCoefs() : basis_v_.numCoefs();
}

/// Query the number of control points along the first parameter direction
/// \return the number of control points along the first parameter direction
int numCoefs_u() const
Expand All @@ -771,17 +781,28 @@ class GO_API SplineSurface : public ParamSurface
{ return basis_v_.numCoefs(); }

/// Query the number of elements in the SplineSurface
/// \return the number of 2D elements in the surface
int numElem() const
{
return basis_u_.numElem()*basis_v_.numElem();
}

/// Query the number of elements in one parameter direction of
/// the SplineSurface
/// \param pardir specify whether to return the order for the first
/// parameter (0) or for the second parameter (1).
int numElem(int pardir) const
{
return (pardir == 0) ? basis_u_.numElem() :
basis_v_.numElem();
return (pardir == 0) ? basis_u_.numElem() : basis_v_.numElem();
}

/// Query the order of the BsplineBasis for the specified parameter
/// \param pardir specify whether to return the order for the first
/// parameter (0) or for the second parameter (1).
/// \return the order of the BsplineBasis for the specified parameter direction
int order(int pardir) const
{
return (pardir == 0) ? basis_u_.order() : basis_v_.order();
}

/// Query the order of the BsplineBasis for the first parameter
Expand Down Expand Up @@ -909,6 +930,25 @@ class GO_API SplineSurface : public ParamSurface
/// \param v2 new max. value of second parameter span
virtual void setParameterDomain(double u1, double u2, double v1, double v2);

/// Insert a new knot in the knotvector of the given parameter direction
/// \param pardir parameter direction in which to insert the knots
/// (u=0, v=1)
/// \param apar the parameter value at which a new knot will be inserted
void insertKnot(int pardir, double apar)
{
(pardir == 0) ? insertKnot_u(apar) : insertKnot_v(apar);
}

/// Insert new knots in the knotvector of the given parameter direction
/// \param pardir parameter direction in which to insert the knots
/// (u=0, v=1, w=2)
/// \param new_knots a vector containing the parameter values of the
/// new knots to insert.
void insertKnot(int pardir, const std::vector<double>& new_knots)
{
(pardir == 0) ? insertKnot_u(new_knots) : insertKnot_v(new_knots);
}

/// Insert a new knot in the knotvector of the first parameter
/// \param apar the parameter value at which a new knot will be inserted
void insertKnot_u(double apar);
Expand All @@ -927,6 +967,14 @@ class GO_API SplineSurface : public ParamSurface
/// new knots to insert.
void insertKnot_v(const std::vector<double>& new_knots);

/// Remove a knot from the knotvector of the given parameter direction.
/// \param pardir the parameter direction (u=0, v=1)
/// \param tpar the parameter value of the knot to be removed
void removeKnot(int pardir, double tpar)
{
(pardir == 0) ? removeKnot_u(tpar) : removeKnot_v(tpar);
}

/// Remove a knot from the knotvector of the first parameter.
/// \param tpar the parameter value of the knot to be removed
void removeKnot_u(double tpar);
Expand All @@ -935,6 +983,14 @@ class GO_API SplineSurface : public ParamSurface
/// \param tpar the parameter value of the knot to be removed.
void removeKnot_v(double tpar);

/// Inserts knots in the specified knot vector, such that all knots
/// have multiplicity order
/// \param pardir the parameter direction (u=0, v=1)
void makeBernsteinKnots(int pardir)
{
(pardir == 0) ? makeBernsteinKnotsU() : makeBernsteinKnotsV();
}

/// Inserts knots in the u knot vector, such that all knots
/// have multiplicity order
void makeBernsteinKnotsU();
Expand All @@ -946,6 +1002,15 @@ class GO_API SplineSurface : public ParamSurface
/// Ensure k-regularity of this surface in both parameter directions
void makeSurfaceKRegular();

/// Returns the number of knot intervals in the specified knot vector.
/// \param pardir parameter direction (u=0, v=1)
/// \return the number of knot intervals in the knotvector for the
/// specified parameter direction
int numberOfPatches(int pardir) const
{
return (pardir == 0) ? numberOfPatches_u() : numberOfPatches_v();
}

/// Returns the number of knot intervals in u knot vector.
/// \return the number of knot intervals in the knotvector for the first
/// parameter
Expand Down
17 changes: 12 additions & 5 deletions trivariate/include/GoTools/trivariate/SplineVolume.h
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,9 @@ class SplineVolume : public ParamVolume
}

/// Query the number of control points along the specified parameter direction
/// \param pardir specify whether to return the number of coefs for the first
/// parameter (0), for the second parameter (1) or the third
/// (2) parameter.
/// \return the number of control points along the specified parameter direction
int numCoefs(int pardir) const
{
Expand All @@ -485,7 +488,7 @@ class SplineVolume : public ParamVolume
}

/// Query the order of the BsplineBasis for the specified parameter
/// \return the order of the BsplineBasis for the specified parameter
/// \return the order of the BsplineBasis for the specified parameter direction
int order(int pardir) const
{
if (pardir == 0) return basis_u_.order();
Expand All @@ -494,14 +497,18 @@ class SplineVolume : public ParamVolume
}

/// Query the number of elements in the SplineVolume
/// \return the number of 3D elements in the volume
int numElem() const
{
return basis_u_.numElem()*basis_v_.numElem()*basis_w_.numElem();
}

/// Query the number of elements in one parameter direction of
// the SplineVolume
/// pardir = 0: u-direction, pardir = 1: vdirection, pardir = 2: wdirection
/// \param pardir specify whether to return the number of elements for the first
/// parameter (0), for the second parameter (1) or the third
/// (2) parameter.
/// \return the number of elements for the specified parameter direction
int numElem(int pardir) const
{
if (pardir == 0) return basis_u_.numElem();
Expand Down Expand Up @@ -628,17 +635,17 @@ class SplineVolume : public ParamVolume
void insertKnot(int pardir, const std::vector<double>& new_knots);

/// Remove a knot from the knotvector of the given parameter direction.
/// \param pardir the parameter direction (0, 1 or 2)
/// \param pardir the parameter direction (u=0, v=1, w=2)
/// \param tpar the parameter value of the knot to be removed
void removeKnot(int pardir, double tpar);

/// Inserts knots in the specified knot vector, such that all knots
/// have multiplicity order
/// \param pardir the parameter direction (0, 1, or 2)
/// \param pardir the parameter direction (u=0, v=1, w=2)
void makeBernsteinKnots(int pardir);

/// Returns the number of knot intervals in the specified knot vector.
/// \param pardir parameter direction
/// \param pardir parameter direction (u=0, v=1, w=2)
/// \return the number of knot intervals in the knotvector for the
/// specified parameter direction
int numberOfPatches(int pardir) const;
Expand Down