KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
gr_parametric_frustum.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_Frustum_H
64 #define KJB_Frustum_H
65 
66 #include <vector>
67 #include <iosfwd>
68 
69 #include <inttypes.h>
70 
71 #include <gr_cpp/gr_polymesh.h>
73 
74 namespace kjb {
75 
76 
82 class Frustum : public kjb::Polymesh
83 {
84  public:
85 
90  Frustum
91  (
92  unsigned int inv,
93  double ix, double iy, double iz,
94  double iw, double il, double iratio_top_bottom, double ih,
95  double ipitch, double iyaw, double iroll
96  );
97 
98 
100  Frustum
101  (
102  const std::vector<kjb::Vector> & p
103  )
104  throw (kjb::Illegal_argument);
105 
106 
108  Frustum(const Frustum& p);
109 
110 
112  Frustum(const char* fname, unsigned int inv) throw (kjb::Illegal_argument,
113  kjb::IO_error);
114 
115 
117  Frustum(std::istream& in, unsigned int inv) throw (kjb::Illegal_argument,
118  kjb::IO_error);
119 
120 
122  virtual ~Frustum() { };
123 
124 
126  virtual Frustum& operator= (const Frustum& p);
127 
128 
130  virtual Frustum* clone() const;
131 
133  virtual void transform(const kjb::Matrix & M)
134  throw (kjb::Illegal_argument);
135 
136 
138  const kjb::Vector & get_point(size_t i) const
139  throw (kjb::Illegal_argument);
140 
141 
143  const kjb::Vector & get_center() const;
144 
149  virtual void add_face(const Polygon & face) throw (kjb::Illegal_argument);
150 
151 
153  virtual void read(std::istream& in) throw (kjb::IO_error,
155 
157  virtual void write(std::ostream& out) const
158  throw (kjb::IO_error);
159 
161  void set_points
162  (
163  unsigned int inv,
164  double ix, double iy, double iz,
165  double iw, double il, double iratio_top_bottom, double ih
166  );
167 
172  virtual unsigned int adjacent_face(unsigned int f, unsigned int e) const
174 
175  void draw_orientation_map() const;
176 
177 /* void draw_left_right_orientation_map() const;
178 
179  void draw_geometric_context_map() const;*/
180 
181  static int get_num_edges(int num_facets)
182  {
183  //KJB_THROW(kjb::Not_implemented);
184  return 0; //TODO implement
185  }
186 
187  static int get_edge_indexes
188  (
189  std::vector<int> & base_edge_indexes,
190  std::vector<int> & vertical_edge_indexes,
191  std::vector<int> & top_edge_indexes,
192  int num_facets
193  )
194  {
195  //TODO implement
196  //KJB_THROW(kjb::Not_implemented);
197  return 0;
198  }
199 
200  protected:
201 
203  unsigned int nv;
204 
206  std::vector<kjb::Vector > points;
207 
214 
215  private:
216 
221  Int_matrix _adjacency;
222 
226  void create_adjacency_matrix();
227 
228 };
229 
230 
231 }
232 
233 
234 #endif
unsigned int nv
number of vertices for the top(bottom) surface.
Definition: gr_parametric_frustum.h:203
frustum: a polyhedron of which each torso face is a trapezoid and the top and bottom surfaces are pol...
Definition: gr_parametric_frustum.h:82
const kjb::Vector & get_center() const
Returns the center vector for this frustum.
Definition: gr_parametric_frustum.cpp:393
void set_points(unsigned int inv, double ix, double iy, double iz, double iw, double il, double iratio_top_bottom, double ih)
reset the points of this Frustum
Definition: gr_parametric_frustum.cpp:572
Object thrown when an index argument exceeds the size of a container.
Definition: l_exception.h:399
virtual void write(std::ostream &out) const
Writes this frustum to an output stream.
Definition: gr_parametric_frustum.cpp:476
This class implements matrices, in the linear-algebra sense, restricted to integer-valued elements...
Definition: l_int_matrix.h:71
virtual Frustum * clone() const
Clones this frustum.
Definition: gr_parametric_frustum.cpp:366
kjb::Vector center
Center of this frustum.
Definition: gr_parametric_frustum.h:213
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
Abstract class of connected polygons (faces) forming a mesh.
virtual Frustum & operator=(const Frustum &p)
Copies a frustum into this one.
Definition: gr_parametric_frustum.cpp:353
Frustum(unsigned int inv, double ix, double iy, double iz, double iw, double il, double iratio_top_bottom, double ih, double ipitch, double iyaw, double iroll)
Constructs a frustum.
Definition: gr_parametric_frustum.cpp:127
virtual void add_face(const Polygon &face)
Adds a face to this Frustum -> Not implemented here, it will throw an exception, because the use of t...
Definition: gr_parametric_frustum.cpp:733
const kjb::Vector & get_point(size_t i) const
Returns an indexed point defining this Frustum.
Definition: gr_parametric_frustum.cpp:377
std::vector< kjb::Vector > points
Points defining this Frustum.
Definition: gr_parametric_frustum.h:206
static int get_edge_indexes(std::vector< int > &base_edge_indexes, std::vector< int > &vertical_edge_indexes, std::vector< int > &top_edge_indexes, int num_facets)
Definition: gr_parametric_frustum.h:188
virtual void read(std::istream &in)
Reads this frustum from an input stream.
Definition: gr_parametric_frustum.cpp:405
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
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 an efficient implementation to ...
Definition: gr_parametric_frustum.cpp:690
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
void draw_orientation_map() const
static int get_num_edges(int num_facets)
Definition: gr_parametric_frustum.h:181
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
virtual ~Frustum()
Deletes this frustum.
Definition: gr_parametric_frustum.h:122
get the indices of edges in each direction for i
Definition: APPgetLargeConnectedEdges.m:48
virtual void transform(const kjb::Matrix &M)
Transforms this frustum.
Definition: gr_parametric_frustum.cpp:540
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