next up previous contents index
Next: Planes ( d3_plane ) Up: Basic Data Types for Previous: Segments in 3D-Space (   Contents   Index


Straight Lines in 3D-Space ( d3_line )

Definition

An instance l of the data type d3_line is a directed straight line in three-dimensional space.

#include < LEDA/geo/d3_line.h >

Creation

d3_line l(const d3_point& p1, const d3_point& p2)
    introduces a variable l of type d3_line. l is initialized to the line through points p1,p2.
Precondition: p1 != p2.

d3_line l(const d3_segment& s) introduces a variable l of type d3_line. l is initialized to the line supporting segment s.
Precondition: s is not trivial.

d3_line l introduces a variable l of type d3_line. l is initialized to the line through points (0,0,0) and (1,0,0).

Operations

bool l.contains(const d3_point& p)
    returns true if p lies on l.

d3_point l.point1() returns a point on l.

d3_point l.point2() returns a second point on l.

d3_segment l.seg() returns a non-trivial segment on l with the same direction.

bool l.project_xy(line& m) if the projection of l into the xy plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned.

bool l.project_xz(line& m) if the projection of l into the xz plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned.

bool l.project_yz(line& m) if the projection of l into the yz plane is not a point, the function returns true and assignes the projection to m. Otherwise false is returned.

bool l.project(const d3_point& p, const d3_point& q, const d3_point& v, d3_line& m)
    if the projection of l 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_line l.translate(double dx, double dy, double dz)
    returns l translated by vector (dx,dy,dz).

d3_line l.translate(const vector& v)
    returns l translated by v.
Precond.: v.dim()=3.

d3_line l + const vector& v returns l translated by vector v.

d3_line l - const vector& v returns l translated by vector - v.

d3_line l.reflect(const d3_point& p, const d3_point& q, const d3_point& v)
    returns l reflected across the plane through (p,q,v).

d3_line l.reflect(const d3_point& p)
    returns l reflected across point p.

d3_line l.reverse() returns l reversed.

vector l.to_vector() returns point2()-point1().

bool l.intersection(const d3_segment& s)
    decides, whether l and s intersect in a single point.

bool l.intersection(const d3_segment& s, d3_point& p)
    decides, whether l and s intersect in a single point. If so, the point of intersection is assigned to p.

bool l.intersection(const d3_line& m)
    decides, whether l and m intersect.

bool l.intersection(const d3_line& m, d3_point& p)
    decides, whether l and m intersect in a single point. If so, the point of intersection is assigned to p.

double l.sqr_dist(const d3_point& p)
    returns the square of the distance between l and p.

double l.distance(const d3_point& p)
    returns the distance between l and p.


next up previous contents index
Next: Planes ( d3_plane ) Up: Basic Data Types for Previous: Segments in 3D-Space (   Contents   Index
root 2008-01-09