RobWorkProject  23.9.11-
Public Member Functions | Friends | List of all members
Ray Class Reference

A ray - an infinitely extending half-line described by a starting position and a direction. More...

#include <Ray.hpp>

Inherits Line.

Public Member Functions

 Ray (rw::math::Vector3D< double > &pos, rw::math::Vector3D< double > &dir)
 constructor More...
 
virtual ~Ray ()
 Destructor.
 
rw::math::Vector3D< double > & pos ()
 Get the position from which the ray starts.
 
const rw::math::Vector3D< double > & pos () const
 Get the position from which the ray starts.
 
rw::math::Vector3D< double > & dir ()
 Get the direction in which the ray shoots.
 
const rw::math::Vector3D< double > & dir () const
 Get the direction in which the ray shoots.
 
TriMesh::Ptr createMesh (int resolution) const
 make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into More...
 
rw::math::Q getParameters () const
 get the parameters that define this primitive More...
 
GeometryType getType () const
 the type of this primitive More...
 
- Public Member Functions inherited from Line
 Line ()
 Constructor. More...
 
 Line (const rw::math::Q &params)
 Constructor. More...
 
 Line (const rw::math::Vector3D< double > &p1, const rw::math::Vector3D< double > &p2)
 Constructor. More...
 
virtual ~Line ()
 destructor
 
rw::math::Vector3D< double > & p1 ()
 Get point 1.
 
const rw::math::Vector3D< double > & p1 () const
 Get point 1.
 
rw::math::Vector3D< double > & p2 ()
 Get point 2.
 
const rw::math::Vector3D< double > & p2 () const
 Get point 2.
 
rw::math::Vector3D< double > dir () const
 Get a direction vector u = normalize(p2 - p1).
 
double distance (const rw::math::Vector3D< double > &point) const
 Calculates the shortest distance from a point to the line. More...
 
double distance (const Line &line) const
 Calculates the shortest distance to another line. More...
 
rw::math::Vector3D< double > closestPoint (const rw::math::Vector3D< double > &point) const
 Finds a point on the line closest to specified point. More...
 
double refit (const std::vector< rw::math::Vector3D< double >> &data)
 Fit this line to a set of points. More...
 
double refit (const std::vector< rw::math::Vector3D< double >>::const_iterator begin, const std::vector< rw::math::Vector3D< double >>::const_iterator end)
 
virtual void setParameters (const rw::math::Q &q)
 set the parameters that define this primitive More...
 
- Public Member Functions inherited from Primitive
virtual ~Primitive ()
 destructor
 
TriMesh::Ptr getTriMesh (bool forceCopy=true)
 gets a trimesh representation of this geometry data. More...
 
virtual bool isConvex ()
 test if this geometry data is convex More...
 
bool isInside (const rw::math::Vector3D< double > &point)
 test if a point is on the border or inside this primitive
 
- Public Member Functions inherited from GeometryData
virtual ~GeometryData ()
 Destructor.
 

Friends

std::ostream & operator<< (std::ostream &out, const Ray &ray)
 Streaming operator.
 

Additional Inherited Members

- Public Types inherited from Line
typedef rw::core::Ptr< LinePtr
 Smart pointer to Line.
 
typedef double value_type
 Type of internal values.
 
- Public Types inherited from Primitive
typedef rw::core::Ptr< PrimitivePtr
 Smart pointer to this type of class.
 
- Public Types inherited from GeometryData
enum  GeometryType {
  PointCloud , LineMesh , PlainTriMesh , IdxTriMesh ,
  SpherePrim , BoxPrim , OBBPrim , AABBPrim ,
  LinePrim , PointPrim , PyramidPrim , ConePrim ,
  TrianglePrim , CylinderPrim , TubePrim , PlanePrim ,
  RayPrim , Implicit , Quadratic , UserType
}
 geometry data types
 
typedef rw::core::Ptr< GeometryDataPtr
 smart pointer type to this class
 
typedef rw::core::Ptr< const GeometryDataCPtr
 const smart pointer type to this class
 
- Static Public Member Functions inherited from Line
static std::vector< LinemakeGrid (int dim_x, int dim_y, double size_x=1.0, double size_y=1.0, const rw::math::Vector3D< double > &xdir=rw::math::Vector3D< double >::x(), const rw::math::Vector3D< double > &ydir=rw::math::Vector3D< double >::y())
 Create set of lines making a grid.
 
static rw::math::Metric< Line >::Ptr makeMetric (double angToDistWeight=1.0)
 create a metric that can be used to compare the difference between two lines. The distance between two lines is computed as follows: More...
 
- Static Public Member Functions inherited from GeometryData
static std::string toString (GeometryType type)
 format GeometryType to string More...
 
- Protected Member Functions inherited from Primitive
virtual bool doIsInside (const rw::math::Vector3D< double > &point)
 Check if point lies inside geometry. More...
 
 Primitive (int levels=20)
 Constructor. More...
 

Detailed Description

A ray - an infinitely extending half-line described by a starting position and a direction.

Constructor & Destructor Documentation

◆ Ray()

Ray ( rw::math::Vector3D< double > &  pos,
rw::math::Vector3D< double > &  dir 
)
inline

constructor

Parameters
pos[in] position from which the ray starts
dir[in] direction in which the ray shoots

Member Function Documentation

◆ createMesh()

TriMesh::Ptr createMesh ( int  resolution) const
inlinevirtual

make a trimesh from this primitive. Use granularity to specify minimum number of line segments a half circle is split into

Parameters
resolution[in]

Reimplemented from Line.

◆ getParameters()

rw::math::Q getParameters ( ) const
inlinevirtual

get the parameters that define this primitive

Reimplemented from Line.

◆ getType()

GeometryType getType ( ) const
inlinevirtual

the type of this primitive

Reimplemented from Line.


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