Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Teddy::Models::Face Class Reference

Ordered collection of vertices to define a polygon. More...

#include <Face.h>

Inheritance diagram for Teddy::Models::Face:

Inheritance graph
[legend]
Collaboration diagram for Teddy::Models::Face:

Collaboration graph
[legend]
List of all members.

Public Methods

 Face ()
 Face constructor. More...

virtual ~Face ()
 Virtual destructor. More...

virtual void add (const float x, const float y, const float z)
 Insert a vertex to the face, component version. More...

virtual void add (Vertex *v)
 Insert a vertex to the face, pointer version. More...

virtual void append (const float x, const float y, const float z)
 Insert a vertex to the face - pointer version, reverse order. More...

virtual void append (Vertex *v)
 Insert a vertex to the face - pointer version, reverse order. More...

virtual void draw (Projection *p)
 Drawing a Face Element. More...

virtual void smooth (float max_smoothing_angle)

Detailed Description

Ordered collection of vertices to define a polygon.

Face Element is a polygon. The polygon is defined by edge vertices. Care must be taken to insert or append (and maintain) vertices in counterclockwise (IIRC) order for backfaceculling to work.

Definition at line 45 of file Face.h.


Constructor & Destructor Documentation

Teddy::Models::Face::Face  
 

Face constructor.

Definition at line 44 of file Face.cpp.

Referenced by smooth.

Teddy::Models::Face::~Face   [virtual]
 

Virtual destructor.

Definition at line 51 of file Face.cpp.


Member Function Documentation

void Teddy::Models::Face::add Vertex   v [virtual]
 

Insert a vertex to the face, pointer version.

Reimplemented from Teddy::Models::Element.

Definition at line 56 of file Face.cpp.

References Teddy::Models::Element::vertices.

void Teddy::Models::Face::add const float    x,
const float    y,
const float    z
[virtual]
 

Insert a vertex to the face, component version.

Reimplemented from Teddy::Models::Element.

Definition at line 63 of file Face.cpp.

References Teddy::Models::Element::vertices.

void Teddy::Models::Face::append Vertex   v [virtual]
 

Insert a vertex to the face - pointer version, reverse order.

Reimplemented from Teddy::Models::Element.

Definition at line 71 of file Face.cpp.

References Teddy::Models::Element::vertices.

void Teddy::Models::Face::append const float    x,
const float    y,
const float    z
[virtual]
 

Insert a vertex to the face - pointer version, reverse order.

Reimplemented from Teddy::Models::Element.

Definition at line 78 of file Face.cpp.

References Teddy::Models::Element::vertices.

void Teddy::Models::Face::draw Projection *    p [virtual]
 

Drawing a Face Element.

Implements Teddy::Models::Element.

Definition at line 86 of file Face.cpp.

References Teddy::SysSupport::dmsg, Teddy::Models::Element::EL_HAS_ELEMENT_NORMAL, Teddy::Models::Element::EL_USE_ELEMENT_NORMAL, Teddy::MixIn::Options::isEnabled, Teddy::SysSupport::M_MAT, Teddy::Models::Element::normal, and Teddy::Models::Element::vertices.

void Teddy::Models::Face::smooth float    max_smoothing_angle [virtual]
 

Smooth face normals.

Adjacent faces which normal difference is less or equal than max smoothing angle participate to the smoothed vertex normals.

If the specified max smoothing angle is less or equal to zero, smoothing will not be done.

If all adjacent faces either have normal difference more than the max smoothing angle or have equal normal, the face will remain Flat.

This process calculates a normal for each vertex in the Face.

If the existing Vertex has no normal set, the normal will set to existing Vertex.

If the Vertex normal is already set to the same value, the Vertex will not be changed.

If the Vertex has a different normal set it means that the Vertex is shared with some other Face which has already been processed. In this case a new Vertex will be created, and it will point to the old Vertex, or parent of the old Vertex, if it has such. The new normal will be set to the new Vertex.

Reimplemented from Teddy::Models::Element.

Definition at line 136 of file Face.cpp.

References Teddy::MixIn::Options::disable, Teddy::SysSupport::dmsg, Teddy::Models::Element::EL_HAS_ELEMENT_NORMAL, Teddy::Models::Element::EL_USE_ELEMENT_NORMAL, Teddy::Models::Element::EL_USE_VERTEX_NORMALS, Teddy::SysSupport::emsg, Teddy::MixIn::Options::enable, Face, FACE_NORMAL_EPSILON, Teddy::Models::Element::getNormal, Teddy::MixIn::Options::isDisabled, Teddy::SysSupport::M_MAT, Teddy::SysSupport::M_VERT, Teddy::Models::Element::makeNormal, Teddy::Models::Element::normal, Vector, Teddy::Models::Element::vertices, and Teddy::Models::Element::VX_HAS_NORMAL.


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