# Visualization Library

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

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

Public Types | Public Member Functions | Protected Attributes

# vl::BezierPatch Class Reference

Defines one or more concatenated bicubic Bézier patches to be used with the BezierSurface class. More...

`#include <BezierSurface.hpp>`

Inheritance diagram for vl::BezierPatch:

List of all members.

## Public Types

typedef std::vector< vec3 > | Points
| The control points grid defining the bicubic Bézier patch(es).

## Public Member Functions

| BezierPatch ()
| Constructor.
| BezierPatch (int x, int y)
| Constructor.
void | resize (int x, int y)
| Defines the x and y dimensions of the control point grid defining the patch.
int | x () const
| Returns the `x` dimension of the patch as specified by resize().
int | y () const
| Returns the `y` dimension of the patch as specified by resize().
Points & | points ()
| The control points grid defining the bicubic Bézier patch(es).
const Points & | points () const
| The control points grid defining the bicubic Bézier patch(es).
vec3 & | at (int i, int j)
| Returns the i/j control point.
const vec3 & | at (int i, int j) const
| Returns the i/j control point.

## Protected Attributes

Points | mControlPoints
int | mX
int | mY

## Detailed Description

Defines one or more concatenated bicubic Bézier patches to be used with the BezierSurface class.

See also:

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

Definition at line 44 of file BezierSurface.hpp.

## Member Typedef Documentation

typedef std::vector< vec3 > vl::BezierPatch::Points

The control points grid defining the bicubic Bézier patch(es).

Definition at line 50 of file BezierSurface.hpp.

## Constructor & Destructor Documentation

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

Constructor.

Definition at line 52 of file BezierSurface.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

vl::BezierPatch::BezierPatch | ( | int | x,
|  | int | y
| ) |  | `[inline]`

Constructor.

Definition at line 57 of file BezierSurface.hpp.

References VL_DEBUG_SET_OBJECT_NAME.

## Member Function Documentation

void BezierPatch::resize | ( | int | x,
|  | int | y
| ) |  |

Defines the x and y dimensions of the control point grid defining the patch.

The `x` and `y` parameters must be of the form 3*n+1 with `n` integer positive, i.e 4 (n=1), 7 (n=2), 10 (n=3) and so on.

    - The simplest bicubic Bézier patch requires 4x4 = 16 control points: A, B, C, D, E, F, G, H, I, L, M, N, O, P, Q, R
    - The Bézier surface is guaranteed to touch only the 4 corner control points A, D, O and R.

    A---B---C---D
    |   |   |   |
    E---F---G---H
    |   |   |   |
    I---L---M---N
    |   |   |   |
    O---P---Q---R

    In this case we would call "resize(4,4)"

    - You can concatenate two bicubic Bézier patches to form a larger suface by sharing their control points like this:

       patch 1     patch 2
    A---+---+---B---+---+---G
    |   |   |   |   |   |   |
    +---+---+---C---+---+---+
    |   |   |   |   |   |   |
    +---+---+---D---+---+---+
    |   |   |   |   |   |   |
    F---+---+---E---+---+---H

    In this case we would call "resize(7,4)"

    - In this case the two patches share the control points B, C, D and E.
    - As we can see the total control points needed are 28 = (2 (patches along x) * 3 + 1) * (1 (patches along y) * 3 + 1)
    - Also in this case the Bézier surface is guaranteed to touch only the 6 corner control points A, B, E, F, G and H.

Definition at line 70 of file BezierSurface.cpp.

References vl::Log::error(), mControlPoints, mX, mY, VL_CHECK, x(), and y().

int vl::BezierPatch::x | ( | ) | const`[inline]`

Returns the `x` dimension of the patch as specified by resize().

Definition at line 66 of file BezierSurface.hpp.

Referenced by resize(), and vl::BezierSurface::updateBezierSurface().

int vl::BezierPatch::y | ( | ) | const`[inline]`

Returns the `y` dimension of the patch as specified by resize().

Definition at line 68 of file BezierSurface.hpp.

Referenced by resize(), and vl::BezierSurface::updateBezierSurface().

Points& vl::BezierPatch::points | ( | ) | `[inline]`

The control points grid defining the bicubic Bézier patch(es).

Definition at line 70 of file BezierSurface.hpp.

const Points& vl::BezierPatch::points | ( | ) | const`[inline]`

The control points grid defining the bicubic Bézier patch(es).

Definition at line 72 of file BezierSurface.hpp.

vec3& vl::BezierPatch::at | ( | int | i,
|  | int | j
| ) |  | `[inline]`

Returns the i/j control point.

Definition at line 74 of file BezierSurface.hpp.

Referenced by vl::BezierSurface::updateBezierSurface().

const vec3& vl::BezierPatch::at | ( | int | i,
|  | int | j
| ) |  | const`[inline]`

Returns the i/j control point.

Definition at line 76 of file BezierSurface.hpp.

## Member Data Documentation

Points vl::BezierPatch::mControlPoints`[protected]`

Definition at line 78 of file BezierSurface.hpp.

Referenced by resize().

int vl::BezierPatch::mX`[protected]`

Definition at line 79 of file BezierSurface.hpp.

Referenced by resize().

int vl::BezierPatch::mY`[protected]`

Definition at line 80 of file BezierSurface.hpp.

Referenced by resize().

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.09.1162 Reference Documentation
Copyright 2005-2011 Michele Bosi. All rights reserved.
Updated on Thu Jan 26 2012 00:44:30.
Permission is granted to use this page to write and publish articles regarding Visualization Library.