DGtal 1.4.0
|
Aim: Constructive Solid Geometry (CSG) between models of CDigitalBoundedShape and CDigitalOrientedShape Use CSG operation (union, intersection, minus) from a shape of Type ShapeA with one (or more) shapes of Type ShapeB. Can combine differents operations. Limitations: Since we don't have a class derived by all shapes, operations can be done by only one type of shapes. Use CSG of CSG to go beyond this limitation. More...
#include <DGtal/shapes/DigitalShapesDecorator.h>
Public Types | |
typedef ShapeA::Space | Space |
typedef ShapeA::Point | Point |
Public Member Functions | |
BOOST_CONCEPT_ASSERT ((concepts::CDigitalBoundedShape< ShapeA >)) | |
BOOST_CONCEPT_ASSERT ((concepts::CDigitalOrientedShape< ShapeA >)) | |
DigitalShapesCSG () | |
DigitalShapesCSG (const DigitalShapesCSG &other) | |
DigitalShapesCSG (ConstAlias< ShapeA > a) | |
DigitalShapesCSG & | operator= (const DigitalShapesCSG &other) |
void | setParams (ConstAlias< ShapeA > a) |
void | plus (ConstAlias< ShapeB > b) |
void | intersection (ConstAlias< ShapeB > b) |
void | minus (ConstAlias< ShapeB > b) |
Point | getLowerBound () const |
Point | getUpperBound () const |
Orientation | orientation (const Point &p) const |
void | selfDisplay (std::ostream &out) const |
bool | isValid () const |
Protected Types | |
enum | e_operator { e_plus , e_intersection , e_minus } |
Private Attributes | |
CountedConstPtrOrConstPtr< ShapeA > | myShapeA |
Base Shape. | |
std::vector< std::pair< e_operator, CountedConstPtrOrConstPtr< ShapeB > > > | v_shapes |
Vector of all operations (ordered) of ShapeB. | |
Point | myLowerBound |
Domain lower bound. | |
Point | myUpperBound |
Domain upper bound. | |
bool | bIsValid |
if the CSG is valid. | |
Aim: Constructive Solid Geometry (CSG) between models of CDigitalBoundedShape and CDigitalOrientedShape Use CSG operation (union, intersection, minus) from a shape of Type ShapeA with one (or more) shapes of Type ShapeB. Can combine differents operations. Limitations: Since we don't have a class derived by all shapes, operations can be done by only one type of shapes. Use CSG of CSG to go beyond this limitation.
Description of template class 'DigitalShapesCSG'
ShapeA | type of a first shape. Must be a model of CDigitalBoundedShape and CDigitalOrientedShape |
ShapeB | type of a second shape. Must be a model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 67 of file DigitalShapesDecorator.h.
typedef ShapeA::Point DGtal::DigitalShapesCSG< ShapeA, ShapeB >::Point |
Definition at line 82 of file DigitalShapesDecorator.h.
typedef ShapeA::Space DGtal::DigitalShapesCSG< ShapeA, ShapeB >::Space |
Definition at line 81 of file DigitalShapesDecorator.h.
|
protected |
Enumerator | |
---|---|
e_plus | |
e_intersection | |
e_minus |
Definition at line 70 of file DigitalShapesDecorator.h.
|
inline |
Default constructor. DigitalShapesCSG will be not valid without setParams(ShapeA).
Definition at line 88 of file DigitalShapesDecorator.h.
|
inline |
Copy constructor.
[in] | other | a DigitalShapesCSG to copy |
Definition at line 97 of file DigitalShapesDecorator.h.
|
inline |
Constructor. DigitalShapesCSG will be valid.
[in] | a | a model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 109 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::bIsValid, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myShapeA, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound.
DGtal::DigitalShapesCSG< ShapeA, ShapeB >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDigitalBoundedShape< ShapeA >) | ) |
DGtal::DigitalShapesCSG< ShapeA, ShapeB >::BOOST_CONCEPT_ASSERT | ( | (concepts::CDigitalOrientedShape< ShapeA >) | ) |
|
inline |
Definition at line 224 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound.
|
inline |
Definition at line 235 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound.
|
inline |
Intersection between a (ShapeA) and b (ShapeB). If an operation was already set, the intersection will be between the CSG shape and b (ShapeB).
[in] | b | a ShapeB, model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 183 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::BOOST_CONCEPT_ASSERT(), DGtal::SpaceND< dim, TInteger >::dimension, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::e_intersection, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::v_shapes.
|
inline |
Checks the validity/consistency of the object.
Definition at line 316 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::bIsValid.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::getLowerBound(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::getUpperBound(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::intersection(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::minus(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::orientation(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::plus().
|
inline |
Minus between a (ShapeA) and b (ShapeB). If an operation was already set, the minus will be between the CSG shape and b (ShapeB).
[in] | b | a ShapeB, model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 207 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::BOOST_CONCEPT_ASSERT(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::e_minus, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::v_shapes.
|
inline |
Copy operator.
[in] | other | a DigitalShapesCSG to copy |
Definition at line 125 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::bIsValid, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myShapeA, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::v_shapes.
|
inline |
Return the orientation of a point with respect to a shape. Resolve all operations done with operators in the order they are set.
[in] | p | input point |
e_plus
Definition at line 250 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::e_intersection, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::e_minus, DGtal::INSIDE, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myShapeA, DGtal::ON, DGtal::OUTSIDE, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::v_shapes.
|
inline |
Union between a shape (ShapeA, gived at construction) and b (ShapeB). If an operation was already set, the union will be between the CSG shape and b (ShapeB).
[in] | b | a ShapeB, model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 159 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::BOOST_CONCEPT_ASSERT(), DGtal::SpaceND< dim, TInteger >::dimension, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::e_plus, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::v_shapes.
void DGtal::DigitalShapesCSG< ShapeA, ShapeB >::selfDisplay | ( | std::ostream & | out | ) | const |
Writes/Displays the object on an output stream.
out | the output stream where the object is written. |
|
inline |
Add a (unique) ShapeA for the CSG computation. DigitalShapesCSG will be valid after. If a ShapeA was already set, the previous one will be override.
[in] | a | a ShapeA, model of CDigitalBoundedShape and CDigitalOrientedShape |
Definition at line 143 of file DigitalShapesDecorator.h.
References DGtal::DigitalShapesCSG< ShapeA, ShapeB >::bIsValid, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myLowerBound, DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myShapeA, and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::myUpperBound.
|
private |
if the CSG is valid.
Definition at line 337 of file DigitalShapesDecorator.h.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::DigitalShapesCSG(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::isValid(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::operator=(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::setParams().
|
private |
Domain lower bound.
Definition at line 331 of file DigitalShapesDecorator.h.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::DigitalShapesCSG(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::getLowerBound(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::intersection(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::operator=(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::plus(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::setParams().
|
private |
Base Shape.
Definition at line 325 of file DigitalShapesDecorator.h.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::DigitalShapesCSG(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::operator=(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::orientation(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::setParams().
|
private |
Domain upper bound.
Definition at line 334 of file DigitalShapesDecorator.h.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::DigitalShapesCSG(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::getUpperBound(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::intersection(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::operator=(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::plus(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::setParams().
|
private |
Vector of all operations (ordered) of ShapeB.
Definition at line 328 of file DigitalShapesDecorator.h.
Referenced by DGtal::DigitalShapesCSG< ShapeA, ShapeB >::intersection(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::minus(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::operator=(), DGtal::DigitalShapesCSG< ShapeA, ShapeB >::orientation(), and DGtal::DigitalShapesCSG< ShapeA, ShapeB >::plus().