#include <polygon.h>
Inheritance diagram for Polygon:
Public Member Functions | |
bool | add_vertex (Point3D vertex) |
virtual bool | collides_with (const Ray &ray, double &t) const |
virtual Ray | get_normal (const Point3D &p) const |
Returns the surface normal at point p. | |
Polygon (std::string color, std::string material, std::string bumpmap) | |
Creates a new plane defined by three points in 3-space. | |
virtual | ~Polygon () |
Protected Attributes | |
float | m_d |
Ray | m_normal |
std::vector< Point3D > | m_vertices |
Static Protected Attributes | |
static StaticInit | m_init |
Force static initialization. | |
Classes | |
class | StaticInit |
Fake a static initializer. More... |
Definition at line 19 of file polygon.h.
Polygon::Polygon | ( | std::string | color, | |
std::string | material, | |||
std::string | bumpmap | |||
) |
Creates a new plane defined by three points in 3-space.
Definition at line 16 of file polygon.cpp.
References Scene::get_bumpmap(), Scene::get_instance(), Scene::get_material(), Renderable::m_bumpmap, and Renderable::m_material.
Here is the call graph for this function:
bool Polygon::add_vertex | ( | Point3D | vertex | ) |
Adds the vertex to the polygon. The vertex must be coplanar to be added.
vertex | The vertex to add to the polygon. |
Definition at line 27 of file polygon.cpp.
References cross_product(), Ray::direction(), dot_product(), log_warn, m_d, m_normal, and m_vertices.
Referenced by new_polygon().
Here is the call graph for this function:
Here is the caller graph for this function:
bool Polygon::collides_with | ( | const Ray & | ray, | |
double & | t | |||
) | const [virtual] |
Does the ray passed in collide with this polygon?
ray | The ray which is being traced. | |
t | This is z-depth at which the ray collides with the polygon. |
Implements Renderable.
Definition at line 62 of file polygon.cpp.
References cross_product(), Ray::direction(), dot_product(), m_d, m_normal, m_vertices, and Ray::origin().
Here is the call graph for this function:
Returns the surface normal at point p.
Implements Renderable.
Definition at line 191 of file polygon.cpp.
References Ray::direction(), and m_normal.
Here is the call graph for this function:
float Polygon::m_d [protected] |
Polygon::StaticInit Polygon::m_init [static, protected] |
Ray Polygon::m_normal [protected] |
The normal of a polygon is always the same so this stores it so we only have to calculate it once.
Definition at line 36 of file polygon.h.
Referenced by add_vertex(), collides_with(), and get_normal().
std::vector<Point3D> Polygon::m_vertices [protected] |
This is the list of vertices of this polygon. All vertices in a polygon must be coplanar.
Definition at line 41 of file polygon.h.
Referenced by add_vertex(), and collides_with().