27#include "bitpit_CG.hpp"
28#include "bitpit_common.hpp"
42OBinaryStream&
operator<<(OBinaryStream &out_stream,
const Vertex &vertex)
44 out_stream << vertex.m_id;
45 out_stream << vertex.m_coords;
46 out_stream << vertex.m_interior;
59IBinaryStream& operator>>(IBinaryStream &in_stream, Vertex &vertex)
61 in_stream >> vertex.m_id;
62 in_stream >> vertex.m_coords;
63 in_stream >> vertex.m_interior;
77const long Vertex::NULL_ID = std::numeric_limits<long>::min();
84 _initialize(NULL_ID, {{0., 0., 0.}},
true);
95 _initialize(
id, {{0., 0., 0.}}, interior);
107 _initialize(
id, coords, interior);
119 std::swap(other.m_id, m_id);
120 std::swap(other.m_coords, m_coords);
121 std::swap(other.m_interior, m_interior);
133 _initialize(
id, coords, interior);
143void Vertex::_initialize(
long id,
const std::array<double, 3> &coords,
bool interior)
157 m_interior = interior;
180 for (
int i = 0; i < 3; ++i) {
197 return m_coords[coord_id];
208 return m_coords[coord_id];
268 m_coords[0] += translation[0];
269 m_coords[1] += translation[1];
270 m_coords[2] += translation[2];
293void Vertex::rotate(
const std::array<double, 3> &n0,
const std::array<double, 3> &n1,
double angle)
310void Vertex::rotate(
double n0x,
double n0y,
double n0z,
double n1x,
double n1y,
double n1z,
double angle)
312 rotate({{n0x, n0y, n0z}}, {{n1x, n1y, n1z}}, angle);
321void Vertex::scale(
const std::array<double, 3> &scaling,
const std::array<double, 3> ¢er)
323 m_coords[0] = center[0] + scaling[0] * (m_coords[0] - center[0]);
324 m_coords[1] = center[1] + scaling[1] * (m_coords[1] - center[1]);
325 m_coords[2] = center[2] + scaling[2] * (m_coords[2] - center[2]);
339 double cx,
double cy,
double cz)
341 scale({{sx, sy, sz}}, {{cx, cy, cz}});
353 std::string t_s = std::string(indent,
' ');
356 out << t_s <<
"ID: " <<
getId() << std::endl;
359 out << t_s <<
"coordinates : (";
360 out << m_coords[0] <<
", ";
361 out << m_coords[1] <<
", ";
362 out << m_coords[2] <<
")" << std::endl;
372 return (
sizeof(m_id) + m_coords.size() *
sizeof(
double) +
sizeof(m_interior));
Metafunction for generating a pierced vector.
The Vertex class defines the vertexs.
bool operator==(const Vertex &other) const
void setCoords(const std::array< double, 3 > &coords)
void translate(const std::array< double, 3 > &translation)
void display(std::ostream &out, unsigned short int indent) const
unsigned int getBinarySize() const
void initialize(long id, const std::array< double, 3 > &coords, bool interior)
void swap(Vertex &other) noexcept
void scale(const std::array< double, 3 > &scaling, const std::array< double, 3 > ¢er)
void setInterior(bool interior)
void rotate(const std::array< double, 3 > &n0, const std::array< double, 3 > &n1, double angle)
std::array< double, 3 > & getCoords()
double & operator[](int coord_id)
array3D rotatePoint(const array3D &P, const array3D &n0, const array3D &n1, double angle)
Logger & operator<<(Logger &logger, LoggerManipulator< T > &&m)