HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_OBBox2DT< T > Class Template Reference

#include <UT_OBBox2D.h>

Public Member Functions

 UT_OBBox2DT (const UT_Array< UT_Vector2T< T > > &points, T tol=0.05, T bd_advantage=0.0)
 
UT_Matrix2T< TgetBasis () const
 Return the basis that defines the orientation of the OBB. More...
 
UT_Vector2T< TgetRadii () const
 Return the half radii(side length) of the OBB. More...
 
UT_Vector2T< TgetCenter () const
 Return the center of the OBB. More...
 
UT_Vector2T< TgetMinAxis () const
 Return the non-oriented bounding box. More...
 
UT_Vector2T< TgetMaxAxis () const
 Return the non-oriented bounding box. More...
 
UT_Vector2T< TgetTangentAxis () const
 
int getSupportPoints (int &x0, int &x1, int &y0, int &y1) const
 
bool operator== (const UT_OBBox2DT< T > &obb) const
 
bool operator!= (const UT_OBBox2DT< T > &obb) const
 
bool isEqual (const UT_OBBox2DT< T > &obb, T tolerance=T(SYS_FTOLERANCE)) const
 

Protected Member Functions

void calcOBB (const UT_Array< UT_Vector2T< T > > &points, T tol, T bd_advantage)
 

Protected Attributes

UT_Matrix2T< TmyBasis
 
UT_Vector2T< TmyCenter
 
UT_Vector2T< TmyRadii
 
int myXPivot0
 
int myXPivot1
 
int myYPivot0
 
int myYPivot1
 
bool myXPivot0Tangent
 
bool myXPivot1Tangent
 
bool myYPivot0Tangent
 
bool myYPivot1Tangent
 

Detailed Description

template<typename T>
class UT_OBBox2DT< T >

Definition at line 22 of file UT_OBBox2D.h.

Constructor & Destructor Documentation

template<typename T>
UT_OBBox2DT< T >::UT_OBBox2DT ( const UT_Array< UT_Vector2T< T > > &  points,
T  tol = 0.05,
T  bd_advantage = 0.0 
)

points is an array of 2d vectors and tol is the tolerance parameter tol allows the returned answer to be (1 + tol) larger than the smallest possible. The returned answer will then be the oriented bounding box "last" encountered which is up to (1 + tol) larger than the best found box. This can be useful for avoiding rapid changes to the result when input positions are only slightly perturbed. The bd_advantage can be useful when the points list the edges of a polygon in order. If bd_advantage is nonzero, then the area of an oriented bounding box that is tangent to a boundary edge of the input polygon (consecutive points in the array) is regarded as multiplied by (1.0 - bd_advantage). This prioritizes solutions that though suboptimal are close enough to the optimal and align with an input edge when that is preferred.

NB. tol and bd_advantage my fight each other. Make sure you pick a larger values for more important one.

Member Function Documentation

template<typename T>
void UT_OBBox2DT< T >::calcOBB ( const UT_Array< UT_Vector2T< T > > &  points,
T  tol,
T  bd_advantage 
)
protected
template<typename T>
UT_Matrix2T<T> UT_OBBox2DT< T >::getBasis ( ) const
inline

Return the basis that defines the orientation of the OBB.

Definition at line 48 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::getCenter ( ) const
inline

Return the center of the OBB.

Definition at line 52 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::getMaxAxis ( ) const
inline

Return the non-oriented bounding box.

Definition at line 62 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::getMinAxis ( ) const
inline

Return the non-oriented bounding box.

Definition at line 55 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::getRadii ( ) const
inline

Return the half radii(side length) of the OBB.

Definition at line 50 of file UT_OBBox2D.h.

template<typename T>
int UT_OBBox2DT< T >::getSupportPoints ( int x0,
int x1,
int y0,
int y1 
) const
template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::getTangentAxis ( ) const
inline

Return the axis (or one of the axes) with the appropriate sign along which the bounding oriented box is tangent to the convex hull of the point set.

Definition at line 71 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::isEqual ( const UT_OBBox2DT< T > &  obb,
T  tolerance = T(SYS_FTOLERANCE) 
) const
template<typename T>
bool UT_OBBox2DT< T >::operator!= ( const UT_OBBox2DT< T > &  obb) const
inline

Definition at line 89 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::operator== ( const UT_OBBox2DT< T > &  obb) const

Member Data Documentation

template<typename T>
UT_Matrix2T<T> UT_OBBox2DT< T >::myBasis
protected

Definition at line 101 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::myCenter
protected

Definition at line 102 of file UT_OBBox2D.h.

template<typename T>
UT_Vector2T<T> UT_OBBox2DT< T >::myRadii
protected

Definition at line 103 of file UT_OBBox2D.h.

template<typename T>
int UT_OBBox2DT< T >::myXPivot0
protected

Definition at line 105 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::myXPivot0Tangent
protected

Definition at line 106 of file UT_OBBox2D.h.

template<typename T>
int UT_OBBox2DT< T >::myXPivot1
protected

Definition at line 105 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::myXPivot1Tangent
protected

Definition at line 106 of file UT_OBBox2D.h.

template<typename T>
int UT_OBBox2DT< T >::myYPivot0
protected

Definition at line 105 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::myYPivot0Tangent
protected

Definition at line 107 of file UT_OBBox2D.h.

template<typename T>
int UT_OBBox2DT< T >::myYPivot1
protected

Definition at line 105 of file UT_OBBox2D.h.

template<typename T>
bool UT_OBBox2DT< T >::myYPivot1Tangent
protected

Definition at line 107 of file UT_OBBox2D.h.


The documentation for this class was generated from the following file: