Definition
An instance of the data type d3_point is a point in the three-dimensional space R ^3. We use (x,y,z) to denote a point with first (or x-) coordinate x, second (or y-) coordinate y, and third (or z-) coordinate z.
Creation
d3_point | p; | introduces a variable p of type d3_point initialized to the point (0,0,0). |
d3_point |
p(double x, double y, double z); | |
introduces a variable p of type d3_point initialized to the point (x,y,z). | ||
d3_point | p(vector v); | introduces a variable p of type d3_point initialized
to the point (v[0],v[1],v[2]).
Precondition: v.dim() = 3. |
|
Operations
double | p.xcoord() | returns the first coordinate of p. |
double | p.ycoord() | returns the second coordinate of p. |
double | p.zcoord() | returns the third coordinate of p. |
vector | p.to_vector() | returns the vector ![]() |
point | p.project_xy() | returns p projected into the xy-plane. |
point | p.project_yz() | returns p projected into the yz-plane. |
point | p.project_xz() | returns p projected into the xz-plane. |
double | p.sqr_dist(d3_point q) | returns the square of the Euclidean distance between p and q. |
double | p.xdist(d3_point q) | returns the x-distance between p and q. |
double | p.ydist(d3_point q) | returns the y-distance between p and q. |
double | p.zdist(d3_point q) | returns the z-distance between p and q. |
double | p.distance(d3_point q) | returns the Euclidean distance between p and q. |
d3_point | p.translate(double dx, double dy, double dz) | |
returns p translated by vector (dx,dy,dz). | ||
d3_point | p.translate(vector v) | returns p+v, i.e., p translated by vector
v.
Precondition: v.dim() = 3. |
d3_point | p + vector v | returns p translated by vector v. |
d3_point | p - vector v | returns p translated by vector -v. |
d3_point | p.reflect(d3_point q, d3_point r, d3_point s) | |
returns p reflected across the plane passing through q, r and s. | ||
d3_point | p.reflect(d3_point q) | returns p reflected across point q. |
vector | p - q | returns the difference vector of the coordinates. |
ostream& | ostream& O << p | writes p to output stream O. |
istream& | istream& I >> d3_point& p | reads the coordinates of p (three double numbers) from input stream I. |
Non-Member Functions
d3_point | center(d3_point a, d3_point b) | |
returns the center of a and b, i.e.
![]() |
||
d3_point | midpoint(d3_point a, d3_point b) | |
returns the center of a and b. | ||
int | orientation(d3_point a, d3_point b, d3_point c, d3_point d) | |
computes the orientation of points a, b, c, and d as
the sign of the determinant
![]() |
||
double | volume(d3_point a, d3_point b, d3_point c, d3_point d) | |
computes the signed volume of the simplex determined by a,b, c, and d, positive if orientation(a,b,c,d) > 0 and negative otherwise. | ||
bool | collinear(d3_point a, d3_point b, d3_point c) | |
returns true if points a, b, c are collinear and false otherwise. | ||
bool | coplanar(d3_point a, d3_point b, d3_point c, d3_point d) | |
returns true if points a, b, c, d are coplanar and false otherwise. | ||
int | side_of_sphere(d3_point a, d3_point b, d3_point c, d3_point d, d3_point x) | |
returns +1 (-1) if point x lies on the positive (negative) side of the oriented sphere through points a, b, c, and d, and 0 if x is contained in this sphere. | ||
int | region_of_sphere(d3_point a, d3_point b, d3_point c, d3_point d, d3_point x) | |
determines whether the point x lies inside (= +1), on (= 0),
or outside (= -1) the sphere through points a,b,c,d,
(equivalent to orientation(a,b,c,d) * side_of_sphere(a,b,c,d,x)) Precondition: orientation(A) != 0 |
||
bool | contained_in_simplex(d3_point a, d3_point b, d3_point c, d3_point d, d3_point x) | |
determines whether x is contained in the simplex spanned
by the points a,b,c,d.
Precondition: a,b,c,d are affinely independent. |
||
bool | contained_in_simplex(array<d3_point> A, d3_point x) | |
determines whether x is contained in the simplex spanned
by the points in A.
Precondition: A must have size <= 4 and the points in A must be affinely independent. |
||
bool | contained_in_affine_hull(list<d3_point> L, d3_point x) | |
determines whether x is contained in the affine hull of the points in L. | ||
bool | contained_in_affine_hull(array<d3_point> A, d3_point x) | |
determines whether x is contained in the affine hull of the points in A. | ||
int | affine_rank(array<d3_point> L) | |
computes the affine rank of the points in L. | ||
int | affine_rank(array<d3_point> A) | |
computes the affine rank of the points in A. | ||
bool | affinely_independent(list<d3_point> L) | |
decides whether the points in A are affinely independent. | ||
bool | affinely_independent(array<d3_point> A) | |
decides whether the points in A are affinely independent. | ||
bool | insphere(d3_point a, d3_point b, d3_point c, d3_point d, d3_point e) | |
returns true if e lies in the interior of the sphere through a, b, c, and d, and false otherwise. | ||
bool | outsphere(d3_point a, d3_point b, d3_point c, d3_point d, d3_point e) | |
returns true if e lies in the exterior of the sphere through a, b, c, and d, and false otherwise. | ||
bool | onsphere(d3_point a, d3_point b, d3_point c, d3_point d, d3_point e) | |
returns true if a, b, c, d, and e lie on a common sphere. | ||
d3_point | point_on_positive_side(d3_point a, d3_point b, d3_point c) | |
returns point a + (b-a)x (c-a). |