This class represents a mesh that approximates a Bezier patch. More...
#include "BezierPatch.hpp"
Classes  
struct  VertexT 
Represents a single vertex. More...  
Public Member Functions  
BezierPatchT ()  
Constructor for creating an empty Bezier patch. More...  
BezierPatchT (unsigned long Width_, unsigned long Height_, const ArrayT< Vector3T< T > > &Coords_)  
Constructor for creating a patch from given coordinates. More...  
BezierPatchT (unsigned long Width_, unsigned long Height_, const ArrayT< Vector3T< T > > &Coords_, const ArrayT< Vector3T< T > > &TexCoords_)  
Constructor for creating a patch from given coordinates and texturecoordinates. More...  
void  ComputeTangentSpace () 
(Re)computes the tangent space vectors (normal and tangents) for each vertex of the mesh. More...  
void  ComputeTangentSpace_Obsolete () 
(Re)computes the tangent space vectors (normal and tangents) for each vertex of the mesh. More...  
void  Subdivide (T MaxError, T MaxLength, bool OptimizeFlat=true) 
This method subdivides the patch "automatically", that is, by the given maximal error and length bounds. More...  
void  Subdivide (unsigned long SubDivsHorz, unsigned long SubDivsVert, bool OptimizeFlat=true) 
Subdivides the patch "manually", that is, as often as explicitly stated by the parameter values. More...  
void  ForceLinearMaxLength (T MaxLength) 
Intended to be called after one of the Subdivide() methods has been called, this methods linearly subdivides the rows and columns of the mesh so that the MaxLength is never exceeded. More...  
T  GetSurfaceAreaAtVertex (unsigned long i, unsigned long j) const 
Returns the area of the Bezier patch surface around vertex (i, j). More...  
const VertexT &  GetVertex (unsigned long i, unsigned long j) const 
Returns the const mesh vertex at (i, j). More...  
VertexT &  GetVertex (unsigned long i, unsigned long j) 
Returns the (nonconst) mesh vertex at (i, j). More...  
bool  WrapsHorz () const 
Returns whether the left and right borders are identical. More...  
bool  WrapsVert () const 
Returns whether the top and bottom borders are identical. More...  
Public Attributes  
unsigned long  Width 
Number of vertices in width direction. More...  
unsigned long  Height 
Number of vertices in height direction. More...  
ArrayT< VertexT >  Mesh 
Array of Width*Heights vertices that build up the bezier patch. More...  
This class represents a mesh that approximates a Bezier patch.
Two invariants are possible: a) Before one of the Subdivide() methods has been called, the mesh is considered to be a control mesh. A control mesh consists alternatingly of interpolation and approximation vertices which are quasi a composition of 3x3 subpatches with shared borders. The width and height therefore must be odd numbers >= 3. b) After one of the Subdivide() methods has been called, the mesh is just an approximation of the Bezier patch. Contrary to a), all it's vertices lie on the patch curve.
BezierPatchT::BezierPatchT  (  ) 
Constructor for creating an empty Bezier patch.
BezierPatchT::BezierPatchT  (  unsigned long  Width_, 
unsigned long  Height_,  
const ArrayT< Vector3T< T > > &  Coords_  
) 
Constructor for creating a patch from given coordinates.
BezierPatchT::BezierPatchT  (  unsigned long  Width_, 
unsigned long  Height_,  
const ArrayT< Vector3T< T > > &  Coords_,  
const ArrayT< Vector3T< T > > &  TexCoords_  
) 
Constructor for creating a patch from given coordinates and texturecoordinates.
void BezierPatchT::ComputeTangentSpace  (  ) 
(Re)computes the tangent space vectors (normal and tangents) for each vertex of the mesh.
This method must only be called before any of the Subdivide() methods is called, it does not work thereafter.
void BezierPatchT::ComputeTangentSpace_Obsolete  (  ) 
(Re)computes the tangent space vectors (normal and tangents) for each vertex of the mesh.
This method is supposed to be called before one of the Subdivide() methods is called, but it is actually independent of it. That is, it does not matter whether this method is called first and Subdivide() second, or vice versa  both orders are possible and valid, and they should even yield the same result. OBSOLETE NOTE: This method does not really work reliable, the tangent space axes that it generates are frequently questionable... Instead of debugging its code, I rather provide a completely new implementation in a seperate method.
void BezierPatchT::ForceLinearMaxLength  (  T  MaxLength  ) 
Intended to be called after one of the Subdivide() methods has been called, this methods linearly subdivides the rows and columns of the mesh so that the MaxLength is never exceeded.
This is useful/intended for obtaining meshes for lightmap computation purposes. Note that this method quasi does the very opposite from what OptimizeFlatRowAndColumnStrips() does: it inserts "flat" (linear) rows and columns of vertices. Q: Couldn't we just call Subdivide(LargeNum, MaxLength, false); to achieve the same result? A: No!! Two counter examples, both observed with the handrails in the TechDemo map: a) The end pads are small 3x3 patches with sides shorter than MaxLength. However they are not reduced to 2x2 meshes when Subdivide() is called with OptimizeFlat being set to false. b) The rails themselves suffer from the same problem (at each of the four cylindrical sides), plus they rely on their explicitly stated number of subdivisions for ignoring their central interpolating control vertex, whose consideration would deform the handrail!
MaxLength  Maximum length of the subdivisions. 
T BezierPatchT::GetSurfaceAreaAtVertex  (  unsigned long  i, 
unsigned long  j  
)  const 
Returns the area of the Bezier patch surface around vertex (i, j).

inline 
Returns the const mesh vertex at (i, j).

inline 
Returns the (nonconst) mesh vertex at (i, j).
void BezierPatchT::Subdivide  (  T  MaxError, 
T  MaxLength,  
bool  OptimizeFlat = true 

) 
This method subdivides the patch "automatically", that is, by the given maximal error and length bounds.
MaxError  The maximum allowed spatial distance between the computed approximation mesh and the true mathematical curve. 
MaxLength  The maximum side length that one mesh element may have. 
OptimizeFlat  If true unnecessary vertices from flat substrips are removed. 
void BezierPatchT::Subdivide  (  unsigned long  SubDivsHorz, 
unsigned long  SubDivsVert,  
bool  OptimizeFlat = true 

) 
Subdivides the patch "manually", that is, as often as explicitly stated by the parameter values.
SubDivsHorz  The number of horizontal subdivisions that each 3x3 subpatch is subdivided into. 
SubDivsVert  The number of vertical subdivisions that each 3x3 subpatch is subdivided into. 
OptimizeFlat  If true unnecessary vertices from flat substrips are removed. 
bool BezierPatchT::WrapsHorz  (  )  const 
Returns whether the left and right borders are identical.
Returns whether the patch mesh wraps "in the width", i.e. if the left and right borders are identical.
bool BezierPatchT::WrapsVert  (  )  const 
Returns whether the top and bottom borders are identical.
Returns whether the patch mesh wraps "in the height", i.e. if the top and bottom borders are identical.
unsigned long cf::math::BezierPatchT< T >::Height 
Number of vertices in height direction.
ArrayT<VertexT> cf::math::BezierPatchT< T >::Mesh 
Array of Width*Heights vertices that build up the bezier patch.
unsigned long cf::math::BezierPatchT< T >::Width 
Number of vertices in width direction.