1#ifndef NURBS_SURFACE_FMATVEC_H_
2#define NURBS_SURFACE_FMATVEC_H_
4#include <mbsim/numerics/nurbs/nurbs_defs.h>
5#include "nurbs_curve.h"
8 typedef Matrix<General, Fixed<4>, Var,
double> Mat4xV;
10 typedef Matrix<General, Var, Fixed<4>,
double> MatVx4;
20 int surfMeshParams(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q, fmatvec::VecV& uk, fmatvec::VecV& vl);
21 int surfMeshParamsH(
const fmatvec::GeneralMatrix<fmatvec::Vec4>& Qw, fmatvec::VecV& uk, fmatvec::VecV& vl);
23 int surfMeshParamsClosedU(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q, fmatvec::VecV& uk, fmatvec::VecV& vl,
int degU);
24 int surfMeshParamsClosedUH(
const fmatvec::GeneralMatrix<fmatvec::Vec4>& Qw, fmatvec::VecV& uk, fmatvec::VecV& vl,
int degU);
57 NurbsSurface(
int DegU,
int DegV,
const fmatvec::VecV& Uk,
const fmatvec::VecV& Vk, fmatvec::GeneralMatrix<fmatvec::Vec4>& Q) :
U(Uk),
V(Vk),
P(Q),
degU(DegU),
degV(DegV) { }
64 const fmatvec::VecV&
knotU()
const {
return U; }
66 const fmatvec::VecV&
knotV()
const {
return V; }
68 double knotU(
int i)
const {
return U(i); }
70 double knotV(
int i)
const {
return V(i); }
72 const fmatvec::GeneralMatrix<fmatvec::Vec4>&
ctrlPnts()
const {
return P; }
74 const fmatvec::Vec4
ctrlPnts(
int i,
int j)
const {
return P(i, j); }
80 void setKnotU(
const fmatvec::VecV& U_) {
U = U_; }
81 void setKnotV(
const fmatvec::VecV& V_) {
V = V_; }
82 void setCtrlPnts(
const fmatvec::GeneralMatrix<fmatvec::Vec4>& P_) {
P = P_; }
83 void setDegreeU(
int degU_) {
degU = degU_; }
84 void setDegreeV(
int degV_) {
degV = degV_; }
88 void resize(
int Pu,
int Pv,
int DegU,
int DegV);
102 void deriveAt(
double u,
double v,
int d, fmatvec::GeneralMatrix<fmatvec::Vec3> &skl)
const;
103 void deriveAtH(
double u,
double v,
int d, fmatvec::GeneralMatrix<fmatvec::Vec4> &skl)
const;
104 fmatvec::Vec3
normal(
double u,
double v)
const;
107 void globalInterp(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q,
int DegU,
int DegV);
108 void globalInterp(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q,
const fmatvec::VecV& uk,
const fmatvec::VecV& vk,
int DegU,
int DegV);
109 void globalInterpClosedU(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q,
int DegU,
int DegV);
110 void globalInterpClosedU(
const fmatvec::GeneralMatrix<fmatvec::Vec3>& Q,
const fmatvec::VecV& uk,
const fmatvec::VecV& vk,
int DegU,
int DegV);
112 void globalInterpH(
const fmatvec::GeneralMatrix<fmatvec::Vec4>& Q,
int DegU,
int DegV, Method method=chordLength);
113 void globalInterpClosedUH(
const fmatvec::GeneralMatrix<fmatvec::Vec4>& Q,
int DegU,
int DegV, Method method=chordLength);
245 fmatvec::GeneralMatrix<fmatvec::Vec4>
P;
254 void findSpan(
double u,
double v,
int spanU,
int spanV)
const;
258 int findMultU(
int r)
const;
259 int findMultV(
int r)
const;
A class to represent a NURBS surface.
Definition: nurbs_surface.h:39
fmatvec::GeneralMatrix< fmatvec::Vec4 > P
The matrix of control points.
Definition: nurbs_surface.h:245
fmatvec::Vec3 normal(double u, double v) const
Computes the normal of the surface at (u,v)
Definition: nurbs_surface.cc:740
int degreeU() const
A reference to the degree in U of the surface.
Definition: nurbs_surface.h:76
int degreeV() const
A reference to the degree in V of the surface.
Definition: nurbs_surface.h:78
fmatvec::VecV V
the V knot vector
Definition: nurbs_surface.h:244
int findSpanV(double v) const
finds the span in the V direction
Definition: nurbs_surface.cc:516
const fmatvec::GeneralMatrix< fmatvec::Vec4 > & ctrlPnts() const
A reference to the control points.
Definition: nurbs_surface.h:72
const fmatvec::VecV & knotU() const
A reference to the U knot vector.
Definition: nurbs_surface.h:64
NurbsSurface()
default constructor
Definition: nurbs_surface.h:49
fmatvec::HPoint< 3 > operator()(double u, double v) const
Returns the point on the surface at u,v.
Definition: nurbs_surface.cc:762
int degU
the degree of the surface in U
Definition: nurbs_surface.h:246
virtual ~NurbsSurface()=default
Empty desctructor.
NurbsSurface(const NurbsSurface &nS)
copy constructor
Definition: nurbs_surface.h:53
int degV
the degree of the surface in V
Definition: nurbs_surface.h:247
fmatvec::Mat InverseU
The matrix for the computation of the control points in U-direction.
Definition: nurbs_surface.h:250
const fmatvec::VecV & knotV() const
A reference to the V knot vector.
Definition: nurbs_surface.h:66
void findSpan(double u, double v, int spanU, int spanV) const
Finds the multiplicity of a knot in the U knot.
Definition: nurbs_surface.cc:456
double knotU(int i) const
Returns the i-th knot from U.
Definition: nurbs_surface.h:68
int findSpanU(double u) const
finds the span in the U direction
Definition: nurbs_surface.cc:478
NurbsSurface(int DegU, int DegV, const fmatvec::VecV &Uk, const fmatvec::VecV &Vk, fmatvec::GeneralMatrix< fmatvec::Vec4 > &Q)
constructor
Definition: nurbs_surface.h:57
fmatvec::Mat InverseV
The matrix for the computation of the control points in V-direction.
Definition: nurbs_surface.h:251
void deriveAtH(double u, double v, int d, fmatvec::GeneralMatrix< fmatvec::Vec4 > &skl) const
computes the point and the derivatives of degree d and below at (u,v)
Definition: nurbs_surface.cc:691
double knotV(int i) const
Returns the i-th knot from V.
Definition: nurbs_surface.h:70
virtual NurbsSurface & operator=(const NurbsSurface &)
NurbsSurface assignment.
Definition: nurbs_surface.cc:28
fmatvec::VecV U
the U knot vector
Definition: nurbs_surface.h:243
void deriveAt(double u, double v, int d, fmatvec::GeneralMatrix< fmatvec::Vec3 > &skl) const
Find the non-zero basis functions in the U and V direction.
Definition: nurbs_surface.cc:642
const fmatvec::Vec4 ctrlPnts(int i, int j) const
A reference to the control point at (i,j)
Definition: nurbs_surface.h:74
void resize(int Pu, int Pv, int DegU, int DegV)
Resize the surface.
Definition: nurbs_surface.cc:53
fmatvec::Point< 3 > pointAt(double u, double v) const
rojects the point in the normal space
Definition: nurbs_surface.cc:793
wrapper class for nurbs type HPoint
Definition: nurbs_defs.h:42
wrapper class for nurbs type Point
Definition: nurbs_defs.h:13
namespace MBSim
Definition: bilateral_constraint.cc:30