next up previous contents index
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/d3 _plane.h >

Creation

d3_plane p introduces a variable p of type d3_plane initialized to the xy-plane.

d3_plane p(d3_point a, d3_point b, 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(d3_point a, 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(d3_point a, 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.

vector p.normal() returns a normal vector of p.

double p.sqr_dist(d3_point q) returns the square of the Euclidean distance between p and q.

double p.distance(d3_point q) returns the Euclidean distance between p and q.

vector p.normal_project(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(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(vector v) returns p+ v, i.e., p translated by vector v.
Precondition v.dim() = 3.

d3_plane p + vector v returns p translated by vector v.

d3_plane p.reflect(d3_plane Q) returns p reflected across plane Q.

d3_plane p.reflect(d3_point q) returns p reflected across point q.

d3_point p.reflect_point(d3_point q)
    returns q reflected across plane p.

int p.side_of(d3_point q) computes the side of p on which q lies.

bool p.contains(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(d3_plane Q) returns true if planes p and Q are parallel and false otherwise.

ostream& ostream& O << 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(d3_plane p, d3_point q)
    computes the orientation of p.sideof(q).


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