Visualization Library v1.0.3A lightweight C++ OpenGL middleware for 2D/3D graphics |
[Download] [Tutorials] [All Classes] [Grouped Classes] |
The BezierSurface class implements a Geometry that is capable of visualizing multiple bicubic Bézier patches (see BezierPatch). More...
#include <BezierSurface.hpp>
Public Member Functions | |
BezierSurface () | |
Constructor. | |
std::vector< ref< BezierPatch > > & | patches () |
Returns the Bézier patches that are part of this Bézier surface. | |
const std::vector< ref < BezierPatch > > & | patches () const |
Returns the Bézier patches that are part of this Bézier surface. | |
void | setDetail (unsigned i) |
The sampling level of the patch, must not be less than 2. The higher the sampling level, the more detailed the patch will be. | |
unsigned | detail () const |
The sampling level of the patch, must not be less than 2. The higher the sampling level, the more detailed the patch will be. | |
void | updateBezierSurface (bool gen_tex_coords=true) |
Generates the Bézier surface geometry based on the current patches and detail. | |
Protected Attributes | |
std::vector< ref< BezierPatch > > | mPatches |
unsigned | mDetail |
The BezierSurface class implements a Geometry that is capable of visualizing multiple bicubic Bézier patches (see BezierPatch).
From Wikipedia [http://en.wikipedia.org/wiki/Bézier_surface]:
"Bézier surfaces are a species of mathematical spline used in computer graphics, computer-aided design, and finite element modelling. As with the Bézier curve, a Bézier surface is defined by a set of control points. Similar to interpolation in many respects, a key difference is that the surface does not, in general, pass through the central control points; rather, it is "stretched" toward them as though each were an attractive force. They are visually intuitive, and for many applications, mathematically convenient."
"Bézier surfaces were first described in 1972 by the French engineer Pierre Bézier who used them to design automobile bodies. Bézier surfaces can be of any degree, but bicubic Bézier surfaces generally provide enough degrees of freedom for most applications."
See also:
Definition at line 94 of file BezierSurface.hpp.
vl::BezierSurface::BezierSurface | ( | ) | [inline] |
std::vector< ref<BezierPatch> >& vl::BezierSurface::patches | ( | ) | [inline] |
Returns the Bézier patches that are part of this Bézier surface.
Definition at line 106 of file BezierSurface.hpp.
Referenced by updateBezierSurface().
const std::vector< ref<BezierPatch> >& vl::BezierSurface::patches | ( | ) | const [inline] |
Returns the Bézier patches that are part of this Bézier surface.
Definition at line 108 of file BezierSurface.hpp.
void vl::BezierSurface::setDetail | ( | unsigned | i ) | [inline] |
The sampling level of the patch, must not be less than 2. The higher the sampling level, the more detailed the patch will be.
Definition at line 111 of file BezierSurface.hpp.
unsigned vl::BezierSurface::detail | ( | ) | const [inline] |
The sampling level of the patch, must not be less than 2. The higher the sampling level, the more detailed the patch will be.
Definition at line 114 of file BezierSurface.hpp.
Referenced by updateBezierSurface().
void BezierSurface::updateBezierSurface | ( | bool | gen_tex_coords = true ) |
Generates the Bézier surface geometry based on the current patches and detail.
Note that this method does not recompte the normals of the mesh, this means that if you are using the OpenGL lighting or other techniques requiring vertex normals you should call computeNormals() right after calling this function.
gen_tex_coords | If set to true the function will also generate normalized (0..1) texture coordinates. |
Definition at line 87 of file BezierSurface.cpp.
References vl::BezierPatch::at(), vl::Collection< T >::at(), vl::Collection< T >::clear(), detail(), vl::Geometry::drawCalls(), vl::ref< T >::get(), vl::Geometry::makeGLESFriendly(), NULL, patches(), vl::PT_QUADS, vl::Collection< T >::push_back(), vl::Geometry::setTexCoordArray(), vl::Geometry::setVertexArray(), vl::Collection< T >::size(), vl::Geometry::texCoordArray(), vl::Geometry::vertexArray(), vl::BezierPatch::x(), and vl::BezierPatch::y().
std::vector< ref<BezierPatch> > vl::BezierSurface::mPatches [protected] |
Definition at line 123 of file BezierSurface.hpp.
unsigned vl::BezierSurface::mDetail [protected] |
Definition at line 124 of file BezierSurface.hpp.