H3D::Extrusion Class Reference
[X3D node classes.]

The Extrusion node specifies geometric shapes based on a two dimensional cross-section extruded along a three dimensional spine in the local coordinate system. More...

#include <H3D/Extrusion.h>

Inheritance diagram for H3D::Extrusion:

Inheritance graph

List of all members.

Classes

class  SFBound
 SFBound is specialized update itself from the fields of the Extrusion. More...
class  VertexVectors
 Specialized field vertex coordinates from the fields affecting this, the resulting vertexVector will be used both in render and in bound. More...

Public Member Functions

virtual void render ()
 Render the Extrusion with OpenGL.
virtual int nrTriangles ()
 An upper bound on the number of triangles.
virtual void traverseSG (TraverseInfo &ti)
 Traverse the scenegraph.
 Extrusion (Inst< SFNode > _metadata=0, Inst< SFBound > _bound=0, Inst< DisplayList > _displayList=0, Inst< SFBool > _beginCap=0, Inst< SFBool > _ccw=0, Inst< SFBool > _convex=0, Inst< SFFloat > _creaseAngle=0, Inst< MFVec2f > _crossSection=0, Inst< SFBool > _endCap=0, Inst< MFRotation > _orientation=0, Inst< MFVec2f > _scale=0, Inst< SFBool > _solid=0, Inst< MFVec3f > _spine=0, Inst< VertexVectors > _vertexVector=0)
 Constructor.

Public Attributes

auto_ptr< SFBoolbeginCap
 When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.
auto_ptr< SFBoolccw
 The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors used in the lighting model equations.
auto_ptr< SFBoolconvex
 The convex field indicates whether all polygons in the shape are convex (TRUE).
auto_ptr< SFFloatcreaseAngle
 The creaseAngle field affects how default normals are generated.
auto_ptr< MFVec2fcrossSection
 A 2D crossSection piecewise linear curve (described as a series of connected vertices).
auto_ptr< SFBoolendCap
 When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.
auto_ptr< MFRotationorientation
 A list of 3D orientation parameters used to orient the crossSection.
auto_ptr< MFVec2fscale
 A list of 2D scale parameters used to scale the crossSection.
auto_ptr< SFBoolsolid
 The solid field determines whether one or both sides of each polygon shall be displayed.
auto_ptr< MFVec3fspine
 A 3D spine piecewise linear curve (also described as a series of connected vertices).
auto_ptr< VertexVectorsvertexVector
 The vector of vertices constructing the extrusion-shape Only accessable in C++.

Static Public Attributes

static H3DNodeDatabase database
 The H3DNodeDatabase for this node.

Protected Member Functions

template<typename T >
bool coinc (T a, T b)
 returns true if the two points are coincident
Vec3f calculateNormal (const vector< Vec3f > &vertex_vector, H3DInt32 right, H3DInt32 middle, H3DInt32 left)
 calculate the normal to a face given three vertices in the face.
vector< H3DInt32findSurroundingFaces (H3DInt32 i, H3DInt32 j, bool closedSpine, H3DInt32 nrOfSpinePoints, bool closedCrossSection, H3DInt32 nrOfCrossSectionPoints)
 find the surrounding faces to the face defined by i and j.
void generateNormalsPerVertex (vector< Vec3f > &normalVector, const vector< Vec3f > &vertex_vector, const vector< Vec2f > &cross_section, vector< Vec3f > &yAxis, bool ccwcheck, H3DInt32 nrOfCrossSectionPoints, H3DInt32 nrOfSpinePoints, bool closedSpine, H3DFloat crease_angle, H3DInt32 &ifCapsAdd)
 Create a vector from the arguments given with one normal for each vertex in each face, i.e.
void generateNormalsPerVertex (vector< Vec3f > &normalVector, const vector< Vec3f > &vertex_vector, const vector< Vec2f > &cross_section, vector< Vec3f > &yAxis, bool ccwcheck, H3DInt32 nrOfCrossSectionPoints, H3DInt32 nrOfSpinePoints, bool closedSpine, H3DInt32 &ifCapsAdd)
 Create a vector from the arguments given with one normal for each vertex.
vector< Vec3f > generateNormalsPerFace (const vector< Vec3f > &vertex_vector, const vector< Vec2f > &cross_section, vector< Vec3f > &yAxis, bool ccwcheck, H3DInt32 nrOfCrossSectionPoints, H3DInt32 nrOfSpinePoints, bool closedCrossSection, H3DInt32 &ifCapsAdd)
 Create a vector from the arguments given with one normal for each face specified.


Detailed Description

The Extrusion node specifies geometric shapes based on a two dimensional cross-section extruded along a three dimensional spine in the local coordinate system.

The cross-section can be scaled and rotated at each spine point to produce a wide variety of shapes.

Internal routes:
Extrusion.dot

Member Function Documentation

vector< Vec3f > Extrusion::generateNormalsPerFace ( const vector< Vec3f > &  vertex_vector,
const vector< Vec2f > &  cross_section,
vector< Vec3f > &  yAxis,
bool  ccwcheck,
H3DInt32  nrOfCrossSectionPoints,
H3DInt32  nrOfSpinePoints,
bool  closedCrossSection,
H3DInt32 ifCapsAdd 
) [protected]

Create a vector from the arguments given with one normal for each face specified.

References beginCap, calculateNormal(), endCap, H3D::X3D::Convert::getValue(), and H3DAbs().

Referenced by generateNormalsPerVertex().

void Extrusion::generateNormalsPerVertex ( vector< Vec3f > &  normalVector,
const vector< Vec3f > &  vertex_vector,
const vector< Vec2f > &  cross_section,
vector< Vec3f > &  yAxis,
bool  ccwcheck,
H3DInt32  nrOfCrossSectionPoints,
H3DInt32  nrOfSpinePoints,
bool  closedSpine,
H3DInt32 ifCapsAdd 
) [protected]

Create a vector from the arguments given with one normal for each vertex.

The normal for each vertex will be the average of the normal of all faces using that vertex.

References coinc(), findSurroundingFaces(), and generateNormalsPerFace().

void Extrusion::generateNormalsPerVertex ( vector< Vec3f > &  normalVector,
const vector< Vec3f > &  vertex_vector,
const vector< Vec2f > &  cross_section,
vector< Vec3f > &  yAxis,
bool  ccwcheck,
H3DInt32  nrOfCrossSectionPoints,
H3DInt32  nrOfSpinePoints,
bool  closedSpine,
H3DFloat  crease_angle,
H3DInt32 ifCapsAdd 
) [protected]

Create a vector from the arguments given with one normal for each vertex in each face, i.e.

the number of normals will be the number of facess *4

References beginCap, coinc(), endCap, findSurroundingFaces(), generateNormalsPerFace(), H3DAbs(), and H3DCos().

Referenced by render().

void Extrusion::traverseSG ( TraverseInfo ti  )  [virtual]

Traverse the scenegraph.

A HAPIHapticShape is added for haptic rendering if haptics is enabled.

Parameters:
ti The TraverseInfo object containing information about the traversal.

Reimplemented from H3D::X3DGeometryNode.

References solid, and H3D::X3DGeometryNode::useBackFaceCulling().


Member Data Documentation

When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.

If crossSection is not a closed curve, the caps are generated by adding a final point to crossSection that is equal to the initial point. An open surface can still have a cap, resulting (for a simple case) in a shape analogous to a soda can sliced in half vertically. These surfaces are generated even if spine is also a closed curve. If a field value is FALSE, the corresponding cap is not generated.

Access type: inputOutput
Default value: TRUE

Extrusion_beginCap.dot

Referenced by Extrusion(), findSurroundingFaces(), generateNormalsPerFace(), generateNormalsPerVertex(), and render().

The ccw field defines the ordering of the vertex coordinates of the geometry with respect to user-given or automatically generated normal vectors used in the lighting model equations.

If ccw is TRUE, the normals shall follow the right hand rule; the orientation of each normal with respect to the vertices (taken in order) shall be such that the vertices appear to be oriented in a counterclockwise order when the vertices are viewed (in the local coordinate system of the Shape) from the opposite direction as the normal. If ccw is FALSE, the normals shall be oriented in the opposite direction. If normals are not generated but are supplied using a Normal node, and the orientation of the normals does not match the setting of the ccw field, results are undefined.

Access type: inputOutput
Default value: TRUE

Extrusion_ccw.dot

Referenced by Extrusion(), and render().

The convex field indicates whether all polygons in the shape are convex (TRUE).

A polygon is convex if it is planar, does not intersect itself, and all of the interior angles at its vertices are less than 180 degrees. Non planar and self intersecting polygons may produce undefined results even if the convex field is FALSE.

Access type: inputOutput
Default value: TRUE

Extrusion_convex.dot

Referenced by Extrusion().

The creaseAngle field affects how default normals are generated.

If the angle between the geometric normals of two adjacent faces is less than the crease angle, normals shall be calculated so that the faces are shaded smoothly across the edge; otherwise, normals shall be calculated so that a lighting discontinuity across the edge is produced.

Access type: inputOutput
Default value: 0
Valid range: [0-inf]

Extrusion_creaseAngle.dot

Referenced by Extrusion(), and render().

A 2D crossSection piecewise linear curve (described as a series of connected vertices).

The cross-section can be scaled and rotated at each spine point to produce a wide variety of shapes.

Access type: inputOutput
Default value: [1 1 1 -1 -1 -1 -1 1 1 1]

Extrusion_crossSection.dot

Referenced by Extrusion(), and render().

When the beginCap or endCap fields are specified as TRUE, planar cap surfaces will be generated regardless of whether the crossSection is a closed curve.

If crossSection is not a closed curve, the caps are generated by adding a final point to crossSection that is equal to the initial point. An open surface can still have a cap, resulting (for a simple case) in a shape analogous to a soda can sliced in half vertically. These surfaces are generated even if spine is also a closed curve. If a field value is FALSE, the corresponding cap is not generated.

Access type: inputOutput
Default value: TRUE

Extrusion_endCap.dot

Referenced by Extrusion(), findSurroundingFaces(), generateNormalsPerFace(), generateNormalsPerVertex(), and render().

A list of 3D orientation parameters used to orient the crossSection.

If the number of orientation values is greater than the number of spine points, the excess values are ignored. If it contains one value, it is applied at all spine points. The results are undefined if the number of orientation values is greater than one but less than the number of spine points.

Access type: inputOutput
Default value: 0 0 1 0

Extrusion_orientation.dot

Referenced by Extrusion().

A list of 2D scale parameters used to scale the crossSection.

If the number of scale values is greater than the number of spine points, the excess values are ignored. If it contains one value, it is applied at all spine points. The results are undefined if the number of scale values is greater than one but less than the number of spine points.

Access type: inputOutput
Default value: 1 1

Extrusion_scale.dot

Referenced by Extrusion().

The solid field determines whether one or both sides of each polygon shall be displayed.

If solid is FALSE, each polygon shall be visible regardless of the viewing direction (i.e., no backface culling shall be done, and two sided lighting shall be performed to illuminate both sides of lit surfaces). If solid is TRUE, back face culling will be performed.

Access type: inputOutput
Default value: TRUE

Extrusion_solid.dot

Referenced by Extrusion(), and traverseSG().

A 3D spine piecewise linear curve (also described as a series of connected vertices).

Access type: inputOutput
Default value: [0 0 0 0 1 0]

Extrusion_spine.dot

Referenced by Extrusion(), and render().

The vector of vertices constructing the extrusion-shape Only accessable in C++.

Referenced by Extrusion(), and render().


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

Generated on Fri Nov 7 10:30:01 2008 for H3D API by  doxygen 1.5.7