Class ray

Inheritance Relationships

Base Type

Class Documentation

class acme::ray : public acme::entity

Ray class container.

Infinite ray in 3D space and defined by any point lying on the line and a direction vector.

Public Types

typedef std::shared_ptr<entity> ptr

Shared pointer to entity object.

typedef std::vector<ptr> vecptr

Vector of pointers to entity objects.

Public Functions

ray(ray const&) = default

Ray copy constructor.

ray(ray&&) = default

Ray move constructor.

ray &operator=(const ray&) = default

Ray assignment operator.

ray &operator=(ray&&) = default

Ray move assignment operator.

~ray(void) override = default

Ray class destructor.

ray(void)

Ray class constructor.

ray(real origin_x, real origin_y, real origin_z, real direction_x, real direction_y, real direction_z)

Ray class constructor.

Parameters
  • origin_x – Input x value of ray origin point

  • origin_y – Input y value of ray origin point

  • origin_z – Input z value of ray origin point

  • direction_x – Input x value of ray direction

  • direction_y – Input y value of ray direction

  • direction_z – Input z value of ray direction

ray(point const &origin, vec3 const &direction)

Ray class constructor.

Parameters
  • origin – Input ray origin point

  • direction – Input ray direction vector

bool isApprox(ray const &ray_in, real tolerance = EPSILON) const

Check if ray objects are (almost) equal.

Parameters
  • ray_in – Input ray object

  • tolerance – Tolerance

point const &origin(void) const

Return ray origin point const reference.

vec3 const &direction(void) const

Return ray direction vector const reference.

point &origin(void)

Return ray origin point reference.

vec3 &direction(void)

Return ray direction vector reference.

void normalize(void)

Normalize ray direction vector.

vec3 toVector(void) const

Convert ray to vector.

vec3 toUnitVector(void) const

Convert ray to normalized vector.

void reverse(void)

Reverse ray direction.

virtual void translate(vec3 const &vector) override

Translate ray by vector.

Parameters

vector – Input translation vector

virtual void transform(affine const &affine_in) override

Transform ray with affine transformation matrix.

Parameters

affine_in – 4x4 affine transformation matrix

bool isInside(point const &point_in, real tolerance = EPSILON) const

Check whether the point is inside the ray.

Parameters
  • point_in – Query point

  • tolerance – Tolerance

virtual bool isDegenerated(real tolerance = EPSILON) const override

Check if ray is degenerated (null vector)

Parameters

tolerance – Tolerance

inline virtual integer level(void) const override

Return object hierarchical level.

inline virtual std::string type(void) const override

Return object type as string.

inline virtual bool isNone(void) const override

Check whether the object is no entity.

inline virtual bool isPoint(void) const override

Check whether the object is a point.

inline virtual bool isLine(void) const override

Check whether the object is a line.

inline virtual bool isRay(void) const override

Check whether the object is a ray.

inline virtual bool isPlane(void) const override

Check whether the object is a plane.

inline virtual bool isSegment(void) const override

Check whether the object is a segment.

inline virtual bool isTriangle(void) const override

Check whether the object is a triangle.

inline virtual bool isDisk(void) const override

Check whether the object is a disk.

inline virtual bool isBall(void) const override

Check whether the object is a ball.

inline virtual bool isClampable(void) const override

Check whether in the ray is clampable.

inline virtual bool isNonClampable(void) const override

Check whether in the ray is non-clampable.

virtual bool clamp(vec3 &min, vec3 &max) const override

Get minumum and maximum values along axes.

Parameters
  • min – Input minimum point

  • max – Input maximum point

virtual bool clamp(real &min_x, real &min_y, real &min_z, real &max_x, real &max_y, real &max_z) const override

Get minumum and maximum values along axes.

Parameters
  • min_x – Input x value of minimum point

  • min_y – Input y value of minimum point

  • min_z – Input z value of minimum point

  • max_x – Input x value of maximum point

  • max_y – Input y value of maximum point

  • max_z – Input z value of maximum point

void rotate(real angle, vec3 const &axis)

Rotate entity by a rotation angle around an arbitrary axis.

Parameters
  • angle – Input angle [rad]

  • axis – Input axis

inline bool isEntity(void) const

Check whether the object is an entity.