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

# Straight Rational Rays in 3D-Space ( d3_rat_ray )

Definition

An instance r of the data type d3_rat_ray is a directed straight ray defined by two points with rational coordinates in three-dimensional space.

#include < LEDA/geo/d3_rat_ray.h >

Creation

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

Operations

 d3_rat_point r.source() returns the source of r. d3_rat_point r.point1() returns the source of r. d3_rat_point r.point2() returns a point on r different from the source. d3_rat_segment r.seg() returns a segment on r. bool r.contains(const d3_rat_point& p) returns true if p lies on r. bool r.contains(const d3_rat_segment& s) returns true if s lies on r. bool r.intersection(const d3_rat_segment& s, d3_rat_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_rat_ray& r, d3_rat_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(rat_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(rat_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(rat_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_rat_point& p, const d3_rat_point& q, const d3_rat_point& v, d3_rat_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_rat_ray r.reverse() returns a rat_ray starting at r.source() with direction -r.to_vector() . d3_rat_ray r.translate(const rat_vector& v) returns r translated by vector v. Precond. : v.dim() = 3 . d3_rat_ray r.translate(rational dx, rational dy, rational dz) returns r translated by vector (dx,dy,dz). d3_rat_ray r + const rat_vector& v returns r translated by vector v. d3_rat_ray r - const rat_vector& v returns r translated by vector - v. d3_rat_ray r.reflect(const d3_rat_point& p, const d3_rat_point& q, const d3_rat_point& v) returns r reflected across the plane through (p,q,v). d3_rat_ray r.reflect(const d3_rat_point& p) returns r reflected across point p. rat_vector r.to_vector() returns point2()-point1().     Next: Rational Lines in 3D-Space Up: Basic Data Types for Previous: Rational Points in 3D-Space   Contents   Index