Point class

template<class T>
class ALL::Point

Template Parameters
  • T: floating point type used, has to be identical to the type used for the vertices and borders

Public Functions

Point()

default constructor

Point(const int d)

constructor

Parameters
  • d: dimension of the point object

Point(const int d, const T *data)

constructor with initialization

Parameters
  • d: dimension of the point object

  • data: positions

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

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

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

constructor with initialization

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

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

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

~Point()

destructor

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

operator to compute the cross product between two point objects

Return

cross product between the two point objects

Attention

only works for 3D points / vectors

Parameters
  • rhs: point object to compute the cross product with

T d(Point<T> p)

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

Return

the distance between the two points

Parameters
  • p: the point object for which the distence to the local point object is computed

T d_1(Point<T> p)

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

Return

the distance between the two points

Parameters
  • p: the point object for which the distance to the local point object is computed

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

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

Return

the distance vector between the two points

Parameters
  • p: the point object for which the distance vector to the local point object is computed

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

Return

distance between local point object and plane

Parameters
  • A: anchor point for the plane

  • B: anchor point for the plane

  • C: anchor point for the plane

long get_id() const

method to get the index of the point object

Return

the index of the point object

int getDimension() const

method to get the dimension of the point object

Return

the dimension of the point object

T getWeight() const

method to get the weight of the point object

Return

the weight of the point object

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

Return

the point is within the tetrahedron

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

T norm(T nd = 2)

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

Return

norm of the vector

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

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

operator to compute the dot product between two point objects

Return

dot product between the two point objects

Parameters
  • rhs: point object to compute the dot product with

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

operator to scale the local point object by a provided factor

Return

scaled point object

Parameters
  • rhs: scaling factor

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

operator for the addition of two point objects

Return

sum of local point object and provided point object

Parameters
  • rhs: point to add the local point object to

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

operator for the addition of two point objects

Return

difference vector between local point object and provided point object

Parameters
  • rhs: point to subtract from the local point object

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

access operator to access an element of the point object

Return

reference to the indexed element

Parameters
  • idx: the index of the element to be accessed

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

access operator to access an element of the constant point object

Return

const reference to the indexed element

Parameters
  • idx: the index of the element to be accessed

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

Return

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

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

void set_id(const long i)

method to change the index of the particle

Parameters
  • i: new index

void set_weight(const T w)

method to change the weight of the point object

Parameters
  • w: new weight

void setDimension(const int d)

method to change the dimension of the point object

Parameters
  • d: new dimension