Point class

template<class T>
class Point
Template Parameters:

T – floating point type used, has to be identical to the type used for the vertices and borders

Public Functions

inline Point()

default constructor

inline Point(const int d)

constructor

Parameters:

d – dimension of the point object

inline Point(const int d, const T *data)

constructor with initialization

Parameters:
  • d – dimension of the point object

  • data – positions

inline Point(const int d, const T *data, const T w)

constructor with initialization

Parameters:
  • d – dimension of the point

  • data – positions

  • w – weight of the point

inline Point(const int d, const T *data, const T w, const long i)

constructor with initialization

Parameters:
  • d – dimension of the point

  • data – positions

  • w – weight of the point

  • i – index of the point

inline Point(const std::vector<T> &data)

constructor with initialization

Parameters:

data – positions, dimension is the size of the vector

inline Point(const std::vector<T> &data, const T w)

constructor with initialization

Parameters:
  • data – positions, dimension is the size of the vector

  • w – weight of the point

inline Point(const std::vector<T> &data, const T w, const long i)

constructor with initialization

Parameters:
  • data – positions, dimension is the size of the vector

  • w – weight of the point

  • i – index of the point

inline ~Point()

destructor

inline Point<T> cross(const Point<T> &rhs) const

operator to compute the cross product between two point objects

Attention

only works for 3D points / vectors

Parameters:

rhs – point object to compute the cross product with

Returns:

cross product between the two point objects

inline T d(Point<T> p)

method to compute the Euclidean distance (two-norm) between the local and the provided point object

Parameters:

p – the point object for which the distence to the local point object is computed

Returns:

the distance between the two points

inline T d_1(Point<T> p)

method to compute the Manhatten / city-block distance (one-norm) between the local and the provided point object

Parameters:

p – the point object for which the distance to the local point object is computed

Returns:

the distance between the two points

inline Point<T> dist(Point<T> &p)

method to compute the distance vector between the local point object and the provided point object

Parameters:

p – the point object for which the distance vector to the local point object is computed

Returns:

the distance vector between the two points

inline T dist_plane(const Point<T> &A, const Point<T> &B, const Point<T> &C)

method to compute the distance of the local point object from a plane spanned by provided points

Parameters:
  • A – anchor point for the plane

  • B – anchor point for the plane

  • C – anchor point for the plane

Returns:

distance between local point object and plane

inline long get_id() const

method to get the index of the point object

Returns:

the index of the point object

inline int getDimension() const

method to get the dimension of the point object

Returns:

the dimension of the point object

inline T getWeight() const

method to get the weight of the point object

Returns:

the weight of the point object

inline bool inTetrahedron(const Point<T> &A, const Point<T> &B, const Point<T> &C, const Point<T> &D)

method to check if the local point object is inside a tetrahedron described by the vertices A,B,C and D

Attention

a point that is on the surface of the tetrahedron is not inside it

Parameters:
  • A – vertex A

  • B – vertex B

  • C – vertex C

  • D – vertex D

Returns:

the point is within the tetrahedron

inline T norm(T nd = 2)

method to compute the norm of the vector described by the point object

Parameters:

nd – type of the norm (default: 2, i.e. the Euclidean norm)

Returns:

norm of the vector

inline T operator*(const Point<T> &rhs) const

operator to compute the dot product between two point objects

Parameters:

rhs – point object to compute the dot product with

Returns:

dot product between the two point objects

inline Point<T> operator*(const T &rhs) const

operator to scale the local point object by a provided factor

Parameters:

rhs – scaling factor

Returns:

scaled point object

inline Point<T> operator+(const Point<T> &rhs) const

operator for the addition of two point objects

Parameters:

rhs – point to add the local point object to

Returns:

sum of local point object and provided point object

inline Point<T> operator-(const Point<T> &rhs) const

operator for the addition of two point objects

Parameters:

rhs – point to subtract from the local point object

Returns:

difference vector between local point object and provided point object

inline Point<T> operator/(const T &rhs) const

operator to scale the local point object by a provided factor

Parameters:

rhs – scaling factor

Returns:

scaled point object

inline T &operator[](const std::size_t idx)

access operator to access an element of the point object

Parameters:

idx – the index of the element to be accessed

Returns:

reference to the indexed element

inline const T &operator[](const std::size_t idx) const

access operator to access an element of the constant point object

Parameters:

idx – the index of the element to be accessed

Returns:

const reference to the indexed element

inline bool same_side_plane(const Point<T> &A, const Point<T> &B, const Point<T> &C, const Point<T> &P)

method to determine if the local point object has the same orientation to a plane spanned by point objects A,B,C as the provided point P

Attention

if the reference point is located within the plane, it will not have the same orientation as the local point! the reference point

Parameters:
  • A – anchor point A

  • B – anchor point B

  • C – anchor point C

  • P – reference point P

Returns:

the local point object has the same orientation to the plane as

inline void set_id(const long i)

method to change the index of the particle

Parameters:

i – new index

inline void set_weight(const T w)

method to change the weight of the point object

Parameters:

w – new weight

inline void setDimension(const int d)

method to change the dimension of the point object

Parameters:

d – new dimension