13 #ifndef __GEO_Convex__
14 #define __GEO_Convex__
50 template<
typename POLY>
58 {
return myConvex.
isTri() ? 3 : 4; }
60 {
return myPoly.getFastVertexOffset(myConvex.
vertices[i]); }
62 {
return myPoly.getPointOffset(myConvex.
vertices[i]); }
64 {
return myPoly.getPos3(myConvex.
vertices[i]); }
71 if (!myConvex.
isTri())
78 const GEO_TriOrQuad &myConvex;
82 template<
typename POLY>
90 , myOutputPolys(output)
94 GA_Size nvertices = poly.getFastVertexCount();
105 {
return myInputPoly.getFastVertexCount(); }
106 void getPoint(
int num,
float &x,
float &y)
const override
115 myOutputPolys.append();
116 myOutputPolys.last().makeTri();
122 myOutputPolys.last().vertices[myI] = num;
128 const POLY &myInputPoly;
140 template<
typename POLY>
144 GA_Size nvertices = poly.getFastVertexCount();
149 if (keepnonconvexquads)
182 GA_Size minquads = (nvertices-1)/2;
193 for (
GA_Size i = 0; i < nvertices; ++i)
194 temppoints(i) = poly.getPos3(i);
201 geo_Convexer<POLY>(poly, output,
x,
y, triangulate);
209 template<
typename POLY>
GEO_TriOrQuadT< GA_Size > GEO_TriOrQuad
SYS_FORCE_INLINE void makeTri()
SYS_FORCE_INLINE UT_Vector3 getPos3(GA_Size i) const
UT_Vector3T< T > getMinAxis() const
Return the minimum axis direction.
void bumpCapacity(exint min_capacity)
virtual void polyVertex(int num)=0
Arbitrarily Oriented Bounding (OBB)
GLfloat GLfloat GLfloat v2
GLfloat GLfloat GLfloat GLfloat v3
virtual void beginPolygon(int npoints, bool lastone)=0
beginPolygon will be told when the last polygon is being added
void setSize(exint newsize)
exint GA_Size
Defines the bit width for index and offset types in GA.
GEO_TriOrQuadWrapper(const POLY &poly, const GEO_TriOrQuad &convex)
void getFrameOfReference(UT_Vector3T< T > &X, UT_Vector3T< T > &Y) const
virtual void getPoint(int num, float &x, float &y) const =0
SIM_DerScalar length() const
SYS_FORCE_INLINE GA_Size getFastVertexCount() const
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
virtual void endPolygon()=0
SYS_FORCE_INLINE GA_Offset getFastVertexOffset(GA_Size i) const
SYS_FORCE_INLINE bool isTri() const
constexpr SYS_FORCE_INLINE bool isEqual(const UT_Vector3T &b, const T tolerance=SYS_FTOLERANCE) const noexcept
SYS_FORCE_INLINE void makeInvalid()
bool GEOconvexPoly(const POLY &poly, UT_Array< GEO_TriOrQuad > &output, bool keepnonconvexquads=true, bool triangulate=false)
GEO_TriOrQuadT(T v0, T v1, T v2, T v3=T(-1))
static bool canSplitQuad02(const UT_Vector3 &p0, const UT_Vector3 &p1, const UT_Vector3 &p2, const UT_Vector3 &p3)
void convex(exint maxsides, bool allowinterrupt=true, bool avoiddegeneracy=false)
virtual int getPointCount() const =0
It's the sub-class responsibility to fill these out...
SIM_DerVector3 cross(const SIM_DerVector3 &lhs, const SIM_DerVector3 &rhs)
SYS_FORCE_INLINE bool GEOtriangulatePoly(const POLY &poly, UT_Array< GEO_TriOrQuad > &output)
GA_API const UT_StringHolder area
SYS_FORCE_INLINE GA_Offset getPointOffset(GA_Size i) const