Inherits DD::Image::PolygonPrimitive.
Public Member Functions | |
const char * | Class () const |
Polygon (unsigned vertices, bool closed) | |
Polygon (int p0, int p1, bool closed) | |
Polygon (int p0, int p1, int p2, bool closed) | |
Polygon (int p0, int p1, int p2, int p3, bool closed) | |
Polygon (const Polygon &) | |
Polygon & | operator= (const Polygon &b) |
Primitive * | duplicate () const |
bool | closed () const |
void | closed (bool v) |
bool | IntersectsRay (const Ray &ray, int n, const PointList *pointList, CollisionResult *result) const |
void | validate (PrimitiveContext *) |
void | tessellate (Scene *, PrimitiveContext *) const |
unsigned | faces () const |
void | draw_wireframe (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=0) const |
void | draw_solid (ViewerContext *, PrimitiveContext *, Primitive *prev_prim=0) const |
void | draw_solid_face (int n, ViewerContext *, PrimitiveContext *) const |
void | draw_primitive_num (ViewerContext *, PrimitiveContext *) const |
void | draw_primitive_normal (ViewerContext *, PrimitiveContext *) const |
void | print_info () const |
PrimitiveType | getPrimitiveType () const |
Protected Member Functions | |
void | copy (const Polygon *) |
Protected Attributes | |
bool | closed_ |
Polygon primtive class consisting of n vertices. Can be defined as open or closed. If closed, the edge between the first and last vertex is added. All vertices must be coplanar otherwise unpredictable results will occur.
void Polygon::copy | ( | const Polygon * | b | ) | [protected] |
Destructive copy.
References DD::Image::Primitive::normal_.
Primitive * Polygon::duplicate | ( | ) | const [virtual] |
Copy this Polygon into a new one, and return a pointer to it. Vertex data is duplicated, point indices are unchanged.
Implements DD::Image::Primitive.
bool DD::Image::Polygon::closed | ( | ) | const [inline] |
Indicated whether the polygon is open or closed. If closed, the edge between the first and last vertex is added.
bool DD::Image::Polygon::IntersectsRay | ( | const Ray & | ray, |
int | n, | ||
const PointList * | pointList, | ||
CollisionResult * | result | ||
) | const [inline, virtual] |
Test for the intersection of this primitive with a given ray .
Reimplemented from DD::Image::Primitive.
References DD::Image::Primitive::PolyIntersectsRay().
void Polygon::tessellate | ( | Scene * | scene, |
PrimitiveContext * | ptx | ||
) | const [virtual] |
Subdivide the polygon into triangles and add them to the rendering pipeline.
Reimplemented from DD::Image::PolygonPrimitive.
void Polygon::draw_solid_face | ( | int | n, |
ViewerContext * | ctx, | ||
PrimitiveContext * | ptx | ||
) | const [virtual] |
Draw the single face as a filled polygon.
Reimplemented from DD::Image::Primitive.