     Next: Spheres in 3D-Space ( Up: Basic Data Types for Previous: Straight Lines in 3D-Space   Contents   Index

# Planes ( d3_plane )

Definition

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

#include < LEDA/geo/d3_plane.h >

Creation

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

Operations

 d3_point p.point1() returns the first point of p. d3_point p.point2() returns the second point of p. d3_point p.point3() returns the third point of p. double p.A() returns the A parameter of the plane equation. double p.B() returns the B parameter of the plane equation. double p.C() returns the C parameter of the plane equation. double p.D() returns the D parameter of the plane equation. vector p.normal() returns a normal vector of p. double p.sqr_dist(const d3_point& q) returns the square of the Euclidean distance between p and q. double p.distance(const d3_point& q) returns the Euclidean distance between p and q. int p.cmp_distances(const d3_point& p1, const d3_point& p2) compares the distances of p1 and p2 to p and returns the result. vector p.normal_project(const d3_point& q) returns the vector pointing from q to its projection on p along the normal direction. int p.intersection(const d3_point p1, const d3_point p2, d3_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_plane& Q, d3_point& i1, d3_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_plane p.translate(double dx, double dy, double dz) returns p translated by vector (dx, dy, dz). d3_plane p.translate(const vector& v) returns p+ v, i.e., p translated by vector v. Precondition v.dim() = 3. d3_plane p + const vector& v returns p translated by vector v. d3_plane p.reflect(const d3_plane& Q) returns p reflected across plane Q. d3_plane p.reflect(const d3_point& q) returns p reflected across point q. d3_point p.reflect_point(const d3_point& q) returns q reflected across plane p. int p.side_of(const d3_point& q) computes the side of p on which q lies. bool p.contains(const d3_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_plane& Q) returns true if planes p and Q are parallel and false otherwise. ostream& ostream& O « const d3_plane& p writes p to output stream O. istream& istream& I » d3_plane& p reads the coordinates of p (six double numbers) from input stream I.

Non-Member Functions

 int orientation(const d3_plane& p, const d3_point& q) computes the orientation of p.sideof(q).     Next: Spheres in 3D-Space ( Up: Basic Data Types for Previous: Straight Lines in 3D-Space   Contents   Index