codac 2.0.0
Loading...
Searching...
No Matches
codac2_Figure3D.h
Go to the documentation of this file.
1
9
10#pragma once
11
12#include <string>
13#include <memory>
14#include <fstream>
17#include "codac2_Paving.h"
18#include "codac2_Vector.h"
19#include "codac2_Matrix.h"
20
21
22namespace codac2
23{
24
32 {
33 public:
34
40 Figure3D(const std::string& name);
41
46
52 const std::string& name() const;
53
59 void draw_axes(double size = 1.0);
60
61
62 // Geometric shapes
63
70 void draw_box(const IntervalVector& x, const StyleProperties& s = { Color::dark_gray(0.5) });
71
79 void draw_parallelepiped(const Vector& z, const Matrix& A, const StyleProperties& s = { Color::dark_gray(0.5) });
80
81 // Pavings
82
89 void draw_paving(const PavingOut& p,
90 const StyleProperties& bound_s = { Color::yellow(0.5) });
91
99 void draw_paving(const PavingInOut& p,
100 const StyleProperties& bound_s = { Color::yellow(0.3) },
101 const StyleProperties& in_s = { Color::green(0.5) });
102
109 template<typename P>
110 inline void draw_subpaving(const Subpaving<P>& p, const StyleProperties& s = StyleProperties())
111 {
112 for(const auto& pi : p.boxes())
113 draw_box(pi, s);
114 }
115
116 protected:
117
118 const std::string _name;
119 std::ofstream _file;
120 size_t vertex_count = 0;
121 };
122}
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_box(const IntervalVector &x, const StyleProperties &s={ Color::dark_gray(0.5) })
Draws a box on the figure.
const std::string & name() const
Getter for the name of the figure.
void draw_paving(const PavingInOut &p, const StyleProperties &bound_s={ Color::yellow(0.3) }, const StyleProperties &in_s={ Color::green(0.5) })
Draws a paving on the figure (Only the boundary and the inside is drawn).
void draw_axes(double size=1.0)
Draws the (x,y,z) axes on the figure in red, green and blue.
~Figure3D()
Destructor for the Figure3D class.
void draw_subpaving(const Subpaving< P > &p, const StyleProperties &s=StyleProperties())
Draws a subpaving on the figure.
Definition codac2_Figure3D.h:110
Figure3D(const std::string &name)
Creates a new Figure3D object, with a given name.
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.
static Color green(float alpha=1.)
Green color.
Definition codac2_Color.h:176
static Color yellow(float alpha=1.)
Yellow color.
Definition codac2_Color.h:197
static Color dark_gray(float alpha=1.)
Dark gray color.
Definition codac2_Color.h:211
Style properties structure, to specify the style of a shape.
Definition codac2_StyleProperties.h:26