next up previous contents index
Next: Rational Planes ( d3_rat_plane Up: Basic Data Types for Previous: Rational Lines in 3D-Space   Contents   Index


Rational Segments in 3D-Space ( d3_rat_segment )

Definition

An instance s of the data type d3$ \_$rat$ \_$segment is a directed straight line segment in three-dimensional space, i.e., a line segment connecting two rational points p, q $ \in$ R3. p is called the source or start point and q is called the target or end point of s. A segment is called trivial if its source is equal to its target. If s is not trivial, we use line(s) to denote the straight line containing s.

#include < LEDA/d3 _rat _segment.h >

Creation

d3_rat_segment s(d3_rat_point p1, d3_rat_point p2)
    introduces a variable S of type d3_rat_segment. S is initialized to the segment through points p1,p2.

d3_rat_segment s introduces a variable S of type d3_rat_segment. S is initialized to the segment through points (0,0,0,1) and (1,0,0,1).

Operations

d3_segment s.to_float() returns a floating point approximation of s.

bool s.contains(d3_rat_point p)
    decides whether s contains p.

d3_rat_point s.source() returns the source point of segment s.

d3_rat_point s.target() returns the target point of segment s.

rational s.xcoord1() returns the x-coordinate of s.source().

rational s.xcoord2() returns the x-coordinate of s.target().

rational s.ycoord1() returns the y-coordinate of s.source().

rational s.ycoord2() returns the y-coordinate of s.target().

rational s.zcoord1() returns the z-coordinate of s.source().

rational s.zcoord2() returns the z-coordinate of s.target().

rational s.dx() returns xcoord2()-xcoord1().

rational s.dy() returns ycoord2()-ycoord1().

rational s.dz() returns zcoord2()-zcoord1().

rat_segment s.project_xy() returns the projection into the xy plane.

rat_segment s.project_xz() returns the projection into the xz plane.

rat_segment s.project_yz() returns the projection into the yz plane.

d3_rat_segment s.project(d3_rat_point p, d3_rat_point q, d3_rat_point v)
    returns s projected into the plane through (p,q,v).

d3_rat_segment s.reflect(d3_rat_point p, d3_rat_point q, d3_rat_point v)
    returns s reflected across the plane through (p,q,v).

d3_rat_segment s.reflect(d3_rat_point p) returns s reflected across point p.

d3_rat_segment s.reverse() returns s reversed.

rat_vector s.to_vector() returns S.target()-S.source().

bool s.intersection(d3_rat_segment t)
    decides, whether s and t intersect in a single point.

bool s.intersection(d3_rat_segment t, d3_rat_point& p)
    decides, whether s and t intersect. If they intersect in a single point, the point is assigned to p

bool s.intersection_of_lines(d3_rat_segment t, d3_rat_point& p)
    If line(s) and line(t) intersect in a single point this point is assigned to p and the result is true, otherwise the result is false.

bool s.is_trivial() returns true if s is trivial.

rational s.sqr_length() returns the square of the length of s.

d3_rat_segment s.translate(rat_vector v) returns s translated by vector v.
Precond.: v.dim()=3.

d3_rat_segment s.translate(rational dx, rational dy, rational dz)
    returns s translated by vector (dx,dy,dz).

d3_rat_segment s.translate(integer dx, integer dy, integer dz, integer dw)
    returns s translated by vector (dx/dw,dy/dw,dz/w).

d3_rat_segment s + rat_vector v returns s translated by vector v.

d3_rat_segment s - rat_vector v returns s translated by vector - v.


next up previous contents index
Next: Rational Planes ( d3_rat_plane Up: Basic Data Types for Previous: Rational Lines in 3D-Space   Contents   Index
LEDA research project
2000-02-09