Template Struct point_type

Struct Documentation

template<typename F>
struct point_type

3D point: a location with x, y and z coordinates as floating point.

Note that you can simply use structured binding to get access to the individual parts like so:

float x, y, z;
tie(x, y, z) = atom.get_location();

Public Types

using value_type = F

the value type of the x, y and z members

Public Functions

inline constexpr point_type()

default constructor, initialises the values to zero

inline constexpr point_type(value_type x, value_type y, value_type z)

constructor taking three values

template<typename PF>
inline constexpr point_type(const point_type<PF> &pt)

Copy constructor.

inline constexpr point_type(const std::tuple<value_type, value_type, value_type> &pt)

constructor taking a tuple of three values

inline constexpr point_type(const clipper::Coord_orth &pt)

Construct a point using the values in clipper coordinate pt.

inline constexpr point_type &operator=(const clipper::Coord_orth &rhs)

Assign a point using the values in clipper coordinate rhs.

template<typename PF>
inline constexpr point_type &operator=(const point_type<PF> &rhs)

Assignment operator.

inline constexpr value_type &get_x()

Get a reference to x.

inline constexpr value_type get_x() const

Get the value of x.

inline constexpr void set_x(value_type x)

Set the value of x to x.

inline constexpr value_type &get_y()

Get a reference to y.

inline constexpr value_type get_y() const

Get the value of y.

inline constexpr void set_y(value_type y)

Set the value of y to y.

inline constexpr value_type &get_z()

Get a reference to z.

inline constexpr value_type get_z() const

Get the value of z.

inline constexpr void set_z(value_type z)

Set the value of z to z.

inline constexpr point_type &operator+=(const point_type &rhs)

add rhs

inline constexpr point_type &operator+=(value_type d)

add d to all members

inline constexpr point_type &operator-=(const point_type &rhs)

subtract rhs

inline constexpr point_type &operator-=(value_type d)

subtract d from all members

inline constexpr point_type &operator*=(value_type rhs)

multiply all members with rhs

inline constexpr point_type &operator/=(value_type rhs)

divide all members by rhs

inline constexpr value_type normalize()

looking at this point as a vector, normalise it which means dividing all members by the length making the length effectively 1.

Returns

The previous length of this vector

inline constexpr void rotate(const quaternion &q)

Rotate this point using the quaterion q.

inline constexpr void rotate(const quaternion &q, point_type pivot)

Rotate this point using the quaterion q by first moving the point to pivot and after rotating moving it back.

inline operator clipper::Coord_orth() const

Make it possible to pass a point to clipper functions expecting a clipper coordinate.

inline constexpr bool operator==(const point_type &rhs) const

Compare with rhs.

inline constexpr value_type length_sq() const

looking at the point as if it is a vector, return the squared length

inline constexpr value_type length() const

looking at the point as if it is a vector, return the length

Public Members

value_type m_x

The x part of the location.

value_type m_y

The y part of the location.

value_type m_z

The z part of the location.

Friends

template<typename F2> inline friend constexpr friend auto operator+ (const point_type &lhs, const point_type< F2 > &rhs)

Add the points lhs and rhs and return the result.

template<typename F2> inline friend constexpr friend auto operator- (const point_type &lhs, const point_type< F2 > &rhs)

Subtract the points lhs and rhs and return the result.

inline friend constexpr friend point_type operator- (const point_type &pt)

Return the negative copy of pt.

template<typename F2> inline friend constexpr friend auto operator* (const point_type &pt, F2 f)

multiply point pt with value f and return the result

template<typename F2> inline friend constexpr friend auto operator* (F2 f, const point_type &pt)

multiply point pt with value f and return the result

template<typename F2> inline friend constexpr friend auto operator/ (const point_type &pt, F2 f)

divide point pt by value f and return the result

inline friend std::ostream &operator<<(std::ostream &os, const point_type &pt)

Print out the point pt to os.