codac 1.5.6
|
Figure3D class, used for 3D figures. More...
#include <codac2_Figure3D.h>
Public Member Functions | |
Figure3D (const std::string &name) | |
Creates a new Figure3D object, with a given name. | |
~Figure3D () | |
Destructor for the Figure3D class. | |
const std::string & | name () const |
Getter for the name of the figure. | |
void | draw_triangle (const Vector &c, const Matrix &A, const Vector &p1, const Vector &p2, const Vector &p3, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a triangle. | |
void | draw_triangle (const Vector &p1, const Vector &p2, const Vector &p3, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a triangle, shorter version. | |
void | draw_polygon (const Vector &c, const Matrix &A, const std::vector< Vector > &l, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a `‘star-shaped’' polygon as a sequence of adjacent triangles (l[0],l[k],l[k+1]) with k>=1. | |
void | draw_parallelogram (const Vector &c, const Matrix &A, const Vector &p, const Vector &v1, const Vector &v2, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a parallelogram c + A (p + [-1,1]*v1 + [-1,1]*v2) | |
void | draw_parallelepiped (const Vector &z, const Matrix &A, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a parallelepiped z+A*[-1,1]^3 on the figure. | |
void | draw_zonotope (const Vector &z, const std::vector< Vector > &A, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a zonotope z+sum_i [-1,1] A_i on the figure. | |
void | draw_box (const IntervalVector &x, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a box on the figure. | |
void | draw_arrow (const Vector &c, const Matrix &A, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws an arrow (box c + A * ([0,1],[-0.01,0.01],[-0.01,0.01]) and a tip at the end) | |
void | draw_axes (double size=1.0) |
Draws the (x,y,z) axes on the figure in red, green and blue. | |
void | draw_surface (const Vector &c, const Matrix &A, const Interval &Ip1, double dp1, const Interval &Ip2, double dp2, std::function< Vector(double, double)> f, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a parametric surface. | |
void | draw_sphere (const Vector &c, const Matrix &A, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws a sphere (ellipsoid) | |
void | draw_ellipsoid (const Ellipsoid &e, const StyleProperties &s={ Color::dark_gray(0.5) }) |
Draws an ellipsoid (from the Ellipsoid class) | |
void | draw_car (const Vector &c, const Matrix &A, const StyleProperties &s={ Color::yellow(0.5) }) |
Draws a car, with blue windscreen. | |
void | draw_plane (const Vector &c, const Matrix &A, bool yaw_is_up=true, const StyleProperties &s={ Color::dark_gray(0.8) }) |
Draws a (paper) plane. | |
void | draw_paving (const PavingOut &p, const StyleProperties &bound_s={ Color::yellow(0.5) }) |
Draws a paving on the figure (Only the boundary is drawn). | |
void | draw_paving (const PavingInOut &p, const StyleProperties &bound_s={ Color::yellow(0.3), "paving_bound" }, const StyleProperties &in_s={ Color::green(0.5), "paving_in" }) |
Draws a paving on the figure (Only the boundary and the inside is drawn). | |
template<typename P> | |
void | draw_subpaving (const Subpaving< P > &p, const StyleProperties &s=StyleProperties()) |
Draws a subpaving on the figure. | |
Figure3D class, used for 3D figures.
This class is used to display 3D figures. It generates an OBJ file that can be opened with a 3D viewer.
codac2::Figure3D::Figure3D | ( | const std::string & | name | ) |
Creates a new Figure3D object, with a given name.
name | Name of the figure |
const std::string & codac2::Figure3D::name | ( | ) | const |
Getter for the name of the figure.
void codac2::Figure3D::draw_triangle | ( | const Vector & | c, |
const Matrix & | A, | ||
const Vector & | p1, | ||
const Vector & | p2, | ||
const Vector & | p3, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a triangle.
c | translation |
A | scaling |
p1 | first point |
p2 | second point |
p3 | third point |
s | style |
void codac2::Figure3D::draw_triangle | ( | const Vector & | p1, |
const Vector & | p2, | ||
const Vector & | p3, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a triangle, shorter version.
p1 | first point |
p2 | second point |
p3 | third point |
s | style |
void codac2::Figure3D::draw_polygon | ( | const Vector & | c, |
const Matrix & | A, | ||
const std::vector< Vector > & | l, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a `‘star-shaped’' polygon as a sequence of adjacent triangles (l[0],l[k],l[k+1]) with k>=1.
c | translation |
A | scaling |
l | points |
s | style |
void codac2::Figure3D::draw_parallelogram | ( | const Vector & | c, |
const Matrix & | A, | ||
const Vector & | p, | ||
const Vector & | v1, | ||
const Vector & | v2, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a parallelogram c + A (p + [-1,1]*v1 + [-1,1]*v2)
c | translation |
A | scaling |
p | base point |
v1 | vector |
v2 | vector |
s | style |
void codac2::Figure3D::draw_parallelepiped | ( | const Vector & | z, |
const Matrix & | A, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a parallelepiped z+A*[-1,1]^3 on the figure.
z | Coordinates of the center of the parallelepiped |
A | Matrix of the parallelepiped |
s | Style of the parallelepiped (edge color) |
void codac2::Figure3D::draw_zonotope | ( | const Vector & | z, |
const std::vector< Vector > & | A, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a zonotope z+sum_i [-1,1] A_i on the figure.
z | Coordinates of the center of the zonotope |
A | list of vectors |
s | Style of the zonotope (edge color) |
void codac2::Figure3D::draw_box | ( | const IntervalVector & | x, |
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a box on the figure.
x | Box to draw |
s | Style of the box (edge color) |
void codac2::Figure3D::draw_arrow | ( | const Vector & | c, |
const Matrix & | A, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws an arrow (box c + A * ([0,1],[-0.01,0.01],[-0.01,0.01]) and a tip at the end)
c | start |
A | orientation (first column) |
s | Style (color) |
void codac2::Figure3D::draw_axes | ( | double | size = 1.0 | ) |
Draws the (x,y,z) axes on the figure in red, green and blue.
size | Size of the axes |
void codac2::Figure3D::draw_surface | ( | const Vector & | c, |
const Matrix & | A, | ||
const Interval & | Ip1, | ||
double | dp1, | ||
const Interval & | Ip2, | ||
double | dp2, | ||
std::function< Vector(double, double)> | f, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a parametric surface.
c | translation |
A | scaling |
Ip1 | bounds of p1 |
dp1 | incrementation for p1 |
Ip2 | bounds of p2 |
dp2 | incrementation for p2 |
f | function computing the values |
s | Style (color) |
void codac2::Figure3D::draw_sphere | ( | const Vector & | c, |
const Matrix & | A, | ||
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
Draws a sphere (ellipsoid)
c | translation |
A | scaling |
s | Style (color) |
void codac2::Figure3D::draw_ellipsoid | ( | const Ellipsoid & | e, |
const StyleProperties & | s = { Color::dark_gray(0.5) } ) |
void codac2::Figure3D::draw_car | ( | const Vector & | c, |
const Matrix & | A, | ||
const StyleProperties & | s = { Color::yellow(0.5) } ) |
Draws a car, with blue windscreen.
c | `‘center’' (low) of the car |
A | orientation |
s | Style (color) |
void codac2::Figure3D::draw_plane | ( | const Vector & | c, |
const Matrix & | A, | ||
bool | yaw_is_up = true, | ||
const StyleProperties & | s = { Color::dark_gray(0.8) } ) |
Draws a (paper) plane.
c | `‘center’' (low) of the car |
A | orientation |
yaw_is_up | yaw axis is up (default true) |
s | Style (color) |
void codac2::Figure3D::draw_paving | ( | const PavingOut & | p, |
const StyleProperties & | bound_s = { Color::yellow(0.5) } ) |
Draws a paving on the figure (Only the boundary is drawn).
p | PavingOut to draw (result of a paving with contractors). |
bound_s | Style of the boundary of the paving |
void codac2::Figure3D::draw_paving | ( | const PavingInOut & | p, |
const StyleProperties & | bound_s = { Color::yellow(0.3), "paving_bound" }, | ||
const StyleProperties & | in_s = { Color::green(0.5), "paving_in" } ) |
Draws a paving on the figure (Only the boundary and the inside is drawn).
p | PavingInOut to draw (result of a paving with separators). |
bound_s | Style of the boundary of the paving |
in_s | Style of the inside of the paving |
|
inline |
Draws a subpaving on the figure.
p | Subpaving to draw |
s | Style of the subpaving |