KJB
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
st_parapiped.h
Go to the documentation of this file.
1 
35 /* =========================================================================== *
36 |
37 | Copyright (c) 1994-2008 by Kobus Barnard (author).
38 |
39 | Personal and educational use of this code is granted, provided that this
40 | header is kept intact, and that the authorship is not misrepresented, that
41 | its use is acknowledged in publications, and relevant papers are cited.
42 |
43 | For other use contact the author (kobus AT cs DOT arizona DOT edu).
44 |
45 | Please note that the code in this file has not necessarily been adequately
46 | tested. Naturally, there is no guarantee of performance, support, or fitness
47 | for any particular task. Nonetheless, I am interested in hearing about
48 | problems that you encounter.
49 |
50 | Authors:
51 | Luca Del Pero
52 |
53 * =========================================================================== */
54 
55 
69 #ifndef ST_PARAPIPED_H_
70 #define ST_PARAPIPED_H_
71 
72 #include <gr_cpp/gr_parapiped.h>
73 #include <g_cpp/g_quaternion.h>
74 #include <m_cpp/m_vector.h>
77 
78 #define ST_PARAPIPED_PITCH 0
79 #define ST_PARAPIPED_YAW 1
80 #define ST_PARAPIPED_ROLL 2
81 #define ST_PARAPIPED_DISTANCE_FROM_THE_FLOOR 0.002
82 
83 namespace kjb
84 {
85 
86 class Perspective_camera;
87 class Manhattan_corner;
88 class Vanishing_point;
89 
100 {
101 public:
102 
103  Parametric_parapiped(double ix = 0.0, double iy = 0.0, double iz = 0.0, double iw = 1.0, double ih = 1.0, double il = 1.0,
104  double ipitch = 0.0, double iyaw = 0.0, double iroll = 0.0) throw(kjb::Illegal_argument);
105 
107  Parametric_parapiped(const char* fname) throw (kjb::Illegal_argument,
108  kjb::IO_error);
109 
111  Parametric_parapiped(std::istream& in) throw (kjb::Illegal_argument,
112  kjb::IO_error);
113 
116 
118  virtual void read(std::istream& in) throw (kjb::Illegal_argument,
119  kjb::IO_error);
120 
122  virtual void read(const char * fname) throw (kjb::IO_error, kjb::Illegal_argument)
123  {
124  Readable::read(fname);
125  }
126 
128  virtual void write(std::ostream& out) const
129  throw (kjb::IO_error);
130 
132  virtual void write(const char * fname) const
133  throw (kjb::IO_error)
134  {
135  Writeable::write(fname);
136  }
137 
140 
143  {
145  return rendering_interface;
146  }
147 
152  virtual void update_rendering_representation() const throw(kjb::KJB_error);
153 
154  virtual Parametric_parapiped * clone() const;
155  virtual ~Parametric_parapiped() { }
156 
158  inline double get_width() const {return width; }
160  inline double get_height() const {return height; }
162  inline double get_length() const {return length; }
163 
165  inline double get_pitch() const {return rotation_angles(ST_PARAPIPED_PITCH);}
167  inline double get_yaw() const {return rotation_angles(ST_PARAPIPED_YAW);}
169  inline double get_roll() const {return rotation_angles(ST_PARAPIPED_ROLL);}
170 
172  inline const Vector & get_centre() const {return centre;}
174  inline double get_centre_x() const {return centre(0); }
176  inline double get_centre_y() const {return centre(1); }
178  inline double get_centre_z() const {return centre(2); }
179 
181  void set_width(double iwidth) throw(kjb::Illegal_argument);
183  void set_height(double iheight) throw(kjb::Illegal_argument);
185  void set_length(double ilength)throw(kjb::Illegal_argument);
186 
188  void set_pitch(double ip);
190  void set_yaw(double iy);
192  void set_roll(double ir);
193 
195  virtual void rotate_around_x_axis(double theta);
196 
198  virtual void rotate_around_y_axis(double theta);
199 
201  virtual void rotate_around_z_axis(double theta);
202 
204  virtual void rotate_around_parapiped_axes(double thetax, double thetay, double thetaz);
205 
207  void set_centre(const kjb::Vector & icentre) throw(kjb::Illegal_argument);
209  void set_centre_x(double ix) throw(kjb::Illegal_argument);
211  void set_centre_y(double iy) throw(kjb::Illegal_argument);
213  void set_centre_z(double iz) throw(kjb::Illegal_argument);
214 
216  virtual void set_angles_from_quaternion(const kjb::Quaternion & q);
217 
220  {
222  return rendering_interface.get_orientation();
223  }
224 
234  {
235  KJB(UNTESTED_CODE());
236  rendering_interface.set_rotation_mode(imode);
237  }
238 
239  void stretch_along_axis(unsigned int axis, double amount, bool direction);
240 
245  (
246  const kjb::Vector & point_in_world_coordinates,
247  kjb::Vector & point_in_parapiped_coordinates
248  ) const;
249 
253  (
254  const kjb::Vector & point_in_parapiped_coordinates,
255  kjb::Vector & point_in_world_coordinates
256  ) const;
257 
258  void draw_orientation_map() const;
259 
260  void draw_left_right_orientation_map() const;
261 
262  void draw_CMU_orientation_map() const;
263 
264  void draw_geometric_context_map() const;
265 
266  void get_lines(std::vector<Line3d> & lines);
267 
268  void get_vertices(std::vector<Vector> & vertices);
269 
271  {
272  return Parapiped::get_num_edges();
273  }
274 
276  (
277  std::vector<int> & base_edge_indexes,
278  std::vector<int> & vertical_edge_indexes,
279  std::vector<int> & top_edge_indexes
280  )
281  {
282  Parapiped::get_edge_indexes(base_edge_indexes,
283  vertical_edge_indexes, top_edge_indexes);
284  }
285 
286 private:
287 
290  void compute_new_euler_angles_on_rotations(double dpitch, double dyaw, double droll);
291 
292  double width;
293  double height;
294  double length;
295 
296  kjb::Vector centre;
297 
298  /* The rotation angle around the object's x axis (pitch), the
299  * object's y axis (yaw) and the object's z axis (roll). Stored
300  * in this order */
301  kjb::Vector rotation_angles;
302 
306  mutable Parapiped rendering_interface;
307 
308 };
309 
311 (
313  kjb::Perspective_camera & camera,
314  const kjb::Manhattan_corner & corner,
315  double focal_length,
316  unsigned int num_rows,
317  unsigned int num_cols,
318  double corner_3D_z_position,
319  double p_width_ratio,
320  double p_height_ratio,
321  double p_length_ratio
322 );
323 
325 (
326  kjb::Vector & centre,
327  kjb::Vector & dimensions,
328  kjb::Vector & expansion_deltas,
329  std::vector<bool> & expansion_directions,
330  Parametric_parapiped & new_pp,
331  const Parametric_parapiped &pp,
332  const Perspective_camera & camera,
333  const Manhattan_corner & corner,
334  const kjb::Vector & imin_desired_dimensions,
335  unsigned int num_rows,
336  unsigned int num_cols,
337  double distance_from_camera,
338  bool expand_room = true
339 );
340 
342 (
343  kjb::Vector & centre,
344  kjb::Vector & dimensions,
345  kjb::Vector & expansion_deltas,
346  std::vector<bool> & expansion_directions,
347  unsigned int & face_number,
348  Parametric_parapiped & new_pp,
349  const Parametric_parapiped &pp,
350  const Perspective_camera & camera,
351  const Manhattan_corner & corner,
352  const kjb::Vector & idesired_dimensions,
353  unsigned int num_rows,
354  unsigned int num_cols
355 );
356 
358 (
359  kjb::Vector & centre,
360  kjb::Vector & dimensions,
361  kjb::Vector & expansion_deltas,
362  std::vector<bool> & expansion_directions,
363  unsigned int & face_number,
364  Parametric_parapiped & new_pp,
365  const Parametric_parapiped &pp,
366  const Perspective_camera & camera,
367  const Manhattan_corner & corner,
368  const kjb::Vector & idesired_dimensions,
369  unsigned int num_rows,
370  unsigned int num_cols,
371  bool wall_x,
372  bool expand_to_the_ground
373 );
374 
378 (
379  kjb::Vector & centre,
380  kjb::Vector & dimensions,
381  kjb::Vector & expansion_deltas,
382  std::vector<bool> & expansion_directions,
383  Parametric_parapiped & new_pp,
384  const Parametric_parapiped & pp,
385  const Perspective_camera & camera,
386  const Manhattan_corner & corner,
387  const kjb::Vector & imin_desired_dimensions,
388  unsigned int num_rows,
389  unsigned int num_cols,
390  double distance_from_camera,
391  bool expand_room // if it is allowed to expand the room box
392 );
393 
395 (
396  kjb::Vector & centre,
397  kjb::Vector & dimensions,
398  Parametric_parapiped & new_pp,
399  const Parametric_parapiped & pp,
400  const Perspective_camera & camera,
401  const Manhattan_corner & corner,
402  const kjb::Vector & imin_desired_dimensions,
403  unsigned int num_rows,
404  unsigned int num_cols,
405  double distance_from_camera,
406  bool expand_sp_obj, // if it is allowed to expand the supporting object
407  kjb::Vector & sp_obj_centre, // centre of the supporting object
408  kjb::Vector & sp_obj_dimensions // dimensions of the supporting object
409 );
410 
412 (
413  kjb::Vector & centre,
414  kjb::Vector & dimensions,
415  //kjb::Vector & expansion_deltas,
416  //st::vector<bool> & expansion_directions,
417  Parametric_parapiped & new_pp,
418  const Parametric_parapiped & pp,
419  const Perspective_camera & camera,
420  const Manhattan_corner & corner,
421  const kjb::Vector & imin_desired_dimensions,
422  unsigned int num_rows,
423  unsigned int num_cols,
424  double distance_from_camera,
425  bool expand_sp_obj, // if it is allowed to expand the supporting object
426  /*bool expand_right,
427  bool expand_z_up,
428  bool expand_towards_camera,*/
429  kjb::Vector & sp_obj_centre, // centre of the supporting object
430  kjb::Vector & sp_obj_dimensions // dimensions of the supporting object
431 );
432 
434 (
435  kjb::Vector & centre,
436  kjb::Vector & dimensions,
437  kjb::Vector & expansion_deltas,
438  std::vector<bool> & expansion_directions,
439  Parametric_parapiped & new_pp,
440  const Parametric_parapiped &pp,
441  const Perspective_camera & camera,
442  const Manhattan_corner & corner,
443  const kjb::Vector & imin_desired_dimensions,
444  unsigned int num_rows,
445  unsigned int num_cols,
446  double distance_from_camera,
447  bool expand_room,
448  bool expand_right,
449  bool expand_z_up,
451 );
452 
454 (
455  kjb::Vector & centre,
456  kjb::Vector & dimensions,
457  kjb::Vector & expansion_deltas,
458  std::vector<bool> & expansion_directions,
459  Parametric_parapiped & new_pp,
460  const Parametric_parapiped &pp,
461  const Perspective_camera & camera,
462  const Manhattan_corner & corner1,
463  const Manhattan_corner & corner2,
464  const Manhattan_corner & corner3,
465  double desired_height,
466  unsigned int num_rows,
467  unsigned int num_cols,
468  double base_height
469 );
470 
472 (
473  kjb::Vector & centre,
474  kjb::Vector & dimensions,
475  kjb::Vector & expansion_deltas,
476  std::vector<bool> & expansion_directions,
477  Parametric_parapiped & new_pp,
478  const Parametric_parapiped &pp,
479  const Perspective_camera & camera,
480  const Manhattan_corner & corner1,
481  const Manhattan_corner & corner2,
482  const Manhattan_corner & corner3,
483  double desired_height,
484  unsigned int num_rows,
485  unsigned int num_cols
486 );
487 
489 (
490  kjb::Vector & centre,
491  kjb::Vector & dimensions,
492  kjb::Vector & expansion_deltas,
493  std::vector<bool> & expansion_directions,
494  Parametric_parapiped & new_pp,
495  const Parametric_parapiped &pp,
496  const Perspective_camera & camera,
497  const Manhattan_corner & corner1,
498  const Manhattan_corner & corner2,
499  double desired_height,
500  double desired_other_dimension_ratio,
501  bool direction,
502  bool & is_diagonal,
503  bool & is_dx,
504  unsigned int num_rows,
505  unsigned int num_cols
506 );
507 
509 (
510  kjb::Vector & centre,
511  kjb::Vector & dimensions,
512  Parametric_parapiped & new_pp,
513  const Parametric_parapiped & pp,
514  const Perspective_camera & camera,
515  const Manhattan_corner & corner,
516  const kjb::Vector & imin_desired_dimensions,
517  unsigned int num_rows,
518  unsigned int num_cols,
519  double distance_from_camera,
520  bool expand_sp_obj, // if it is allowed to expand the supporting object
521  kjb::Vector & sp_obj_centre, // centre of the supporting object
522  kjb::Vector & sp_obj_dimensions // dimensions of the supporting object
523 );
524 
526 (
527  kjb::Vector & centre,
528  kjb::Vector & dimensions,
529  kjb::Vector & expansion_deltas,
530  std::vector<bool> & expansion_directions,
531  Parametric_parapiped & new_pp,
532  const Parametric_parapiped &pp,
533  const Perspective_camera & camera,
534  const Manhattan_corner & corner,
535  double desired_height,
536  double desired_width,
537  double desired_length,
538  bool & is_dx,
539  unsigned int num_rows,
540  unsigned int num_cols
541 );
542 
543 //bool propose_frustum_inside_parapiped_from_bounding_box_on_the_supporter // eg., the table lamp
544 //(
545 // kjb::Vector & centre,
546 // kjb::Vector & dimensions,
547 // kjb::Vector & expansion_deltas,
548 // std::vector<bool> & expansion_directions,
549 // Parametric_parapiped & new_pp,
550 // const Parametric_parapiped &pp,
551 // const Perspective_camera & camera,
552 // const kjb::Vector & bottom_center, // bottom center of the bounding box in the image plane
553 // const kjb::Vector & top_center,
554 // const int supporter_height // the height of the supporter relative to the room box
555 //);
556 
558 (
559  const Parametric_parapiped &pp,
560  const Perspective_camera & camera,
561  const Manhattan_corner & corner,
562  unsigned int num_rows,
563  unsigned int num_cols,
564  bool & expand_tw_camera,
565  bool & expand_right,
566  bool & expand_z_up
567 );
568 
570 (
572  kjb::Perspective_camera & camera,
573  const std::vector<Vanishing_point> & vpts,
574  double focal_length,
575  unsigned int num_rows,
576  unsigned int num_cols
577 );
578 
580 (
581  const Parametric_parapiped &pp,
582  const Perspective_camera & camera,
583  const Manhattan_corner & floor_corner,
584  const Manhattan_corner & top_corner,
585  double & desired_height,
586  unsigned int num_rows,
587  unsigned int num_cols
588 );
589 
591 (
593  kjb::Perspective_camera & camera,
594  unsigned int num_rows,
595  unsigned int num_cols,
596  const kjb::Vector & corner
597 );
598 
600 (
601  kjb::Vector & centre,
602  kjb::Vector & dimensions,
603  const Parametric_parapiped &pp,
604  const Perspective_camera & camera,
605  unsigned int & face_number,
606  const Manhattan_corner & corner1,
607  const Manhattan_corner & corner2,
608  const Manhattan_corner & corner3,
609  unsigned int num_rows,
610  unsigned int num_cols
611 );
612 
613 bool backproject_point_to_plane // find out the intersection between the view line and a plane in room coordinate
614 (
615  kjb::Vector & intersection,
616  kjb::Vector point2D,
617  kjb::Vector plane,
618  const Parametric_parapiped & pp,
619  const Perspective_camera & camera,
620  int num_rows,
621  int num_cols
622 );
623 
624 void update_focal_with_position(Perspective_camera& cam, double ifocal, Parametric_parapiped & pp);
625 
626 
627 }
628 
629 #endif
#define ST_PARAPIPED_YAW
Definition: st_parapiped.h:79
bool propose_parapiped_at_different_depth_from_orthogonal_corner(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_room)
Definition: st_parapiped.cpp:1744
virtual void update_rendering_representation() const
updates the rendering representation so that it reflects the current values of the parameters...
Definition: st_parapiped.cpp:368
static int get_num_rendering_interface_edges()
Definition: st_parapiped.h:270
virtual Parametric_parapiped * clone() const
Processes an Option from program command-line arguments.
Definition: st_parapiped.cpp:164
bool propose_frame_inside_parapiped_from_orthogonal_corner(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, unsigned int &face_number, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &idesired_dimensions, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:6010
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
static void get_edge_indexes(std::vector< int > &base_edge_indexes, std::vector< int > &vertical_edge_indexes, std::vector< int > &top_edge_indexes)
Definition: gr_parapiped.h:192
function lines
Definition: APPgetLargeConnectedEdges.m:1
double get_yaw() const
Returns the yaw of this parametric_parapiped.
Definition: st_parapiped.h:167
void set_length(double ilength)
Sets the length of this parametric_parapiped.
Definition: st_parapiped.cpp:201
bool propose_parapiped_inside_parapiped_from_orthogonal_corner_against_wall(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_room, bool expand_right, bool expand_z_up, bool expand_towards_camera)
Definition: st_parapiped.cpp:4335
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
bool find_height_from_two_corners(const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &floor_corner, const Manhattan_corner &top_corner, double &desired_height, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:7750
void get_point_in_parapiped_coordinates(const kjb::Vector &point_in_world_coordinates, kjb::Vector &point_in_parapiped_coordinates) const
Definition: st_parapiped.cpp:630
Polymesh & get_polymesh() const
returns the polymesh used to render this parametric_parapiped
Definition: st_parapiped.h:142
void set_centre_z(double iz)
Sets the z coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.cpp:343
Definition: gr_renderable_model.h:88
static int get_num_edges()
Definition: gr_parapiped.h:186
bool backproject_point_to_plane(kjb::Vector &intersection, kjb::Vector point2D, kjb::Vector plane, const Parametric_parapiped &pp, const Perspective_camera &camera, int num_rows, int num_cols)
Definition: st_parapiped.cpp:8153
void set_height(double iheight)
Sets the height of this parametric_parapiped.
Definition: st_parapiped.cpp:187
bool propose_supported_parapiped_inside_parapiped_from_orthogonal_corner(kjb::Vector &centre, kjb::Vector &dimensions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_sp_obj, kjb::Vector &sp_obj_centre, kjb::Vector &sp_obj_dimensions)
Definition: st_parapiped.cpp:3660
void draw_orientation_map() const
Definition: st_parapiped.cpp:600
theta
Definition: APPgetLargeConnectedEdges.m:108
bool propose_parapiped_onside_parapiped_from_one_corner_in_the_center(kjb::Vector &centre, kjb::Vector &dimensions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_sp_obj, kjb::Vector &sp_obj_centre, kjb::Vector &sp_obj_dimensions)
Definition: st_parapiped.cpp:3066
Definition: manhattan_world.h:249
#define KJB(x)
Definition: l_util.h:9
void expand_towards_camera(const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, unsigned int num_rows, unsigned int num_cols, bool &expand_tw_camera, bool &expand_right, bool &expand_z_up)
Definition: st_parapiped.cpp:5192
static void get_rendering_interface_edge_indexes(std::vector< int > &base_edge_indexes, std::vector< int > &vertical_edge_indexes, std::vector< int > &top_edge_indexes)
Definition: st_parapiped.h:276
void set_pitch(double ip)
Sets the pitch of this parametric_parapiped.
Definition: st_parapiped.cpp:215
void set_centre_y(double iy)
Sets the y coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.cpp:334
virtual void rotate_around_z_axis(double theta)
rotates the parapiped around its x-axis
Definition: st_parapiped.cpp:275
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
void set_centre(const kjb::Vector &icentre)
Sets the centre of this parametric_parapiped.
Definition: st_parapiped.cpp:298
virtual void write(std::ostream &out) const =0
Writes this Writeable to an output stream.
Parallelepiped: a hexahedron of which each face is a parallelegram.
Definition: gr_parapiped.h:83
Euler_mode
Definition: g_quaternion.h:55
virtual void write(std::ostream &out) const
Writes this parametric_parapiped to a file.
Definition: st_parapiped.cpp:505
void update_focal_with_position(Perspective_camera &cam, double ifocal, Parametric_parapiped &pp)
Definition: st_parapiped.cpp:8238
bool propose_parapiped_inside_parapiped_from_orthogonal_corner(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_room=true)
Definition: st_parapiped.cpp:1049
bool shift_parapiped_to_match_corner(kjb::Parametric_parapiped &pp, kjb::Perspective_camera &camera, unsigned int num_rows, unsigned int num_cols, const kjb::Vector &corner)
Definition: st_parapiped.cpp:7861
virtual void read(std::istream &in)
Reads this parametric_parapiped from an input stream.
Definition: st_parapiped.cpp:388
void set_roll(double ir)
Sets the roll of this parametric_parapiped.
Definition: st_parapiped.cpp:233
Definition: gr_renderable.h:151
void draw_left_right_orientation_map() const
Definition: st_parapiped.cpp:606
void set_rotation_mode(kjb::Quaternion::Euler_mode imode)
Definition: st_parapiped.h:233
Definition: g_quaternion.h:40
void draw_geometric_context_map() const
Definition: st_parapiped.cpp:618
double get_centre_y() const
Returns the x coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.h:176
bool propose_parapiped_inside_parapiped_from_three_corners_on_the_floor(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner1, const Manhattan_corner &corner2, const Manhattan_corner &corner3, double desired_height, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:6859
double propose_parapiped_and_camera_from_vanishing_points(kjb::Parametric_parapiped &pp, kjb::Perspective_camera &camera, const std::vector< Vanishing_point > &vpts, double focal_length, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:7468
const kjb::Quaternion & get_orientation() const
returns the quaternion defining this object's orientation
Definition: gr_rigid_object.h:174
Definition: perspective_camera.h:93
virtual void rotate_around_parapiped_axes(double thetax, double thetay, double thetaz)
rotates the parapiped around its x,y,z axes in this order
Definition: st_parapiped.cpp:290
void update_if_needed() const
Definition: gr_renderable_model.h:130
virtual Parametric_parapiped & operator=(const Parametric_parapiped &src)
Definition: st_parapiped.cpp:145
double get_length() const
Returns the length of this parametric_parapiped.
Definition: st_parapiped.h:162
double get_height() const
Returns the height of this parametric_parapiped.
Definition: st_parapiped.h:160
void set_yaw(double iy)
Sets the yaw of this parametric_parapiped.
Definition: st_parapiped.cpp:224
Abstract class of connected polygons (faces) forming a mesh. We assume that each edge is shared betwe...
Definition: gr_polymesh.h:89
double get_centre_x() const
Returns the x coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.h:174
void stretch_along_axis(unsigned int axis, double amount, bool direction)
Definition: st_parapiped.cpp:522
void get_vertices(std::vector< Vector > &vertices)
Definition: st_parapiped.cpp:678
Parallelepiped: a hexahedron of which each face is a parallelegram.
virtual void write(const char *fname) const
Writes this parametric_parapiped to an output stream.
Definition: st_parapiped.h:132
bool propose_parapiped_inside_parapiped_from_two_corners_on_the_floor(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner1, const Manhattan_corner &corner2, double desired_height, double desired_other_dimension_ratio, bool direction, bool &is_diagonal, bool &is_dx, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:7139
virtual void read(const char *fname)
Reads this parametric_parapiped from a file.
Definition: st_parapiped.h:122
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
St_renderable_model Base class for a structure model with a renderable representation.
virtual void rotate_around_x_axis(double theta)
rotates the parapiped around its x-axis
Definition: st_parapiped.cpp:257
double propose_parapiped_and_camera_from_orthogonal_corner_good(kjb::Parametric_parapiped &pp, kjb::Perspective_camera &camera, const kjb::Manhattan_corner &corner, double focal_length, unsigned int num_rows, unsigned int num_cols, double corner_3D_z_position, double p_width_ratio, double p_height_ratio, double p_length_ratio)
Definition: st_parapiped.cpp:685
virtual Abstract_renderable & get_rendering_interface() const
returns the rendering interface used to render this parametric_parapiped
Definition: st_parapiped.cpp:379
double get_width() const
Returns the width of this parametric_parapiped.
Definition: st_parapiped.h:158
void set_centre_x(double ix)
Sets the x coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.cpp:325
virtual void rotate_around_y_axis(double theta)
rotates the parapiped around its x-axis
Definition: st_parapiped.cpp:266
double get_centre_z() const
Returns the x coordinate of the centre of this parametric_parapiped.
Definition: st_parapiped.h:178
#define ST_PARAPIPED_PITCH
Definition: st_parapiped.h:78
double get_pitch() const
Returns the pitch of this parametric_parapiped.
Definition: st_parapiped.h:165
frustum: a hexahedron of which each face is a parallelegram.
const Vector & get_centre() const
Returns the centre of this parametric_parapiped.
Definition: st_parapiped.h:172
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
#define ST_PARAPIPED_ROLL
Definition: st_parapiped.h:80
double get_roll() const
Returns the roll of this parametric_parapiped.
Definition: st_parapiped.h:169
virtual void read(std::istream &in)=0
Reads this Readable from an input stream.
bool propose_frame_inside_parapiped_from_three_corners_on_the_wall(kjb::Vector &centre, kjb::Vector &dimensions, const Parametric_parapiped &pp, const Perspective_camera &camera, unsigned int &face_number, const Manhattan_corner &corner1, const Manhattan_corner &corner2, const Manhattan_corner &corner3, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:7921
Object thrown when input or output fails.
Definition: l_exception.h:496
bool propose_supported_parapiped_inside_parapiped_from_three_corners(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner1, const Manhattan_corner &corner2, const Manhattan_corner &corner3, double desired_height, unsigned int num_rows, unsigned int num_cols, double base_height)
Definition: st_parapiped.cpp:6578
bool propose_parapiped_inside_parapiped_from_one_corner_in_the_centre_on_the_floor(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, double desired_height, double desired_width, double desired_length, bool &is_dx, unsigned int num_rows, unsigned int num_cols)
Definition: st_parapiped.cpp:7341
const kjb::Quaternion & get_rotations_as_a_quaternion() const
returns the rotations of this parapiped as a quaternion
Definition: st_parapiped.h:219
void set_width(double iwidth)
Sets the width of this parametric_parapiped.
Definition: st_parapiped.cpp:172
void get_lines(std::vector< Line3d > &lines)
Definition: st_parapiped.cpp:672
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
void get_point_in_world_coordinates(const kjb::Vector &point_in_parapiped_coordinates, kjb::Vector &point_in_world_coordinates) const
Transforms a point in parapiped coordinates to world coordinates.
Definition: st_parapiped.cpp:652
bool propose_frame_inside_parapiped_from_orthogonal_corner_good(kjb::Vector &centre, kjb::Vector &dimensions, kjb::Vector &expansion_deltas, std::vector< bool > &expansion_directions, unsigned int &face_number, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &idesired_dimensions, unsigned int num_rows, unsigned int num_cols, bool wall_x, bool expand_to_the_ground)
Definition: st_parapiped.cpp:5445
void set_rotation_mode(kjb::Quaternion::Euler_mode imode)
Definition: gr_rigid_object.h:168
virtual void set_angles_from_quaternion(const kjb::Quaternion &q)
sets the rotation angles from an input quaternion
Definition: st_parapiped.cpp:354
bool propose_parapiped_onside_parapiped_from_orthogonal_corner(kjb::Vector &centre, kjb::Vector &dimensions, Parametric_parapiped &new_pp, const Parametric_parapiped &pp, const Perspective_camera &camera, const Manhattan_corner &corner, const kjb::Vector &imin_desired_dimensions, unsigned int num_rows, unsigned int num_cols, double distance_from_camera, bool expand_sp_obj, kjb::Vector &sp_obj_centre, kjb::Vector &sp_obj_dimensions)
Definition: st_parapiped.cpp:2386
Parametric_parapiped(double ix=0.0, double iy=0.0, double iz=0.0, double iw=1.0, double ih=1.0, double il=1.0, double ipitch=0.0, double iyaw=0.0, double iroll=0.0)
Definition: st_parapiped.cpp:82
Definition: st_parapiped.h:99
void draw_CMU_orientation_map() const
Definition: st_parapiped.cpp:612