codac 1.5.6
Loading...
Searching...
No Matches
codac2::Figure3D Class Reference

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Figure3D()

codac2::Figure3D::Figure3D ( const std::string & name)

Creates a new Figure3D object, with a given name.

Parameters
nameName of the figure

Member Function Documentation

◆ name()

const std::string & codac2::Figure3D::name ( ) const

Getter for the name of the figure.

Returns
The name of the figure

◆ draw_triangle() [1/2]

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.

Parameters
ctranslation
Ascaling
p1first point
p2second point
p3third point
sstyle

◆ draw_triangle() [2/2]

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.

Parameters
p1first point
p2second point
p3third point
sstyle

◆ draw_polygon()

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.

Parameters
ctranslation
Ascaling
lpoints
sstyle

◆ draw_parallelogram()

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)

Parameters
ctranslation
Ascaling
pbase point
v1vector
v2vector
sstyle

◆ draw_parallelepiped()

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.

Parameters
zCoordinates of the center of the parallelepiped
AMatrix of the parallelepiped
sStyle of the parallelepiped (edge color)

◆ draw_zonotope()

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.

Parameters
zCoordinates of the center of the zonotope
Alist of vectors
sStyle of the zonotope (edge color)

◆ draw_box()

void codac2::Figure3D::draw_box ( const IntervalVector & x,
const StyleProperties & s = { Color::dark_gray(0.5) } )

Draws a box on the figure.

Parameters
xBox to draw
sStyle of the box (edge color)

◆ draw_arrow()

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)

Parameters
cstart
Aorientation (first column)
sStyle (color)

◆ draw_axes()

void codac2::Figure3D::draw_axes ( double size = 1.0)

Draws the (x,y,z) axes on the figure in red, green and blue.

Parameters
sizeSize of the axes

◆ draw_surface()

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.

Parameters
ctranslation
Ascaling
Ip1bounds of p1
dp1incrementation for p1
Ip2bounds of p2
dp2incrementation for p2
ffunction computing the values
sStyle (color)

◆ draw_sphere()

void codac2::Figure3D::draw_sphere ( const Vector & c,
const Matrix & A,
const StyleProperties & s = { Color::dark_gray(0.5) } )

Draws a sphere (ellipsoid)

Parameters
ctranslation
Ascaling
sStyle (color)

◆ draw_ellipsoid()

void codac2::Figure3D::draw_ellipsoid ( const Ellipsoid & e,
const StyleProperties & s = { Color::dark_gray(0.5) } )

Draws an ellipsoid (from the Ellipsoid class)

Parameters
eEllipsoid to draw
sStyle (color)

◆ draw_car()

void codac2::Figure3D::draw_car ( const Vector & c,
const Matrix & A,
const StyleProperties & s = { Color::yellow(0.5) } )

Draws a car, with blue windscreen.

Parameters
c`‘center’' (low) of the car
Aorientation
sStyle (color)

◆ draw_plane()

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.

Parameters
c`‘center’' (low) of the car
Aorientation
yaw_is_upyaw axis is up (default true)
sStyle (color)

◆ draw_paving() [1/2]

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).

Parameters
pPavingOut to draw (result of a paving with contractors).
bound_sStyle of the boundary of the paving

◆ draw_paving() [2/2]

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).

Parameters
pPavingInOut to draw (result of a paving with separators).
bound_sStyle of the boundary of the paving
in_sStyle of the inside of the paving

◆ draw_subpaving()

template<typename P>
void codac2::Figure3D::draw_subpaving ( const Subpaving< P > & p,
const StyleProperties & s = StyleProperties() )
inline

Draws a subpaving on the figure.

Parameters
pSubpaving to draw
sStyle of the subpaving
247 {
248 for(const auto& pi : p.boxes())
249 draw_box(pi, s);
250 }
void draw_box(const IntervalVector &x, const StyleProperties &s={ Color::dark_gray(0.5) })
Draws a box on the figure.

The documentation for this class was generated from the following file: