Next: 3D Convex Hull Algorithms Up: Basic Data Types for Previous: Rational Spheres ( d3_rat_sphere   Contents   Index

# Rational Simplices ( d3_rat_simplex )

Definition

An instance of the data type d3_rat_simplex is a simplex in 3d space. The simplex is defined by four points p1,p2,p3,p4 with rational coordinates (d3_rat_points). We call the simplex degenerate, if the four defining points are coplanar.

#include < LEDA/geo/d3_rat_simplex.h >

Types

 d3_rat_simplex::coord_type the coordinate type (rational). d3_rat_simplex::point_type the point type (d3_rat_point).

Creation

 d3_rat_simplex S(const d3_rat_point& a, const d3_rat_point& b, const d3_rat_point& c, const d3_rat_point& d) creates the simplex (a,b,c,d). d3_rat_simplex S creates the simplex ((0,0,0),(1,0,0),(0,1,0),(0,0,1) ).

Operations

 d3_simplex S.to_d3_simplex() returns a floating point approximation of S. d3_rat_point S.point1() returns p1. d3_rat_point S.point2() returns p2. d3_rat_point S.point3() returns p3. d3_rat_point S.point4() returns p4. d3_rat_point S[int i] returns pi. Precondition i>0 and i<5. int S.index(const d3_rat_point& p) returns 1 if p==p1, 2 if p==p2, 3 if p==p3, 4 if p==p4, 0 otherwise. bool S.is_degenerate() returns true if S is degenerate and false otherwise. d3_rat_sphere S.circumscribing_sphere() returns a d3_rat_sphere through (p1,p2,p3,p4) (precondition: the d3_rat_simplex is not degenerate). bool S.in_simplex(const d3_rat_point& p) returns true, if p is contained in the simplex. bool S.insphere(const d3_rat_point& p) returns true, if p lies in the interior of the sphere through p1,p2,p3,p4. rational S.vol() returns the signed volume of the simplex. d3_rat_simplex S.reflect(const d3_rat_point& p, const d3_rat_point& q, const d3_rat_point& v) returns S reflected across the plane through (p,q,v). d3_rat_simplex S.reflect(const d3_rat_point& p) returns S reflected across point p. d3_rat_simplex S.translate(const rat_vector& v) returns S translated by vector v. Precond.: v.dim()=3. d3_rat_simplex S.translate(rational dx, rational dy, rational dz) returns S translated by vector (dx,dy,dz). d3_rat_simplex S.translate(integer dx, integer dy, integer dz, integer dw) returns S translated by vector (dx/dw,dy/dw,dz/w). d3_rat_simplex S + const rat_vector& v returns S translated by vector v . d3_rat_simplex S - const rat_vector& v returns S translated by vector - v .

Next: 3D Convex Hull Algorithms Up: Basic Data Types for Previous: Rational Spheres ( d3_rat_sphere   Contents   Index
Christian Uhrig 2017-04-07