KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gr_triangular_mesh.h
Go to the documentation of this file.
1 
34 /* =========================================================================== *
35 |
36 | Copyright (c) 1994-2008 by Kobus Barnard (author).
37 |
38 | Personal and educational use of this code is granted, provided that this
39 | header is kept intact, and that the authorship is not misrepresented, that
40 | its use is acknowledged in publications, and relevant papers are cited.
41 |
42 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
43 |
44 | Please note that the code in this file has not necessarily been adequately
45 | tested. Naturally, there is no guarantee of performance, support, or fitness
46 | for any particular task. Nonetheless, I am interested in hearing about
47 | problems that you encounter.
48 |
49 | Authors:
50 | Joseph Schlecht, Luca Del Pero
51 |
52 * =========================================================================== */
53 
63 #ifndef KJB_TRIANGULAR_MESH_H
64 #define KJB_TRIANGULAR_MESH_H
65 
66 #include <iosfwd>
67 #include <vector>
68 #include <inttypes.h>
69 
70 #include <m_cpp/m_vector.h>
71 #include <m_cpp/m_matrix.h>
72 #include <l_cpp/l_int_matrix.h>
73 
74 #include <gr_cpp/gr_polymesh.h>
75 
76 
77 namespace kjb {
78 
79 
86 {
87 
88 public:
91  : Polymesh()
92  {
94  };
95 
96 
98  Triangular_mesh(const char* fname) throw (kjb::Illegal_argument, kjb::IO_error);
99 
100 
102  Triangular_mesh(std::istream& in) throw (kjb::Illegal_argument, kjb::IO_error);
103 
104 
107 
108 
110  virtual Triangular_mesh& operator= (const Triangular_mesh& t);
111 
112 
114  virtual ~Triangular_mesh() {};
115 
117  virtual unsigned int adjacent_face(uint32_t i,uint32_t p) const
118  throw (Index_out_of_bounds);
119 
120 
122  void read(std::istream & in)
124 
125 
127  void write(std::ostream & ost)
128  const throw(kjb::IO_error);
129 
131  void write(const char *filename) const throw (IO_error);
132 
133 
135  virtual Triangular_mesh * clone() const;
136 
138  void create_adjacency_matrix() throw(KJB_error);
139 
141  void set_adjacency_matrix(const char* fname) throw(KJB_error);
142 
143  //virtual void add_face(const Polygon & face, uint32_t id) throw (kjb::Illegal_argument);
144 
145  virtual void add_face(const Polygon & face) throw (kjb::Illegal_argument);
146 
147 protected:
148 
156 
161 
162 };
163 
164 
165 }
166 
167 
168 #endif
Triangular_mesh()
Constructs a triangular mesh.
Definition: gr_triangular_mesh.h:90
Definition for the Int_matrix class, a thin wrapper on the KJB Int_matrix struct and its related func...
Definition for the Matrix class, a thin wrapper on the KJB Matrix struct and its related functionalit...
virtual ~Triangular_mesh()
Destructor of a triangular mesh.
Definition: gr_triangular_mesh.h:114
Object thrown when an index argument exceeds the size of a container.
Definition: l_exception.h:399
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
kjb::Int_matrix _adjacency
Face adjacency matrix.
Definition: gr_triangular_mesh.h:155
Triangular_mesh: a polygonal mesh of which each face is a triangle.
Definition: gr_triangular_mesh.h:85
virtual Triangular_mesh * clone() const
Clones this mesh.
Definition: gr_triangular_mesh.cpp:122
Abstract class of connected polygons (faces) forming a mesh.
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
void read(std::istream &in)
Reads this triangular mesh from an input stream.
Definition: gr_triangular_mesh.cpp:290
void set_adjacency_matrix(const char *fname)
Gets the adjacency matrix from a file and saves it in the class parameter.
Definition: gr_triangular_mesh.cpp:221
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
virtual unsigned int adjacent_face(uint32_t i, uint32_t p) const
Returns the face adjacent to another on a shared edge.
Definition: gr_triangular_mesh.cpp:137
virtual void add_face(const Polygon &face)
Definition: gr_triangular_mesh.cpp:153
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
void create_adjacency_matrix()
Finds the adjacency relationships between faces.
Definition: gr_triangular_mesh.cpp:161
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
virtual Triangular_mesh & operator=(const Triangular_mesh &t)
Copies a triangular mesh into this one.
Definition: gr_triangular_mesh.cpp:109
Object thrown when input or output fails.
Definition: l_exception.h:496
void write(std::ostream &ost) const
Writes this mesh to an output stream.
Definition: gr_triangular_mesh.cpp:270
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
bool _is_adjacency_consistent
Definition: gr_triangular_mesh.h:160