1#ifndef MECACELL_CONNECTABLECELL_HPP
2#define MECACELL_CONNECTABLECELL_HPP
57 inline Derived *
selfptr() {
return static_cast<Derived *
>(
this); }
58 inline Derived &
self() {
return static_cast<Derived &
>(*this); }
59 const Derived &
selfconst()
const {
return static_cast<const Derived &
>(*this); }
109 body(static_cast<Derived *>(this)),
123 color = {{
static_cast<double>(r) / 255.0,
static_cast<double>(g) / 255.0,
124 static_cast<double>(b) / 255.0}};
156 if (i < 3)
return color[i];
CellPlugin< cell_t > embedded_plugin_t
Basis for every cell a user might want to use.
ConnectableCell(const Derived *c)
Copy constructor.
unique_vector< Derived * > connectedCells
void setColorHSV(double H, double S, double V)
void setColorRGB(std::array< double, 3 > rgb)
const body_t & getConstBody() const
Vector3D getPosition() const
void addConnectedCell(Derived *c)
void clearConnectedCells()
ConnectableCell(const Derived &c, const Vec &translation)
Copy constructor with translation.
void setColorRGB(std::array< int, 3 > rgb)
bool isConnectedTo(Derived *c)
void setColorRGB(size_t r, size_t g, size_t b)
double getColor(unsigned int i) const
int getNbConnections() const
void setVisible(bool v)
should a viewer displpay this cell ?
const std::vector< Derived * > & getConnectedCells() const
void eraseConnectedCell(Derived *cell)
disconnect a neighboring cell
string toString()
dumps internal infos
ConnectableCell(const Derived &c)
ConnectableCell(Vec pos)
Constructor.
EXPORTABLE(ConnectableCell, KV(body), KV(id))
const Derived & selfconst() const
void die()
flags the cell as dead so it can be cleanly removed from the world
double getBoundingBoxRadius() const
typename body_t::embedded_plugin_t embedded_plugin_t
ConnectableCell(const ConnectableCell &c)
void setColorHSV(std::array< double, 3 > hsv)
general purpose 3D vector/point class.
const std::vector< T > & getUnderlyingVector() const
size_t count(const T &t) const
this file contains various miscellanious utility functions & helpers *
std::array< double, 3 > hsvToRgb(double h, double s, double v)
transform hsv color space to rgb
iostream endl
End-of-line manipulator.