Geogram Version 1.9.7
A programming library of geometric algorithms
|
Base class for implementing CSG objects and instructions. More...
#include <geogram/mesh/mesh_CSG_builder.h>
Public Types | |
typedef GEOCSG::ArgList | ArgList |
typedef GEOCSG::Value | Value |
Public Member Functions | |
AbstractCSGBuilder () | |
AbstractCSGBuilder constructor. | |
virtual | ~AbstractCSGBuilder () |
AbstractCSGBuilder destructor. | |
void | reset_defaults () |
Resets defaults value for fn, fs, fa. | |
void | set_fn (double fn) |
Sets the number of fragments. | |
void | set_fs (double fs) |
Sets the minimum size for a fragment. | |
void | set_fa (double fa) |
Sets the minimum angle for a fragment. | |
void | set_verbose (bool x) |
Displays (lots of) additional information. | |
void | set_detailed_verbose (bool x) |
Displays (even more) additional information. | |
bool | verbose () const |
Tests wheter verbose mode is set. | |
void | add_file_path (const std::filesystem::path &path) |
Adds a path to the file path. | |
void | reset_file_path () |
Resets the file path to its default value, with only the current directory ".". | |
void | push_file_path (const std::filesystem::path &path) |
Adds a path to the file path. | |
void | pop_file_path () |
Removes the latest pushed file path. | |
virtual void | add_object (const std::string &object, const ArgList &args) |
virtual void | begin_instruction () |
virtual void | end_instruction (const std::string &instruction, const ArgList &args) |
bool | is_object (const std::string &id) const |
bool | is_instruction (const std::string &id) const |
Static Public Attributes | |
static constexpr double | DEFAULT_FA = 12.0 |
static constexpr double | DEFAULT_FS = 2.0 |
static constexpr double | DEFAULT_FN = 0.0 |
Protected Types | |
typedef std::function< void(const ArgList &args)> | csg_builder_func |
Protected Member Functions | |
virtual void | add_square (const ArgList &args) |
virtual void | add_circle (const ArgList &args) |
virtual void | add_cube (const ArgList &args) |
virtual void | add_sphere (const ArgList &args) |
virtual void | add_cylinder (const ArgList &args) |
virtual void | add_polyhedron (const ArgList &args) |
virtual void | add_polygon (const ArgList &args) |
virtual void | add_import (const ArgList &args) |
virtual void | add_surface (const ArgList &args) |
virtual void | add_text (const ArgList &args) |
virtual void | eval_multmatrix (const ArgList &args) |
virtual void | eval_resize (const ArgList &args) |
virtual void | eval_union (const ArgList &args) |
virtual void | eval_intersection (const ArgList &args) |
virtual void | eval_difference (const ArgList &args) |
virtual void | eval_group (const ArgList &args) |
virtual void | eval_color (const ArgList &args) |
virtual void | eval_hull (const ArgList &args) |
virtual void | eval_linear_extrude (const ArgList &args) |
virtual void | eval_rotate_extrude (const ArgList &args) |
virtual void | eval_projection (const ArgList &args) |
virtual void | eval_minkowski (const ArgList &args) |
virtual void | eval_render (const ArgList &args) |
void | error (const char *str) |
void | error (const std::string &str) |
Protected Attributes | |
double | fn_ |
double | fs_ |
double | fa_ |
std::vector< std::filesystem::path > | file_path_ |
bool | warnings_ |
bool | verbose_ |
bool | detailed_verbose_ |
std::map< std::string, csg_builder_func > | object_funcs_ |
std::map< std::string, csg_builder_func > | instruction_funcs_ |
Base class for implementing CSG objects and instructions.
AbstractCSGBuilder implement the basic mechanism for calling generic objects and CSG instructions that take an ArgList (name value pairs) as arguments. It dispatches objects/instructions from their name (as a string) and unpacks the arguments from the ArgList. It is interesting to have an abstract base class for that, because one can have a subclass that records the CSG abstract syntax tree, for subsequently optimizing it before playing it back.
Definition at line 62 of file mesh_CSG_builder.h.
Definition at line 64 of file mesh_CSG_builder.h.
|
protected |
Definition at line 269 of file mesh_CSG_builder.h.
Definition at line 65 of file mesh_CSG_builder.h.
|
inline |
Adds a path to the file path.
The file path is where import() searches files. The default file path contains the current directory "."
[in] | path | the file path to be added, without trailing '/' |
Definition at line 167 of file mesh_CSG_builder.h.
|
inlineprotected |
Definition at line 252 of file mesh_CSG_builder.h.
|
inlineprotected |
Definition at line 256 of file mesh_CSG_builder.h.
|
inline |
Definition at line 215 of file mesh_CSG_builder.h.
|
inline |
Definition at line 211 of file mesh_CSG_builder.h.
|
inline |
Removes the latest pushed file path.
Definition at line 193 of file mesh_CSG_builder.h.
|
inline |
Adds a path to the file path.
The file path is where import() searches files. The default file path contains the current directory "."
[in] | path | the file path to be added, without trailing '/' |
Definition at line 186 of file mesh_CSG_builder.h.
void GEO::AbstractCSGBuilder::reset_defaults | ( | ) |
|
inline |
Resets the file path to its default value, with only the current directory ".".
Definition at line 175 of file mesh_CSG_builder.h.
|
inline |
Displays (even more) additional information.
[in] | x | whether even more information should be displayed. Default is off |
Definition at line 144 of file mesh_CSG_builder.h.
|
inline |
Sets the minimum angle for a fragment.
[in] | fa | minimum angle for a fragment, in degrees. |
This determines the number of edges in a polygonal approximation of a circle.
Definition at line 123 of file mesh_CSG_builder.h.
|
inline |
Sets the number of fragments.
This corresponds to the number of edges in a polygonal approximation of a circle. If left to 0, it is automatically computed from fs and fa
[in] | fn | the number of fragments. |
Definition at line 103 of file mesh_CSG_builder.h.
|
inline |
Sets the minimum size for a fragment.
[in] | fs | minimum size for a fragment. |
This determines the number of edges in a polygonal approximation of a circle.
Definition at line 113 of file mesh_CSG_builder.h.
|
inline |
Displays (lots of) additional information.
[in] | x | whether additional information should be displayed. Default is off |
Definition at line 132 of file mesh_CSG_builder.h.
|
inline |
Tests wheter verbose mode is set.
true | if additional information will be displayed. |
false | otherwise. |
Definition at line 156 of file mesh_CSG_builder.h.
|
staticconstexpr |
Definition at line 68 of file mesh_CSG_builder.h.
|
staticconstexpr |
Definition at line 74 of file mesh_CSG_builder.h.
|
staticconstexpr |
Definition at line 71 of file mesh_CSG_builder.h.
|
protected |
Definition at line 267 of file mesh_CSG_builder.h.
|
protected |
Definition at line 262 of file mesh_CSG_builder.h.
|
protected |
Definition at line 264 of file mesh_CSG_builder.h.
|
protected |
Definition at line 260 of file mesh_CSG_builder.h.
|
protected |
Definition at line 261 of file mesh_CSG_builder.h.
|
protected |
Definition at line 271 of file mesh_CSG_builder.h.
|
protected |
Definition at line 270 of file mesh_CSG_builder.h.
|
protected |
Definition at line 266 of file mesh_CSG_builder.h.
|
protected |
Definition at line 265 of file mesh_CSG_builder.h.