30 #ifndef _GranOO_libGeom_Point_hpp_
31 #define _GranOO_libGeom_Point_hpp_
37 #include "GranOO3/3rdParty/Eigen/Dense"
39 #include <boost/archive/text_oarchive.hpp>
40 #include <boost/archive/text_iarchive.hpp>
71 static Point&
glob(
const std::string&
id);
72 static std::string
class_ID() {
return "Point";}
74 static const int N = 3;
86 explicit Point(
double,
double,
double);
102 const double &
x()
const;
104 const double &
y()
const;
106 const double &
z()
const;
120 template <
typename Axis>
double&
val();
121 template <
typename Axis>
const double&
val()
const;
127 std::string
info()
const;
128 void add_glob(
const std::string&
id);
133 template<
class Archive>
void serialize(Archive&,
const unsigned int );
138 #ifndef DOXYGEN_SHOULD_SKIP_THIS
143 template<
class Archive>
146 ar &
x(); ar &
y(); ar &
z();
167 : coord(pt[0], pt[1], pt[2]){
177 return *
reinterpret_cast<Vector *
>(
this);
180 inline const Vector &
182 return *
reinterpret_cast<const Vector *
>(
this);
188 bool operator==(
const Point & pt1,
const Point & pt2) {
189 return (pt1.x() == pt2.x() && pt1.y() == pt2.y() && pt1.z() == pt2.z());
193 bool operator!=(
const Point & pt1,
const Point & pt2) {
257 template<
typename Axis>
inline
263 template<
typename Axis>
inline
270 double& Point::val<X>() {
275 const double& Point::val<X>()
const {
280 double& Point::val<Y>() {
285 const double& Point::val<Y>()
const {
290 double& Point::val<Z>() {
295 const double& Point::val<Z>()
const {
311 inline std::ostream &
312 operator<<(std::ostream& out,
const Point& pt) {
313 return out << pt.x() <<
"\t" << pt.y() <<
"\t" << pt.z() <<
"\t";
339 return sqrt( (
x()-pt.x())*(
x()-pt.x())+
340 (
y()-pt.y())*(
y()-pt.y())+
341 (
z()-pt.z())*(
z()-pt.z()));
346 return Point(0.5*(p1.x()+p2.x()),
348 0.5*(p1.z()+p2.z()));
#define SafeModeAssert(condition, message)
Definition: Macro.hpp:47
static Point & glob(const std::string &id)
Definition: Point.cpp:47
void set_z(const double &)
Eigen::Matrix< double, 3, 1 > coord
Definition: Point.hpp:136
static const Point & global
Definition: Point.hpp:76
std::string info() const
Definition: Point.cpp:114
friend bool operator==(const Point &, const Point &)
void translate(const Vector &v)
Definition: Point.cpp:88
friend bool operator!=(const Point &, const Point &)
void rotate(const Quaternion &q)
Definition: Point.cpp:95
static Point mid_point(const Point &p1, const Point &p2)
const Vector & to_vector() const
const double & val() const
static std::string class_ID()
Definition: Point.hpp:72
void add_glob(const std::string &id)
Definition: Point.cpp:121
void set_y(const double &)
friend class Vector
Definition: Point.hpp:64
const double & operator()(unsigned int i) const
static const int N
Definition: Point.hpp:74
Point(double, double, double)
void set_x(const double &)
static Point * new_object(const TiXmlElement *el)
Definition: Point.cpp:103
friend class boost::serialization::access
Definition: Point.hpp:132
friend std::ostream & operator<<(std::ostream &, const Point &)
double distance_with(const Point &) const
void serialize(Archive &, const unsigned int)
Point & operator=(const Point &)
Definition: Quaternion.hpp:54
Definition: Vector.hpp:75
bool operator!=(const EulerAngle &, const EulerAngle &)
std::ostream & operator<<(std::ostream &, const EulerAngle &)
bool operator==(const EulerAngle &, const EulerAngle &)
Definition: Common.hpp:198
x y * z
Definition: Exprtk.hpp:11139
x y t t *t x y t t t x y t t t x *y t *t t x *y t *t t x y t t t x y t t t x(y+z)