Interface to the DAG node that gives access to faces.
Synopsis
#include <AlFaceNode.h>
class AlFaceNode : public AlCurveNode
AlFaceNode();
virtual ~AlFaceNode();
virtual AlObject* copyWrapper() const;
statusCode create( AlFace * );
virtual AlObjectType type() const;
AlFace* firstFace() const;
AlFace* firstFace(AlTM&) const;
statusCode addFace( AlFace* );
statusCode removeFace( AlFace* );
AlSurface* convertToTrimmedSurface( boolean = FALSE )const;
statusCode normal( double &, double &, double & ) const;
Description
AlFaceNode is the class used to access faces in the DAG. Faces can be created from scratch or read in from a wire file and
accessed via the firstFace() method. A Face is a collection of closed curves that all lie in the same plane. An AlFaceNode
points to an AlFace, which points to the next face in the collection and so on...
Add faces to the collection with the addFace() method and remove them with the removeFace() method. In order to access the
list of faces, you walk through the face list with AlFace methods nextFace() and prevFace().
There are two ways to delete an AlFaceNode. If the AlFaceNode::deleteObject() method is called, then this node’s AlFace objects
are all deleted. If this node only has one face and its deleteObject() method is called, then this node is deleted as well.
AlFaceNode::AlFaceNode()
Description
Constructs an AlFaceNode wrapper object.
AlFaceNode::~AlFaceNode()
Description
Deletes an AlFaceNode wrapper object.
AlObject* AlFaceNode::copyWrapper() const
Description
Returns an exact duplicate of this AlFaceNode wrapper.
statusCode AlFaceNode::create( AlFace *face )
Description
Allocates the DAG node for the AlFaceNode. It adds the given face as the first face of the face node.
Arguments
< face - the first face to belong under the AlFaceNode
Return Codes
sSuccess - the face node was created
sInvalidArgument - ’face’ was invalid or NULL
sAlreadyCreated - the face node was already created elsewhere
sInsufficientMemory - out of memory
sFailure - the face node could not be created
AlObjectType AlFaceNode::type() const
Description
Returns the class identifier kFaceNodeType.
AlFace* AlFaceNode::firstFace() const
Description
Returns the first face in the list of faces. Access the remainder of the faces in the list with AlFace methods. This method
returns NULL if the list is empty.
AlFace* AlFaceNode::firstFace(AlTM& tm) const
Description
Returns the first face in the list of faces. Access the remainder of the faces in the list with AlFace methods. This method
returns NULL if the list is empty. The AlTM will be updated with the faceNode’s TM if a face exists.
Arguments
> tm - the transformation matrix to be updated with the faceNode’s TM
statusCode AlFaceNode::addFace( AlFace* face )
Description
Adds a face to the end of the list of faces. The face must not already belong to another AlFaceNode.
Arguments
< face - AlFace to add to list of AlFaceNode’s faces
Return Codes
sSuccess - the face was successfully added to the list of faces
sInvalidArgument - ’face’ was invalid or NULL
sInvalidObject - the face node object was invalid
sFailure - an error occurred
statusCode AlFaceNode::removeFace( AlFace* alFace )
Description
Removes a face from the list of faces. This must not be the last face under the face node. When the face is removed from under
the face node, it is no longer part of the universe that would be stored. Any animation on the CVs of the face will be deleted,
and the CVs will be removed from any clusters or sets they are in.
Arguments
< alFace - the face to remove from the AlFaceNode’s list of faces
Return Codes
sSuccess - the face was removed from the list of faces
sInvalidArgument - ’alFace’ was invalid or NULL
sInvalidObject - the face node object was invalid
sFailure - an error occurred
AlSurface * AlFaceNode::convertToTrimmedSurface( boolean worldSpace ) const
Description
Returns an AlSurface that represents the AlFace geometry converted to a trimmed surface. Returns NULL if the AlFace geometry
is invalid for any reason. A trimmed surface will not be created if the AlFace curves are non-planar or intersecting. The
AlSurface created does NOT have a parent AlSurfaceNode. The AlSurface will be constructed in object space if worldSpace is
FALSE (the default) or in world space if worldSpace is TRUE. As well only the geometry information will be converted. Shader
information, and so on, will not be copied over to the new surface.
statusCode AlFaceNode::normal( double &x, double &y, double &z ) const
Description
Attempts to calculate the overall normal of all of the face curves in this face. If the faces are not coplanar, then sFailure
will be returned. This is an expensive function to execute.
Note that this function is implicitly called by convertToTrimmedSurface.
Arguments
> x,y,z, - the returned normal
Return Codes
sInvalidObject - the facenode was invalid
sFailure - the faces were not planar
sSuccess - the faces were planar and the normal was returned
sInsufficientMemory