Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
datatypes::Point3D Class Reference

This class defines a point in the three-dimensional plane. More...

#include <Point3D.hpp>

Inheritance diagram for datatypes::Point3D:
Inheritance graph
[legend]

Public Types

typedef double floatingpoint_type
 The type of the stored x and y coordinates. More...
 

Public Member Functions

virtual const UINT32 getUsedMemory () const
 
 Point3D (double x, double y, double z)
 
 Point3D ()
 
 Point3D (const Point2D &p)
 Constructs a point from the given Point2D. Z-component will be zero. More...
 
Accessor methods for information about this point
bool isZero () const
 Check against (near-)zero. More...
 
double getX () const
 Returns the x-coordinate of this point. More...
 
double getY () const
 Returns the y-coordinate of this point. More...
 
double getZ () const
 Returns the z-coordinate of this point. More...
 
double length () const
 Length of the vector (identical to distFromOrigin()) More...
 
double distFromOrigin () const
 Dist from the point (0,0,0) to this point. More...
 
double getAngleAroundX () const
 Returns the rotation angle around x (in the z-y-plane) More...
 
double getAngleAroundY () const
 Returns the rotation angle around y (in the z-x-plane) More...
 
double getAngleAroundZ () const
 Returns the rotation angle around z (in the x-y-plane) More...
 
Point2D toPoint2D () const
 Returns the x/y components of this class, converted into a Point2D object. More...
 
Setter methods for changing this point
void setX (double x)
 Sets the x-coordinate of this point to the given value. More...
 
void setY (double y)
 Sets the y-coordinate of this point to the given value. More...
 
void setZ (double z)
 Sets the z-coordinate of this point to the given value. More...
 
void setXYZ (double x, double y, double z)
 Sets the coordinates of this point to the given values. More...
 
void rotateAroundX (double rollAngle)
 Rotate the point around the X-axis ("Roll angle") More...
 
void rotateAroundY (double pitchAngle)
 Rotate the point around the Y-axis ("Pitch angle") More...
 
void rotateAroundZ (double dYawAngle)
 Rotate the point around the Z-axis ("Yaw angle") More...
 
void normalize ()
 Normalizes this vector (point) to length 1.0. More...
 
Point3Doperator+= (const Point3D &point)
 Adds the given point to this point and returns a reference to this point. More...
 
Point3Doperator-= (const Point3D &point)
 Subtracts the given point to this point and returns a reference to this point. More...
 
Point3Doperator/= (double divisor)
 
Serialization
std::istream & read (std::istream &is)
 Reads a Point3D from an input stream. More...
 
void read (const BYTE *&buf)
 
std::ostream & write (std::ostream &os) const
 
void write (BYTE *&buf) const
 
std::string toString () const
 Text output for debugging. More...
 
- Public Member Functions inherited from datatypes::BasicData
 BasicData ()
 
UINT16 getDatatype ()
 
UINT16 getSourceId ()
 
virtual void setSourceId (UINT16 id)
 
virtual ~BasicData ()
 

Static Public Member Functions

static std::streamsize getSerializedSize ()
 

Private Attributes

double m_x
 
double m_y
 
double m_z
 

Friends

bool operator!= (const Point3D &, const Point3D &)
 
double operator* (const Point3D &, const Point3D &)
 
const Point3D operator* (double, const Point3D &)
 
const Point3D operator* (const Point3D &, double)
 
const Point3D operator+ (const Point3D &, const Point3D &)
 
const Point3D operator- (const Point3D &, const Point3D &)
 
const Point3D operator- (const Point3D &)
 
const Point3D operator/ (const Point3D &, double)
 
bool operator== (const Point3D &, const Point3D &)
 

Geometrical relations to other objects

double dist (const Point3D &point) const
 Calculates the distance to the given point. More...
 
static Point3D vectorProduct (const Point3D &v1, const Point3D &v2)
 Returns the vector product ("Kreuzprodukt") of the two vectors. More...
 
static Point3D calcIntersectionPointOfVectorWithPlane (const Point3D &PlaneStartpoint, const Point3D &PlaneNormal, const Point3D &VectorStartpoint, const Point3D &VectorDirection)
 
static double getDistanceBetweenPoints (const Point3D &pt1, const Point3D &pt2)
 Returns the distance between the two point coordinates. More...
 

Additional Inherited Members

- Protected Attributes inherited from datatypes::BasicData
UINT16 m_datatype
 
UINT16 m_sourceId
 

Detailed Description

This class defines a point in the three-dimensional plane.

Definition at line 25 of file Point3D.hpp.

Member Typedef Documentation

The type of the stored x and y coordinates.

Definition at line 29 of file Point3D.hpp.

Constructor & Destructor Documentation

datatypes::Point3D::Point3D ( double  x,
double  y,
double  z 
)
inline

Constructs a point with the given coordinates (x, y, z).

Definition at line 38 of file Point3D.hpp.

datatypes::Point3D::Point3D ( )
inline

Constructs a null point, i.e. with coordinates (0.0, 0.0, 0.0)

Definition at line 45 of file Point3D.hpp.

datatypes::Point3D::Point3D ( const Point2D p)
explicit

Constructs a point from the given Point2D. Z-component will be zero.

Definition at line 21 of file Point3D.cpp.

Member Function Documentation

Point3D datatypes::Point3D::calcIntersectionPointOfVectorWithPlane ( const Point3D PlaneStartpoint,
const Point3D PlaneNormal,
const Point3D VectorStartpoint,
const Point3D VectorDirection 
)
static

Calculates the intersection point between a plane and a vector. The vector is given with a start point (Deutsch: Aufpunkt) and a direction vector (Deutsch: Richtungsvektor). The plane is given as a start point (Deutsch: Aufpunkt) and a normal vector (Deutsch: Normalenvektor).

Note that the plane has infinite size, so the intersection point may not be where you expect it to be, e.g. "behind" the vector start point, that is, in negative vector direction. Note also that there may not be an intersection point. In this case, the resulting point will be NaN in all components.

Is this function better located in geom3D?

Definition at line 293 of file Point3D.cpp.

double datatypes::Point3D::dist ( const Point3D point) const

Calculates the distance to the given point.

Definition at line 43 of file Point3D.cpp.

double datatypes::Point3D::distFromOrigin ( ) const

Dist from the point (0,0,0) to this point.

Calculates the dist from the origin (0,0,0) to the point. Assuming the point is a vector, this is the length of the vector (see also length()).

Definition at line 146 of file Point3D.cpp.

double datatypes::Point3D::getAngleAroundX ( ) const

Returns the rotation angle around x (in the z-y-plane)

Returns the angle that the projection of the point onto the z-y-plane has. This angle is measured against the 0-degree-direction (y axis). Note that the z-coordinate has no effect here.

      ^ y
      |
      |
      |

<-----—+------— z | | (x points upwards) |

The given angle is measured against the y axis, positive angles are counterclockwise ("to the left").

Definition at line 235 of file Point3D.cpp.

double datatypes::Point3D::getAngleAroundY ( ) const

Returns the rotation angle around y (in the z-x-plane)

Returns the angle that the projection of the point onto the x-z-plane has. This angle is measured against the 0-degree-direction (z axis). Note that the y-coordinate has no effect here.

      ^ z
      |
      |
      |

<-----—+------— x | | (y points upwards) |

The given angle is measured against the z axis, positive angles are counterclockwise ("to the left").

Definition at line 207 of file Point3D.cpp.

double datatypes::Point3D::getAngleAroundZ ( ) const

Returns the rotation angle around z (in the x-y-plane)

Returns the angle that the projection of the point onto the x-y-plane has. This angle is measured against the 0-degree-direction (x axis). Note that the z-coordinate has no effect here.

      ^ x
      |
      |
      |

<-----—+------— y | | (z points upwards) |

The given angle is measured against the x axis, positive angles are counterclockwise ("to the left").

Definition at line 179 of file Point3D.cpp.

double datatypes::Point3D::getDistanceBetweenPoints ( const Point3D pt1,
const Point3D pt2 
)
static

Returns the distance between the two point coordinates.

Returns the distance between the two 3d-point coordinates.

Definition at line 250 of file Point3D.cpp.

static std::streamsize datatypes::Point3D::getSerializedSize ( )
static
virtual const UINT32 datatypes::Point3D::getUsedMemory ( ) const
inlinevirtual

Implements datatypes::BasicData.

Definition at line 55 of file Point3D.hpp.

double datatypes::Point3D::getX ( ) const
inline

Returns the x-coordinate of this point.

Definition at line 63 of file Point3D.hpp.

double datatypes::Point3D::getY ( ) const
inline

Returns the y-coordinate of this point.

Definition at line 64 of file Point3D.hpp.

double datatypes::Point3D::getZ ( ) const
inline

Returns the z-coordinate of this point.

Definition at line 65 of file Point3D.hpp.

bool datatypes::Point3D::isZero ( ) const

Check against (near-)zero.

Returns true if this point is zero in terms of the machine precision, that is, its value is exactly zero or "almost zero".

Definition at line 35 of file Point3D.cpp.

double datatypes::Point3D::length ( ) const

Length of the vector (identical to distFromOrigin())

Calculates the dist from the origin (0,0,0) to the point. Assuming the point is a vector, this is the length of the vector.

Definition at line 155 of file Point3D.cpp.

void datatypes::Point3D::normalize ( )

Normalizes this vector (point) to length 1.0.

Normalizes this vector (point is treated as a vector here) to length 1.0.

If the vector has zero length (isZero() returns true), it will be left unchanged.

Definition at line 74 of file Point3D.cpp.

Point3D & datatypes::Point3D::operator+= ( const Point3D point)
inline

Adds the given point to this point and returns a reference to this point.

Definition at line 147 of file Point3D.hpp.

Point3D & datatypes::Point3D::operator-= ( const Point3D point)
inline

Subtracts the given point to this point and returns a reference to this point.

Definition at line 155 of file Point3D.hpp.

Point3D & datatypes::Point3D::operator/= ( double  divisor)
inline

Definition at line 163 of file Point3D.hpp.

std::istream& datatypes::Point3D::read ( std::istream &  is)

Reads a Point3D from an input stream.

Parameters
isThe input stream
void datatypes::Point3D::read ( const BYTE *&  buf)
void datatypes::Point3D::rotateAroundX ( double  rollAngle)

Rotate the point around the X-axis ("Roll angle")

Rotate the point around the X axis (with a roll angle). The input is an angle in [rad]. Positive angles rotate clockwise (seen from the origin).

Definition at line 113 of file Point3D.cpp.

void datatypes::Point3D::rotateAroundY ( double  pitchAngle)

Rotate the point around the Y-axis ("Pitch angle")

Rotate the point around the Y axis (with a pitch angle). The input is an angle in [rad]. Positive angles rotate clockwise (seen from the origin).

Definition at line 129 of file Point3D.cpp.

void datatypes::Point3D::rotateAroundZ ( double  yawAngle)

Rotate the point around the Z-axis ("Yaw angle")

Rotate the point around the Z axis (with a yaw angle). The input is an angle in [rad]. Positive angles rotate counterclockwise.

Definition at line 96 of file Point3D.cpp.

void datatypes::Point3D::setX ( double  x)
inline

Sets the x-coordinate of this point to the given value.

Definition at line 81 of file Point3D.hpp.

void datatypes::Point3D::setXYZ ( double  x,
double  y,
double  z 
)
inline

Sets the coordinates of this point to the given values.

Definition at line 84 of file Point3D.hpp.

void datatypes::Point3D::setY ( double  y)
inline

Sets the y-coordinate of this point to the given value.

Definition at line 82 of file Point3D.hpp.

void datatypes::Point3D::setZ ( double  z)
inline

Sets the z-coordinate of this point to the given value.

Definition at line 83 of file Point3D.hpp.

Point2D datatypes::Point3D::toPoint2D ( ) const

Returns the x/y components of this class, converted into a Point2D object.

Definition at line 48 of file Point3D.cpp.

std::string datatypes::Point3D::toString ( ) const

Text output for debugging.

Convert point to text string for debugging

Definition at line 262 of file Point3D.cpp.

Point3D datatypes::Point3D::vectorProduct ( const Point3D v1,
const Point3D v2 
)
static

Returns the vector product ("Kreuzprodukt") of the two vectors.

Returns the vector product ("Kreuzprodukt") of the two vectors. Note that the returned vector product is not normalized (Hint: use normalize() to do this).

Definition at line 58 of file Point3D.cpp.

std::ostream& datatypes::Point3D::write ( std::ostream &  os) const
void datatypes::Point3D::write ( BYTE *&  buf) const

Friends And Related Function Documentation

bool operator!= ( const Point3D p1,
const Point3D p2 
)
friend

Definition at line 182 of file Point3D.hpp.

double operator* ( const Point3D p1,
const Point3D p2 
)
friend

Definition at line 199 of file Point3D.hpp.

const Point3D operator* ( double  factor,
const Point3D p 
)
friend

Definition at line 210 of file Point3D.hpp.

const Point3D operator* ( const Point3D p,
double  factor 
)
friend

Definition at line 205 of file Point3D.hpp.

const Point3D operator+ ( const Point3D p1,
const Point3D p2 
)
friend

Definition at line 187 of file Point3D.hpp.

const Point3D operator- ( const Point3D p1,
const Point3D p2 
)
friend

Definition at line 193 of file Point3D.hpp.

const Point3D operator- ( const Point3D p)
friend

Definition at line 216 of file Point3D.hpp.

const Point3D operator/ ( const Point3D p,
double  divisor 
)
friend

Definition at line 221 of file Point3D.hpp.

bool operator== ( const Point3D p1,
const Point3D p2 
)
friend

Definition at line 173 of file Point3D.hpp.

Member Data Documentation

double datatypes::Point3D::m_x
private

Definition at line 32 of file Point3D.hpp.

double datatypes::Point3D::m_y
private

Definition at line 33 of file Point3D.hpp.

double datatypes::Point3D::m_z
private

Definition at line 34 of file Point3D.hpp.


The documentation for this class was generated from the following files:


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30