15 #ifndef __GEO_TPSurf_h__
16 #define __GEO_TPSurf_h__
85 unsigned du=0,
unsigned dv=0,
86 int uoffset=-1,
int voffset=-1)
const;
87 int evaluateHomogeneous(
float u,
float v,
UT_Vector4 &pos,
88 unsigned du=0,
unsigned dv=0,
89 int uoffset=-1,
int voffset=-1)
const;
91 unsigned du=0,
unsigned dv=0,
92 int uoffset=-1,
int voffset=-1)
const;
101 unsigned du=0,
unsigned dv=0,
102 int uoffset=-1,
int voffset=-1)
const;
109 virtual int evaluateBasisDerivs(
float u,
float v,
111 float vbmatx[][GA_MAXORDER],
112 int &rowoffset,
int &coloffset,
113 unsigned du=0,
unsigned dv=0,
114 int uoffset=-1,
int voffset=-1)
const = 0;
120 virtual int evaluateBasis(
float u,
float v,
float *ubvals,
121 float *vbvals,
int &rowoffset,
123 unsigned du=0,
unsigned dv=0,
124 int uoffset=-1,
int voffset=-1)
const = 0;
125 virtual int evaluateUBasis(
float u,
float *ubvals,
int &coloffset,
126 unsigned du=0,
int uoffset=-1)
const = 0;
127 virtual int evaluateVBasis(
float v,
float *vbvals,
int &rowoffset,
128 unsigned dv=0,
int voffset=-1)
const = 0;
134 float computeUBValue(
float u,
int uoff)
const;
135 float computeVBValue(
float v,
int voff)
const;
136 float computeBValue (
float u,
float v,
int uoff,
int voff)
const;
143 int ustartidx,
int ustopidx,
144 int vstartidx,
int vstopidx,
145 int ulod,
int vlod)
const;
154 unsigned du = 0,
unsigned dv = 0)
const;
160 unsigned du = 0,
unsigned dv = 0)
const;
166 unsigned du = 0,
unsigned dv = 0)
const;
170 template <
typename T>
176 unsigned du = 0,
unsigned dv = 0)
const;
183 int computeUConstCVs(
float u,
GEO_Face *results,
185 int uoffset=-1)
const;
187 int computeUConstCVs(
float u,
UT_Vector4 *cvs,
188 int uoffset=-1)
const;
190 int computeVConstCVs(
float v,
GEO_Face *results,
192 int voffset=-1)
const;
194 int voffset=-1)
const;
200 int createUConstProfile(
float u,
float growtip = 0.0
f);
201 int createVConstProfile(
float v,
float growtip = 0.0
f);
209 int chordUBasis(
float v,
GA_Basis &ub,
int voff=-1)
const;
210 int chordVBasis(
float u,
GA_Basis &vb,
int uoff=-1)
const;
223 int curvature(
float u,
float v,
float &curv)
const;
227 float arcLength(
float u0,
float v0,
float u1,
float v1,
228 int divs = 10)
const;
233 virtual int domainRangeOfCV(
int i,
int j,
int &minuk,
int &maxuk,
234 int &minvk,
int &maxvk)
const=0;
241 virtual int breakpointRangeOfCV(
int i,
int j,
int &minbkpu,
242 int &maxbkpu,
int &minbkpv,
243 int &maxbkpv)
const = 0;
257 void mapUBasis(
float orig,
float len);
258 void mapVBasis(
float orig,
float len);
262 void validURange(
float &ua,
float &ub)
const override;
263 void validVRange(
float &va,
float &vb)
const override;
270 bool uniformTexture (
const GA_RWHandleV3 &txth,
bool ptattrib);
271 bool grevilleTexture(
const GA_RWHandleV3 &txth,
bool ptattrib);
272 bool chordLenTexture(
const GA_RWHandleV3 &txth,
bool ptattrib);
301 void weights(
unsigned short onOff)
override;
306 int setWeight(
unsigned int r,
unsigned int c,
float w);
309 float getWeight(
unsigned int r,
unsigned int c)
const;
312 int isRational()
const;
317 float u_unit,
float v_unit,
318 float &u_real,
float &v_real)
const override;
320 float u_real,
float v_real,
321 float &u_unit,
float &v_unit)
const override;
326 float *uunit,
float *ureal,
327 int ulen)
const override;
330 float *vunit,
float *vreal,
331 int vlen)
const override;
336 void normalizeWeights();
340 void normalizeDomain(
float len = 0.F,
float *newuorigin = 0,
341 float *newvorigin = 0);
354 float *&uunits,
float *&vunits,
355 int &udivs,
int &vdivs,
360 void refineBelt(
float ubwidth = 0.4F,
float vbwidth = 0.4F,
361 int ubdivs = 2,
int vbdivs = 2);
370 delete myUBasis; myUBasis = ub;
379 delete myVBasis; myVBasis = vb;
388 unsigned getUOrder()
const {
return (
unsigned)myUBasis->getOrder(); }
389 unsigned getVOrder()
const {
return (
unsigned)myVBasis->getOrder(); }
392 unsigned getUDim()
const {
return (
unsigned)myUBasis->getDimension(); }
393 unsigned getVDim()
const {
return (
unsigned)myVBasis->getDimension(); }
412 static void dehomogenizeData(
GA_Offset *vertices,
420 {
return raiseOrderUInt(neworder); }
422 {
return raiseOrderVInt(neworder); }
425 {
return raiseOrderURefMap(neworder, map); }
428 {
return raiseOrderVRefMap(neworder, map); }
436 virtual int translateBreakpoints(
const UT_IntArray &uindices,
443 virtual int transformBreakpoints(
const UT_IntArray &uindices,
461 float bias = 0.5
f,
float tolerance = 1.0
f,
465 float bias = 0.5
f,
float tolerance = 1.0
f,
473 float vstart,
float vstop)
const = 0;
482 float *u0,
float *
u1,
483 float *
v0,
float *
v1)
override;
486 int hasProfiles()
const;
505 void stashed(
bool beingstashed,
529 int solveConstraints(
const UT_Vector &uparam,
553 int solveAndApplyConstraints(
const UT_Vector &uparam,
560 int elevateOrderU(
int order);
561 int elevateOrderV(
int order);
565 float worldtol = 1e-4F,
566 float domaintol = 1e-2F,
568 bool docompact =
true) = 0;
570 float worldtol = 1e-4F,
int nontrivial = 0)
const = 0;
575 virtual GEO_Hull *reconfigure(
unsigned type,
int orderu,
int orderv,
576 bool openu,
bool openv,
577 bool endsu,
bool endsv)
const = 0;
582 virtual GEO_Curve *buildRowCurve(
bool appendPoints,
584 virtual GEO_Curve *buildColCurve(
bool appendPoints,
593 virtual GEO_TPSurf *cutU(
float u1,
float u2,
int &ind1,
int &ind2,
596 virtual GEO_TPSurf *cutV(
float v1,
float v2,
int &ind1,
int &ind2,
600 virtual void openAtU(
float u) = 0;
601 virtual void openAtV(
float v) = 0;
605 bool interpretBreakpoint(
int uidx,
int vidx,
UT_Vector3 &p)
const;
613 {
return extractUIsoparm(u, uoffset,
getParent()); }
614 GEO_Curve *extractUIsoparm(
float u,
int uoffset,
618 {
return extractUIsoparm(u, map, uoffset,
getParent()); }
622 {
return extractVIsoparm(v, voffset,
getParent()); }
623 GEO_Curve *extractVIsoparm(
float v,
int voffset,
627 {
return extractVIsoparm(v, map, voffset,
getParent()); }
664 bool binary)
const override;
674 void mergeAttachProfilesU(
const GEO_TPSurf &tpsurf);
675 void mergeAttachProfilesV(
const GEO_TPSurf &tpsurf);
680 return (count > 0) ? ((stop -
start)/(
float)
count)
685 virtual GA_Basis *newBasis()
const = 0;
698 float u,
float v = 0,
699 unsigned du=0,
unsigned dv=0)
const override;
710 unsigned du,
unsigned dv)
const override;
714 unsigned du=0,
unsigned dv=0)
const override;
718 int ndivs=1)
override;
721 int ndivs=1)
override;
724 virtual int raiseOrderUInt (
int neworder) = 0;
725 virtual int raiseOrderVInt (
int neworder) = 0;
726 virtual int raiseOrderURefMap(
int neworder,
728 virtual int raiseOrderVRefMap(
int neworder,
virtual void realToUnitDomain(float u_real, float v_real, float &u_unit, float &v_unit) const
int setUBasis(GA_Basis *ub)
int raiseOrderV(int neworder, GA_AttributeRefMap &map)
int setVBasis(GA_Basis *vb)
GEO_Primitive * copy(int preserve_shared_pts=0) const override
#define GEO_FAMILY_TPSURF
virtual int attachV(const GEO_Hull &hull, int blend=1, float bias=0.5f, float tolerance=1.0f, int unrefine=1, GA_PointGroup *ptgroup=0)=0
virtual void validVRange(float &va, float &vb) const
virtual void subdivide(int numdivs, GA_PointGroup *ptgroup=0)
virtual bool evaluateIndexRefMap(fpreal u, fpreal v, GA_Offset result_vtx, GA_AttributeRefMap &hlist, unsigned du, unsigned dv) const
int raiseOrderU(int neworder)
const GLuint GLenum const void * binary
virtual int evaluateNormal(float u, float v, UT_Vector3 &nml) const
virtual void validVInterval(int &a, int &b) const
GEO_Curve * extractU(float unitu)
static GA_PrimitiveFamilyMask buildFamilyMask()
virtual void validUInterval(int &a, int &b) const
GLboolean GLboolean GLboolean GLboolean a
JSON reader class which handles parsing of JSON or bJSON files.
SYS_FORCE_INLINE GEO_Detail * getParent() const
Class which writes ASCII or binary JSON streams.
unsigned getVOrder() const
virtual void unitToRealSequenceU(float *uunit, float *ureal, int ulen) const
GLfloat GLfloat GLfloat v2
GEO_Profiles * profiles() const
virtual void spanRefineURefMap(GA_AttributeRefMap &map, int numdivs=1)=0
bool saveH9(std::ostream &os, bool binary, const UT_Array< GA_AttribSaveDataH9 > &prim_attribs, const UT_Array< GA_AttribSaveDataH9 > &vtx_attribs) const override
#define GA_INVALID_OFFSET
void copySubclassData(const GA_Primitive *source) override
GA_PwHandle< true > GA_PwHandleRO
OIIO_FORCEINLINE bool extract(const vbool4 &a)
virtual void unitToRealSequenceV(float *vunit, float *vreal, int vlen) const
GLsizei GLboolean transpose
vint4 blend(const vint4 &a, const vint4 &b, const vbool4 &mask)
virtual void validURange(float &ua, float &ub) const
virtual bool checkValid(int cvLen, int bLen, bool doesWrap) const =0
virtual int normalIndex(float iu, float iv, UT_Vector3 &nml) const
virtual bool validate() const =0
virtual void unitToRealDomain(float u_unit, float v_unit, float &u_real, float &v_real) const
GLsizei GLsizei GLchar * source
int64 getBaseMemoryUsage() const
Report approximate memory usage for myVertexMatx (exclusive)
Bezier or NURBS basis classes which maintain knot vectors.
GLdouble GLdouble GLint GLint order
A handle to simplify manipulation of multiple attributes.
GEO_Curve * extractVIsoparm(float v, const GA_AttributeRefMap &map, int voffset=-1)
virtual void weights(unsigned short onOff)
bool isDegenerate() const override
Is the primitive degenerate.
GLboolean GLboolean GLboolean b
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
IMATH_HOSTDEVICE constexpr int divs(int x, int y) IMATH_NOEXCEPT
GA_DECLARE_INTRINSICS(override)
GEO_Curve * extractV(float unitv)
GLenum GLint GLint * precision
int parametricBBox(float u, float v, float *u0, float *u1, float *v0, float *v1) override
GLfloat GLfloat GLfloat GLfloat h
virtual void spanRefineUInt(int numdivs=1)=0
int raiseOrderV(int neworder)
static const UT_Array< GA_AttribSaveDataH9 > & theEmptySaveAttribs
Convience objects to pass as arguments to saveH9()/loadH9().
virtual bool loadExtraH9(UT_IStream &is)=0
GEO_Curve * extractVIsoparm(float v, int voffset=-1)
void copyPrimitive(const GEO_Primitive *src) override
int raiseOrderU(int neworder, GA_AttributeRefMap &map)
virtual int evaluateIndexV4(float iu, float iv, UT_Vector4 &pos, unsigned du=0, unsigned dv=0) const
GEO_Curve * extractUIsoparm(float u, const GA_AttributeRefMap &map, int uoffset=-1)
Class to store JSON objects as C++ objects.
virtual bool evaluatePointRefMap(GA_Offset result_vtx, GA_AttributeRefMap &map, fpreal u, fpreal v=0, uint du=0, uint dv=0) const =0
void stashed(bool beingstashed, GA_Offset offset=GA_INVALID_OFFSET) override
void computeInteriorPointWeights(UT_Array< GA_Offset > &vtxlist, UT_Array< float > &weightlist, fpreal u, fpreal v, fpreal w) const override
virtual bool loadPrivateH9(UT_IStream &is)=0
Container class for all geometry.
friend std::ostream & operator<<(std::ostream &os, const GEO_TPSurf &d)
virtual void spanRefineVRefMap(GA_AttributeRefMap &map, int numdivs=1)=0
GLubyte GLubyte GLubyte GLubyte w
Specialization of GA_ROGenericHandle for GA_ATTRIB_VERTEX offsets.
void countBaseMemory(UT_MemoryCounter &counter) const
float stepSize(float start, float stop, int count) const
GEO_Curve * extractUIsoparm(float u, int uoffset=-1)
virtual int attachU(const GEO_Hull &hull, int blend=1, float bias=0.5f, float tolerance=1.0f, int unrefine=1, GA_PointGroup *ptgroup=0)=0
unsigned getUOrder() const
static GA_PrimitiveFamilyMask buildFamilyMask()
virtual bool saveExtraH9(std::ostream &os, bool binary) const =0
virtual unsigned getNumSecondaryDetails() const
A primitive may support any number of secondary details.
virtual bool savePrivateH9(std::ostream &os, bool binary) const =0
virtual void spanRefineVInt(int numdivs=1)=0
GA_Basis * getUBasis() const
virtual void isolate()
Method to isolate a pasted surface.
virtual int evaluatePointV4(UT_Vector4 &pos, float u, float v=0, unsigned du=0, unsigned dv=0) const
constexpr T normalize(UT_FixedVector< T, D > &a) noexcept
void clearForDeletion() override
GEO_TPSurf(GA_Detail *d, GA_Offset offset=GA_INVALID_OFFSET)
virtual const GA_Detail * getSecondaryDetail(GA_Index i) const
GA_Basis * getVBasis() const