69 #ifndef ST_PARAPIPED_H_
70 #define ST_PARAPIPED_H_
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
86 class Perspective_camera;
87 class Manhattan_corner;
88 class Vanishing_point;
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,
128 virtual void write(std::ostream& out)
const
132 virtual void write(
const char * fname)
const
145 return rendering_interface;
235 KJB(UNTESTED_CODE());
254 const kjb::Vector & point_in_parapiped_coordinates,
277 std::vector<int> & base_edge_indexes,
278 std::vector<int> & vertical_edge_indexes,
279 std::vector<int> & top_edge_indexes
283 vertical_edge_indexes, top_edge_indexes);
290 void compute_new_euler_angles_on_rotations(
double dpitch,
double dyaw,
double droll);
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
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,
335 unsigned int num_rows,
336 unsigned int num_cols,
337 double distance_from_camera,
338 bool expand_room =
true
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,
353 unsigned int num_rows,
354 unsigned int num_cols
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,
369 unsigned int num_rows,
370 unsigned int num_cols,
372 bool expand_to_the_ground
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,
388 unsigned int num_rows,
389 unsigned int num_cols,
390 double distance_from_camera,
398 Parametric_parapiped & new_pp,
399 const Parametric_parapiped & pp,
400 const Perspective_camera & camera,
401 const Manhattan_corner & corner,
403 unsigned int num_rows,
404 unsigned int num_cols,
405 double distance_from_camera,
417 Parametric_parapiped & new_pp,
418 const Parametric_parapiped & pp,
419 const Perspective_camera & camera,
420 const Manhattan_corner & corner,
422 unsigned int num_rows,
423 unsigned int num_cols,
424 double distance_from_camera,
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,
444 unsigned int num_rows,
445 unsigned int num_cols,
446 double distance_from_camera,
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,
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
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,
504 unsigned int num_rows,
505 unsigned int num_cols
512 Parametric_parapiped & new_pp,
513 const Parametric_parapiped & pp,
514 const Perspective_camera & camera,
515 const Manhattan_corner & corner,
517 unsigned int num_rows,
518 unsigned int num_cols,
519 double distance_from_camera,
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,
539 unsigned int num_rows,
540 unsigned int num_cols
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,
573 const std::vector<Vanishing_point> & vpts,
575 unsigned int num_rows,
576 unsigned int num_cols
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
594 unsigned int num_rows,
595 unsigned int num_cols,
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
618 const Parametric_parapiped & pp,
619 const Perspective_camera & camera,
#define ST_PARAPIPED_YAW
Definition: st_parapiped.h:79
bool propose_parapiped_at_different_depth_from_orthogonal_corner(kjb::Vector ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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 ¢re, 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