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

# Rational Planes ( d3_rat_plane )

Definition

An instance P of the data type d3_rat_plane is an oriented rational plane in the three-dimensional space R3. It can be defined by a tripel (a,b,c) of non-collinear rational points or a single rational point a and a normal vector v.

#include < LEDA/geo/d3_rat_plane.h >

Creation

 d3_rat_plane p introduces a variable p of type d3_rat_plane initialized to the trivial plane. d3_rat_plane p(const d3_rat_point& a, const d3_rat_point& b, const d3_rat_point& c) introduces a variable p of type d3_rat_plane initialized to the plane through (a, b, c). Precondition a, b, and c are not collinear. d3_rat_plane p(const d3_rat_point& a, const rat_vector& v) introduces a variable p of type d3_rat_plane initialized to the plane that contains a with normal vector v. Precondition v.dim() = 3 and v.length() > 0. d3_rat_plane p(const d3_rat_point& a, const d3_rat_point& b) introduces a variable p of type d3_rat_plane initialized to the plane that contains a with normal vector b - a.

Operations

 d3_rat_point p.point1() returns the first point of p. d3_rat_point p.point2() returns the second point of p. d3_rat_point p.point3() returns the third point of p. integer p.A() returns the A parameter of the plane equation. integer p.B() returns the B parameter of the plane equation. integer p.C() returns the C parameter of the plane equation. integer p.D() returns the D parameter of the plane equation. rat_vector p.normal() returns a normal vector of p. d3_plane p.to_float() returns a floating point approximation of p. rational p.sqr_dist(const d3_rat_point& q) returns the square of the Euclidean distance between p and q. rat_vector p.normal_project(const d3_rat_point& q) returns the vector pointing from q to its projection on p along the normal direction. int p.intersection(const d3_rat_point p1, const d3_rat_point p2, d3_rat_point& q) if the line l through p1 and p2 intersects p in a single point this point is assigned to q and the result is 1, if l and p do not intersect the result is 0, and if l is contained in p the result is 2. int p.intersection(const d3_rat_plane& Q, d3_rat_point& i1, d3_rat_point& i2) if p and plane Q intersect in a line L then (i1, i2) are assigned two different points on L and the result is 1, if p and Q do not intersect the result is 0, and if p = Q the result is 2. d3_rat_plane p.translate(const rational& dx, const rational& dy, const rational& dz) returns p translated by vector (dx, dy, dz). d3_rat_plane p.translate(integer dx, integer dy, integer dz, integer dw) returns p translated by vector (dx/dw, dy/dw, dz/dw). d3_rat_plane p.translate(const rat_vector& v) returns p+ v, i.e., p translated by vector v. Precondition v.dim() = 3. d3_rat_plane p + const rat_vector& v returns p translated by vector v. d3_rat_plane p.reflect(const d3_rat_plane& Q) returns p reflected across plane Q. d3_rat_plane p.reflect(const d3_rat_point& q) returns p reflected across point q. d3_rat_point p.reflect_point(const d3_rat_point& q) returns q reflected across plane p. int p.side_of(const d3_rat_point& q) computes the side of p on which q lies. bool p.contains(const d3_rat_point& q) returns true if point q lies on plane p, i.e., (p.side_of(q) == 0), and false otherwise . bool p.parallel(const d3_rat_plane& Q) returns true if planes p and Q are parallel, and false otherwise. ostream& ostream& O « const d3_rat_plane& p writes p to output stream O. istream& istream& I » d3_rat_plane& p reads p from input stream I.

Non-Member Functions

 int orientation(const d3_rat_plane& p, const d3_rat_point& q) computes the orientation of p.sideof(q).

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