64 #ifndef KJB_POLYMESH_H
65 #define KJB_POLYMESH_H
81 class Base_gl_interface;
133 const std::vector<kjb::Polygon>&
get_faces()
const;
162 virtual void read(std::istream & in)
167 virtual void write(std::ostream & ost)
171 virtual void write(
const char *filename)
const throw (
IO_error);
178 virtual
void translate(
double x,
double y,
double z);
181 virtual
void rotate(
double phi,
double x,
double y,
double z);
183 virtual
void rotate(
double dpitch,
double dyaw,
double droll)
189 virtual void scale(
double scale_x,
double scale_y,
double scale_z);
197 virtual unsigned int adjacent_face(
unsigned int f,
unsigned int e)
const
200 void get_faces(std::vector<const Polygon *> & ifaces)
const;
void find_bounds()
Definition: gr_polymesh.cpp:766
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
virtual void translate(double x, double y, double z)
Translates this rigid object.
Definition: gr_polymesh.cpp:314
const std::vector< kjb::Polygon > & get_faces() const
Returns the faces of this mesh.
Definition: gr_polymesh.cpp:202
function lines
Definition: APPgetLargeConnectedEdges.m:1
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
Object thrown when an index argument exceeds the size of a container.
Definition: l_exception.h:399
kjb::Vector get_center()
Definition: gr_polymesh.cpp:816
Vector smallest_bounds
Definition: gr_polymesh.h:294
unsigned int num_faces() const
Returns the number of faces in this mesh.
Definition: gr_polymesh.cpp:359
const kjb::Polygon & get_face(unsigned int i) const
Returns an indexed face.
Definition: gr_polymesh.cpp:173
virtual void transform(const kjb::Matrix &)
Applies a linear transformation to this parallelepiped.
Definition: gr_polymesh.cpp:292
virtual void silhouette_render(const kjb::Base_gl_interface &camera, double iwidth=1.0) const
Definition: gr_polymesh.cpp:592
bool edge_index_in_polygon(const Polygon &f1, unsigned int e, const Polygon &f2, unsigned int &index)
Definition: gr_polymesh.cpp:482
virtual void wire_occlude_render() const
Renders this mesh as a wire frame into the depth buffer. Use wire_render after this to render this me...
Definition: gr_polymesh.cpp:517
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
std::vector< kjb::Polygon > _faces
Polygons defining the mesh.
Definition: gr_polymesh.h:293
double get_largest_z_bound()
Definition: gr_polymesh.cpp:833
Definition: gr_polymesh_renderer.h:33
kjb::Polygon & get_face_ref(unsigned int i)
Returns an indexed face.
Definition: gr_polymesh.cpp:191
Vector largest_bounds
Definition: gr_polymesh.h:295
virtual void wire_render() const
Renders this mesh as a wire frame.
Definition: gr_polymesh.cpp:503
virtual Polymesh & operator=(const Polymesh &t)
Copies a triangular mesh into this one.
Definition: gr_polymesh.cpp:138
unsigned int wire_render_with_sequential_ids(unsigned int start_id=1) const
Render each edge of this polymesh with a different color. The first edge will be rendered using the i...
Definition: gr_polymesh.cpp:554
virtual unsigned int adjacent_face(unsigned int f, unsigned int e) const
returns the index of the face adjacent to face f along edge e This is a very inefficient implementati...
Definition: gr_polymesh.cpp:243
Abstract class to render this object with GL.
Definition: gr_renderable.h:151
Polymesh()
Constructs a triangular mesh.
Definition: gr_polymesh.h:97
virtual void project()
Definition: gr_polymesh.cpp:612
x
Definition: APPgetLargeConnectedEdges.m:100
virtual ~Polymesh()
Deletes this Polymesh.
Definition: gr_polymesh.cpp:160
virtual void scale(double scale_x, double scale_y, double scale_z)
Definition: gr_polymesh.cpp:345
virtual void solid_render() const
Renders this object with GL as a wire-frame.
Definition: gr_polymesh.cpp:531
Definition: gr_polygon.h:36
Abstract class of connected polygons (faces) forming a mesh. We assume that each edge is shared betwe...
Definition: gr_polymesh.h:89
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
double compute_surface_area() const
Returns the surface area of the mesh.
Definition: gr_polymesh.cpp:631
void get_lines(std::vector< Line3d > &lines)
Definition: gr_polymesh.cpp:723
Definition: gr_camera.h:103
kjb::Vector get_largest_bounds() const
Definition: gr_polymesh.cpp:842
virtual void add_face(const Polygon &face)
Definition: gr_polymesh.cpp:222
bool is_shared_edge(const Polygon &f1, unsigned int e1, const Polygon &f2, unsigned int e2) const
Checks whether edge e1 on face f1 is the same as edge e2 on face f2.
Definition: gr_polymesh.cpp:451
virtual void rotate(double dpitch, double dyaw, double droll)
rotate this object around its x-axis by dpitch, the y-axis by dyaw, and its z-axis by droll (in this ...
Definition: gr_rigid_object.cpp:105
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
virtual void read(std::istream &in)
Reads this polymesh from an input stream.
Definition: gr_polymesh.cpp:429
unsigned int solid_render_with_sequential_ids(unsigned int start_id=1) const
Render each polygon of this polymesh with a different color. The first polygon will be rendered using...
Definition: gr_polymesh.cpp:569
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
edges
Definition: APPgetLargeConnectedEdges.m:85
Object thrown when input or output fails.
Definition: l_exception.h:496
This class implements matrices, in the linear-algebra sense, with real-valued elements.
Definition: m_matrix.h:94
Support for error handling exception classes in libKJB.
Definition: gr_rigid_object.h:87
bool is_same_vertex(const kjb::Vector &p1, const kjb::Vector &p2) const
Compares two points.
Definition: gr_polymesh.h:298
kjb::Vector get_smallest_bounds() const
Definition: gr_polymesh.cpp:851
void get_all_edges(std::vector< std::vector< Vector > > &edges) const
Stores all of the unique pairs of points that make up the edges of the polymesh in a vector...
Definition: gr_polymesh.cpp:678
virtual void rotate(double phi, double x, double y, double z)
Definition: gr_polymesh.cpp:330
virtual Polymesh * clone() const
Clones this mesh.
Definition: gr_polymesh.cpp:154
virtual void write(std::ostream &ost) const
Writes this mesh to an output stream.
Definition: gr_polymesh.cpp:402
void get_all_vertices(std::vector< Vector > &vertices) const
Stores the vertices of the mesh in a vector.
Definition: gr_polymesh.cpp:645