# Visualization Library

A lightweight C++ OpenGL middleware for 2D/3D graphics

[Home] [Tutorials] [All Classes] [Grouped Classes]

Public Member Functions | Protected Attributes

# vl::BezierSurface Class Reference

The BezierSurface class implements a Geometry that is capable of visualizing multiple bicubic Bézier patches (see BezierPatch). More...

`#include <BezierSurface.hpp>`

Inheritance diagram for vl::BezierSurface:

List of all members.

## Public Member Functions

virtual const char * | className ()
| Returns the name of the class.
| 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

## Detailed Description

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:

- Bézier Patches and Surfaces Tutorial for a practical example on how to use the BezierSurface class.
- BezierPatch

Definition at line 86 of file BezierSurface.hpp.

## Constructor & Destructor Documentation

vl::BezierSurface::BezierSurface | ( | ) | `[inline]`

Constructor.

Definition at line 91 of file BezierSurface.hpp.

## Member Function Documentation

virtual const char* vl::BezierSurface::className | ( | ) | `[inline, virtual]`

Returns the name of the class.

Reimplemented from vl::Geometry.

Definition at line 89 of file BezierSurface.hpp.

std::vector< ref<BezierPatch> >& vl::BezierSurface::patches | ( | ) | `[inline]`

Returns the Bézier patches that are part of this Bézier surface.

Definition at line 94 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 96 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 99 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 102 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.

Parameters:

  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(), 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().

## Member Data Documentation

std::vector< ref<BezierPatch> > vl::BezierSurface::mPatches`[protected]`

Definition at line 111 of file BezierSurface.hpp.

unsigned vl::BezierSurface::mDetail`[protected]`

Definition at line 112 of file BezierSurface.hpp.

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

- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/BezierSurface.hpp
- D:/VL/BuildSystem/VL_DISTRO/Visualization_Library_SDK/src/vlGraphics/BezierSurface.cpp

Visualization Library v2011.05.1142 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu May 26 2011 22:51:37.
Permission is granted to use this page to write and publish articles regarding Visualization Library.