67 #ifndef CAMERA_CPP_CAMERA_FRUSTUM_H_
68 #define CAMERA_CPP_CAMERA_FRUSTUM_H_
75 #define CAMERA_FRUSTUM_PITCH 0
76 #define CAMERA_FRUSTUM_YAW 1
77 #define CAMERA_FRUSTUM_ROLL 2
79 #define CAMERA_FRUSTUM_WIDTH 0
80 #define CAMERA_FRUSTUM_LENGTH 1
81 #define CAMERA_FRUSTUM_TOP_RADIUS 2
82 #define CAMERA_FRUSTUM_HEIGHT 3
87 class Perspective_camera;
88 class Manhattan_corner;
105 double iz = 0.0,
double iw = 1.0,
double il = 1.0,
double iratio_top_bottom
106 = 1.0,
double ih = 1.0,
131 virtual void write(std::ostream& out)
const
135 virtual void write(
const char * fname)
const
148 return rendering_interface;
242 KJB(UNTESTED_CODE());
261 const kjb::Vector & point_in_parapiped_coordinates,
282 std::vector<int> & base_edge_indexes,
283 std::vector<int> & vertical_edge_indexes,
284 std::vector<int> & top_edge_indexes,
289 vertical_edge_indexes, top_edge_indexes, num_facets);
296 void compute_new_euler_angles_on_rotations(
double dpitch,
double dyaw,
double droll);
298 unsigned int num_vertices;
303 double ratio_top_bottom;
virtual void rotate_around_frustum_axes(double thetax, double thetay, double thetaz)
rotates the parapiped around its x,y,z axes in this order
Definition: camera_frustum.cpp:306
void set_length(double ilength)
Sets the length of the base of this Parametric_frustum.
Definition: camera_frustum.cpp:217
#define CAMERA_FRUSTUM_ROLL
Definition: camera_frustum.h:77
double get_roll() const
Returns the roll of this parametric frustum.
Definition: camera_frustum.h:174
void get_lines(std::vector< Line3d > &lines)
Definition: camera_frustum.cpp:682
Abstract class to write this object to an output stream.
Definition: l_writeable.h:41
#define CAMERA_FRUSTUM_YAW
Definition: camera_frustum.h:76
virtual void rotate_around_y_axis(double theta)
rotates the truncated cone around its x-axis
Definition: camera_frustum.cpp:282
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
function lines
Definition: APPgetLargeConnectedEdges.m:1
Abstract class to read this object from an input stream.
Definition: l_readable.h:39
void set_rotation_mode(kjb::Quaternion::Euler_mode imode)
Definition: camera_frustum.h:240
Definition: gr_renderable_model.h:88
virtual Abstract_renderable & get_rendering_interface() const
returns the rendering interface used to render this Parametric_frustum
Definition: camera_frustum.cpp:395
theta
Definition: APPgetLargeConnectedEdges.m:108
#define KJB(x)
Definition: l_util.h:9
double get_ratio_top_bottom() const
Returns the ratio of the top and bottom surface of this parametric frustum.
Definition: camera_frustum.h:165
virtual void write(const char *fname) const
Writes this Parametric_frustum to an output stream.
Definition: camera_frustum.h:135
This class implements vectors, in the linear-algebra sense, with real-valued elements.
Definition: m_vector.h:87
virtual void write(std::ostream &out) const =0
Writes this Writeable to an output stream.
Euler_mode
Definition: g_quaternion.h:55
Parametric_frustum(unsigned int inv=6, double ix=0.0, double iy=0.0, double iz=0.0, double iw=1.0, double il=1.0, double iratio_top_bottom=1.0, double ih=1.0, double ipitch=0.0, double iyaw=0.0, double iroll=0.0)
Definition: camera_frustum.cpp:76
virtual void update_rendering_representation() const
updates the rendering representation so that it reflects the current values of the parameters...
Definition: camera_frustum.cpp:384
virtual void read(std::istream &in)
Reads this Parametric_frustum from an input stream.
Definition: camera_frustum.cpp:404
double get_centre_z() const
Returns the x coordinate of the centre of this Parametric_frustum.
Definition: camera_frustum.h:183
double get_centre_x() const
Returns the x coordinate of the centre of this Parametric_frustum.
Definition: camera_frustum.h:179
double get_centre_y() const
Returns the x coordinate of the centre of this Parametric_frustum.
Definition: camera_frustum.h:181
Definition: gr_renderable.h:151
static int get_rendering_interface_edge_indexes(std::vector< int > &base_edge_indexes, std::vector< int > &vertical_edge_indexes, std::vector< int > &top_edge_indexes, int num_facets)
Definition: camera_frustum.h:281
void set_height(double iheight)
Sets the height of this Parametric_frustum.
Definition: camera_frustum.cpp:189
void set_centre_y(double iy)
Sets the y coordinate of the centre of this parametric_frustum.
Definition: camera_frustum.cpp:350
Definition: g_quaternion.h:40
void set_centre_x(double ix)
Sets the x coordinate of the centre of this parametric_frustum.
Definition: camera_frustum.cpp:341
void stretch_along_axis(unsigned int axis, double amount, bool direction)
Definition: camera_frustum.cpp:564
const kjb::Quaternion & get_orientation() const
returns the quaternion defining this object's orientation
Definition: gr_rigid_object.h:174
Polymesh & get_polymesh() const
returns the polymesh used to render this Parametric_frustum
Definition: camera_frustum.h:145
void update_if_needed() const
Definition: gr_renderable_model.h:130
virtual void rotate_around_z_axis(double theta)
rotates the parapiped around its x-axis
Definition: camera_frustum.cpp:291
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
Definition: camera_frustum.h:100
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: camera_frustum.cpp:662
Abstract class of connected polygons (faces) forming a mesh. We assume that each edge is shared betwe...
Definition: gr_polymesh.h:89
virtual void read(const char *fname)
Reads this Parametric_frustum from a file.
Definition: camera_frustum.h:125
const kjb::Quaternion & get_rotations_as_a_quaternion() const
returns the rotations of this parapiped as a quaternion
Definition: camera_frustum.h:226
virtual void set_angles_from_quaternion(const kjb::Quaternion &q)
sets the rotation angles from an input quaternion
Definition: camera_frustum.cpp:370
Exception often thrown when wrapped C functions return error codes.
Definition: l_exception.h:262
void set_centre_z(double iz)
Sets the z coordinate of the centre of this parametric_frustum.
Definition: camera_frustum.cpp:359
double get_height() const
Returns the height of this parametric frustum.
Definition: camera_frustum.h:167
void set_width(double iwidth)
Sets the width of the base of this Parametric_frustum.
Definition: camera_frustum.cpp:174
double get_yaw() const
Returns the yaw of this parametric frustum.
Definition: camera_frustum.h:172
void set_centre(const kjb::Vector &icentre)
Sets the centre of this parametric_frustum.
Definition: camera_frustum.cpp:314
void set_ratio_top_bottom(double iratio_top_bottom)
Sets the ratio between the top and the base of this Parametric_frustum.
Definition: camera_frustum.cpp:203
static int get_num_edges(int num_facets)
Definition: gr_parametric_frustum.h:181
void set_roll(double ir)
Sets the roll of this Parametric_frustum.
Definition: camera_frustum.cpp:249
Parametric_frustum & operator=(const Parametric_frustum &src)
Definition: camera_frustum.cpp:144
frustum: a hexahedron of which each face is a parallelegram.
Object thrown when an argument to a function is not acceptable.
Definition: l_exception.h:377
void set_pitch(double ip)
Sets the pitch of this Parametric_frustum.
Definition: camera_frustum.cpp:231
void get_vertices(std::vector< Vector > &vertices)
Definition: camera_frustum.cpp:688
virtual void read(std::istream &in)=0
Reads this Readable from an input stream.
double get_width() const
Returns the width of this parametric frustum.
Definition: camera_frustum.h:161
Object thrown when input or output fails.
Definition: l_exception.h:496
virtual void write(std::ostream &out) const
Writes this Parametric_frustum to a file.
Definition: camera_frustum.cpp:545
St_renderable_model Base class for a structure model with a renderable representation.
virtual void rotate_around_x_axis(double theta)
rotates the truncated cone around its x-axis
Definition: camera_frustum.cpp:273
const Vector & get_centre() const
Returns the centre of this Parametric_frustum.
Definition: camera_frustum.h:177
static int get_num_rendering_interface_edges(int num_facets)
Definition: camera_frustum.h:275
double get_length() const
Returns the length of this parametric frustum.
Definition: camera_frustum.h:163
#define CAMERA_FRUSTUM_PITCH
Definition: camera_frustum.h:75
Definition for the Vector class, a thin wrapper on the KJB Vector struct and its related functionalit...
void get_point_in_parapiped_coordinates(const kjb::Vector &point_in_world_coordinates, kjb::Vector &point_in_parapiped_coordinates) const
Definition: camera_frustum.cpp:640
void set_rotation_mode(kjb::Quaternion::Euler_mode imode)
Definition: gr_rigid_object.h:168
void set_yaw(double iy)
Sets the yaw of this Parametric_frustum.
Definition: camera_frustum.cpp:240
double get_pitch() const
Returns the pitch of this parametric frustum.
Definition: camera_frustum.h:170
virtual Parametric_frustum * clone() const
Processes an Option from program command-line arguments.
Definition: camera_frustum.cpp:166