Next: Segments in 3D-Space ( Up: Basic Data Types for Previous: Points in 3D-Space (   Contents   Index

Straight Rays in 3D-Space ( d3_ray )

Definition

An instance r of the data type d3_ray is a directed straight ray in three-dimensional space.

#include < LEDA/geo/d3_ray.h >

Creation

 d3_ray r(const d3_point& p1, const d3_point& p2) introduces a variable r of type d3_ray. r is initialized to the ray starting at point p1 and going through p2. d3_ray r(const d3_segment& s) introduces a variable r of type d3_ray. r is initialized to ray(s.source(),s.target()) .

Operations

 d3_point r.source() returns the source of r. d3_point r.point1() returns the source of r. d3_point r.point2() returns a point on r different from the source. d3_segment r.seg() returns a segment on r. bool r.contains(const d3_point& p) returns true if p lies on r. bool r.contains(const d3_segment& s) returns true if s lies on r. bool r.intersection(const d3_segment& s, d3_point& inter) if s and r intersect in a single point, true is returned and the point of intersection is assigned to inter. Otherwise false is returned. bool r.intersection(const d3_ray& r, d3_point& inter) if r and r intersect in a single point, true is returned and the point of intersection is assigned to inter. Otherwise false is returned. bool r.project_xy(ray& m) if the projection of r into the xy plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned. bool r.project_xz(ray& m) if the projection of r into the xz plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned. bool r.project_yz(ray& m) if the projection of r into the yz plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned. bool r.project(const d3_point& p, const d3_point& q, const d3_point& v, d3_ray& m) if the projection of r into the plane through (p,q,v) is not a point, the function returns true and assignes the projection to m. Otherwise false is returned. d3_ray r.reverse() returns a ray starting at r.source() with direction -r.to_vector(). d3_ray r.translate(const vector& v) returns r translated by vector v. Precond. : v.dim() = 3 . d3_ray r.translate(double dx, double dy, double dz) returns r translated by vector (dx,dy,dz). d3_ray r + const vector& v returns r translated by vector v. d3_ray r - const vector& v returns r translated by vector - v. d3_ray r.reflect(const d3_point& p, const d3_point& q, const d3_point& v) returns r reflected across the plane through (p,q,v). d3_ray r.reflect(const d3_point& p) returns r reflected across p. vector r.to_vector() returns point2()-point1().

Next: Segments in 3D-Space ( Up: Basic Data Types for Previous: Points in 3D-Space (   Contents   Index