21 #ifndef POLYGON_H_INCLUDED
22 #define POLYGON_H_INCLUDED
34 typedef std::pair<kjb::Vector, kjb::Vector>
Line3d;
150 return pts[ ( ( edge + 1 ) % n_pts ) ];
unsigned int get_num_points() const
returns the number of vertices of this polygon
Definition: gr_polygon.h:97
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
virtual void wire_render() const
Renders this polygon as a wireframe.
Definition: gr_polygon.cpp:646
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
bool normal_flipped
Definition: gr_polygon.h:208
function lines
Definition: APPgetLargeConnectedEdges.m:1
double compute_area() const
Computes the area of this polygon if it is convex.
Definition: gr_polygon.cpp:821
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
const Vector & get_edge_second_vertex(unsigned int edge) const
This function is useful when we index a polygon by its edges. In a Polygon with n vertices...
Definition: gr_polygon.h:142
virtual Polygon * clone() const
Definition: gr_polygon.cpp:144
Object thrown when an index argument exceeds the size of a container.
Definition: l_exception.h:399
height
Definition: APPgetLargeConnectedEdges.m:33
#define KJB_THROW(ex)
Definition: l_exception.h:46
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
int get_index_of_longest_edge() const
Returns the index of the longest edge in the polygon.
Definition: gr_polygon.cpp:934
bool check_convexity() const
Checks that this polygon is convex.
Definition: gr_polygon.cpp:757
virtual void project()
Projects all the vertices in this polygon onto the image plane.
Definition: gr_polygon.cpp:688
void get_lines(std::vector< Line3d > &lines) const
Definition: gr_polygon.cpp:959
const Vector & get_normal() const
Returns the normal of this polygon.
Definition: gr_polygon.h:82
Abstract class to render this object with GL.
Definition: gr_renderable.h:151
bool check_polygon_is_right_triangle(double tolerance) const
Checks if this polygon is a right triangle.
Definition: gr_polygon.cpp:877
Vector centroid
Definition: gr_polygon.h:205
virtual void read(std::istream &in)
Definition: gr_polygon.cpp:156
void fit_plane(Vector &plane_params) const
Finds the coefficients of the plane that this polygon lies in.
Definition: gr_polygon.cpp:725
x
Definition: APPgetLargeConnectedEdges.m:100
const Vector & get_centroid() const
returns the centroid of this polygon
Definition: gr_polygon.h:91
Definition: gr_polygon_renderer.h:32
Polygon()
Constructs a polygon with zero vertices.
Definition: gr_polygon.cpp:31
virtual void transform(const Matrix &M)
transforms all the vertices by the input matrix
Definition: gr_polygon.cpp:413
virtual void wire_occlude_render() const
Renders this polygon in the depth buffer.
Definition: gr_polygon.cpp:660
Definition: gr_polygon.h:36
virtual void write(std::ostream &out) const
Definition: gr_polygon.cpp:286
void update()
Updates the normal and the centroid of the polygon according to the vertices.
Definition: gr_polygon.h:184
void get_all_vertices(std::vector< Vector > &vertices) const
Stores all of the vertices of this polygon in a vector.
Definition: gr_polygon.cpp:860
std::vector< Vector > pts
Definition: gr_polygon.h:203
Vector normal
Definition: gr_polygon.h:204
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
virtual ~Polygon()
Definition: gr_polygon.cpp:95
std::pair< kjb::Vector, kjb::Vector > Line3d
Definition: gr_polygon.h:34
void add_point(const Vector &pt)
Adds a point to this polygon.
Definition: gr_polygon.cpp:462
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
void flip_normal()
Flips the normal of this polygon.
Definition: gr_polygon.cpp:506
Object thrown when input or output fails.
Definition: l_exception.h:496
const Vector & get_edge_first_vertex(unsigned int edge) const
This function is useful when we index a polygon by its edges. In a Polygon with n vertices...
Definition: gr_polygon.h:127
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
const Vector & get_point(unsigned int i) const
returns the ith point of this polygon
Definition: gr_polygon.h:103
virtual Polygon & operator=(const Polygon &p)
Definition: gr_polygon.cpp:107
const std::vector< Vector > & get_vertices() const
returns the vector of vertices
Definition: gr_polygon.h:114
void set_point(double index, double x, double y, double z)
Resets one of the points in this polygon.
Definition: gr_polygon.h:74
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
virtual void solid_render() const
Renders this polygon as a solid.
Definition: gr_polygon.cpp:674
void update_centroid()
Recalculates the centroid of this polygon.
Definition: gr_polygon.cpp:554
void clear()
Clears all the vertices.
Definition: gr_polygon.h:88
void update_normal()
Recalculates the normal of this polygon. The first three vertices are used. Notice that this is very ...
Definition: gr_polygon.cpp:519