|
Houdini Development Toolkit - Version 6.5
Side Effects Software Inc. 2004
|
Geometry
Surfaces (Mesh, Bezier & NURBS)
A surface is a generic term describing open or wrapped polygonal meshes, NURBS
(Non Uniform B-Splines) surfaces, and Bezier surfaces. NURBS and Bezier
surfaces belong to a class of surfaces called Splines.
Basic Functionality
The common functionality of all three surface types is reflected in the base
class, GEO_Hull:
Parametric Operations
To enable a transparent use of all three surface types in a parametric fashion,
we define an implicit domain for the mesh type and use the basis domain
for the spline types. The size of the polygonal domain is given directly by
the number of columns (U) and rows (V).
As a rule, the U parametric direction is associated with the column array,
while the V parametric direction is associated with the column array.
The following is a list of parametric (domain oriented) methods shared by all
surface types:
Other important parametric methods are defined only at the Spline surface
level, predominantly in GEO_TPSurf (the base class of NURBS and Bezier types):
Class Instantiation
The only non-abstract surface classes are GU_PrimMesh, GU_PrimNURBSurf, and
GU_PrimRBezSurf. Although they all have constructors, we recommend that
you use the static ::build() methods defined in each class instead.
This way the objects will be properly initialized.
All ::build() methods require a pointer to the primitive container
(GU_Detail), a number of rows, and a number or columns. The connectivity and
the closed/open flags are optional, as is the option to create GEO_Points.
By default, a GEO_Point is created for each vertex.
Here is an example of how to build a surface of each type:
GU_Detail gdp;
GU_PrimMesh *mesh;
GU_PrimNURBSurf *nurbsurf;
GU_PrimRBezSurf *beziersurf;
//
// Build a polygonal mesh with 10 rows, 5 columns, wrapped in U and
// open in V:
//
mesh = GU_PrimMesh::build(&gdp, 10, 5, GU_PATCH_QUADS, 1, 0);
//
// Build a NURBS surface with 10 rows, 5 columns, order 3 in U, order 4 in
// U, open in both parametric directions, and clamped in U. A clamped NURBS
// surface is one that touches its end rows or columns.
//
nurbsurf = GU_PrimNURBSurf::build(&gdp, 10, 5, 3, 4, 0, 0, 1, 0);
//
// Build a Bezier surface with 10 rows, 5 columns, order 3 in U, order 4 in
// U, and open in both parametric directions.
//
beziersurf = GU_PrimRBezSurf::build(&gdp, 10, 5, 4, 3);
//
// Since the surfaces were built with automatically generated GEO_Points,
// we can assign coordinates to those points as follows:
//
for (int r = 0; r < mesh->getNumRows(); r++)
for (int c = 0; c < mesh->getNumCols(); c++)
(*mesh)(r,c).getPos().assign(r,c,0,1);
//
// To build a surface without automatically generated GEO_Points, add one
// more parameter to the build() method and set it to 0:
//
mesh = GU_PrimMesh::build(&gdp, 10, 5, GU_PATCH_QUADS, 1, 0, 0);
//
// Points need to be created and assigned to the vertices explicitly:
//
GEO_Point *ppt;
for (int r = 0; r < mesh->getNumRows(); r++)
for (int c = 0; c < mesh->getNumCols(); c++)
{
ppt = gdp.appendPoint();
*ppt = UT_Vector4(r,c,0,1);
(*mesh)(r,c).setPt(ppt);
}
Always check the result of the ::build() method for failure. A surface
will not be created unless given valid parameters. A Bezier surface, for
example, is particularly strict about the number of CVs for a given basis
order.
NURBS and Bezier surfaces are built with uniform bases in a [0,1] domain. The
size and the parameterization of the domain can be changed with
GEO_TPSurf::reparameterizeU/V() or by accessing the basis pointers
directly with GEO_TPSurf::getU/VBasis().
Table of Contents
Operators |
Surface Operations |
Particle Operations |
Composite Operators |
Channel Operators
Material & Texture |
Objects |
Command and Expression |
Render Output |
Mantra Shaders |
Utility Classes |
Geometry Library |
Image Library |
Clip Library
Customizing UI |
Questions & Answers
Copyright © 2004 Side Effects Software Inc.
477 Richmond Street West, Toronto, Ontario, Canada M5V 3E7