Antiprism 0.23
|
Vector utilities. More...
Functions | |
vec3d | centroid (const vector< vec3d > &pts, const vector< int > &idxs=vector< int >()) |
Get the centroid of a set of points. | |
vec3d | line_plane_intersect (vec3d Q, vec3d n, vec3d P0, vec3d P1, int *where=0, double eps=epsilon) |
Get the point of intersection of a line and a plane. | |
vec3d | line_plane_intersect (vec3d Q0, vec3d Q1, vec3d Q2, vec3d P0, vec3d P1, int *where=0, double eps=epsilon) |
Get the point of intersection of a line and a plane. | |
bool | two_plane_intersect (vec3d Q0, vec3d n0, vec3d Q1, vec3d n1, vec3d &P, vec3d &dir, double eps=epsilon) |
Get the line where two planes intersect. | |
bool | lines_nearest_points (vec3d P0, vec3d P1, vec3d Q0, vec3d Q1, vec3d &P, vec3d &Q, double eps=epsilon) |
Get the nearest point on a line to another (skew) line. | |
vec3d | nearest_point (vec3d P, vec3d Q0, vec3d Q1) |
Get the nearest point on a line to a particular point. | |
vec3d | nearest_point (vec3d P, vec3d Q0, vec3d Q1, vec3d Q2, double eps=epsilon) |
Get the nearest point on a plane to a particular point. | |
vec3d | nearest_point (vec3d P, const vector< vec3d > &points, double eps=epsilon) |
Get the nearest point on a space to a particular point. | |
vec3d | nearest_point (vec3d P, const vector< vec3d > &points, const vector< int > &idxs, double eps=epsilon) |
Get the nearest point on a space to a particular point. | |
vec3d | face_norm (const vector< vec3d > &verts, const vector< int > &face, bool allow_zero=false) |
Get a face normal and face area. | |
double | angle_around_axis (const vec3d &v0, const vec3d &v1, const vec3d &axis) |
Get the angle required to rotate one vector onto another around an axis. | |
vec3d | lines_intersection (const vec3d &P0, const vec3d &P1, const vec3d &Q0, const vec3d &Q1, double eps=epsilon) |
Get the point of intersection between two lines. |
Vector utilities.
Get the angle required to rotate one vector onto another around an axis.
v0 | vector to rotate (perpendicular to axis) |
v1 | vector to rotate onto (perpendicular to axis) |
axis | axis to rotate around (perpendicular to v0 and v1) |
Get the centroid of a set of points.
pts | the points |
idxs | the index numbers of the points to use, or if none (the default) then use all the points. |
vec3d face_norm | ( | const vector< vec3d > & | verts, |
const vector< int > & | face, | ||
bool | allow_zero = false |
||
) |
Get a face normal and face area.
verts | a set of vertices |
face | the index numbers of the vertices in verts that make the face. |
allow_zero | if true then the length of the returned normal is the area of the face, if false then this will not be true for faces with a signed area close to zero. |
vec3d line_plane_intersect | ( | vec3d | Q, |
vec3d | n, | ||
vec3d | P0, | ||
vec3d | P1, | ||
int * | where = 0 , |
||
double | eps = epsilon |
||
) |
Get the point of intersection of a line and a plane.
Q | a point on the plane. |
n | the normal to the plane |
P0 | a point on the line |
P1 | a second point on the line |
where | to return the the intersection point was relative to the two points on the line, the meaning of the values is
|
eps | value for contolling the limit of precision |
vec3d line_plane_intersect | ( | vec3d | Q0, |
vec3d | Q1, | ||
vec3d | Q2, | ||
vec3d | P0, | ||
vec3d | P1, | ||
int * | where = 0 , |
||
double | eps = epsilon |
||
) |
Get the point of intersection of a line and a plane.
Q0 | a point on the plane. |
Q1 | a second point on the plane. |
Q2 | a third points on the plane, not on the line Q0Q1. |
P0 | a point on the line |
P1 | a second point on the line |
where | to return the the intersection point was relative to the two points on the line, the meaning of the values is
|
eps | value for contolling the limit of precision |
vec3d lines_intersection | ( | const vec3d & | P0, |
const vec3d & | P1, | ||
const vec3d & | Q0, | ||
const vec3d & | Q1, | ||
double | eps = epsilon |
||
) |
Get the point of intersection between two lines.
P0 | a point on the first line. |
P1 | another point on the first line. |
Q0 | a point on the second line. |
Q1 | another point on the second line. |
eps | value for controlling the limit of precision. If eps is 0 then always return an intersection point, even if lines are skew or parallel. |
bool lines_nearest_points | ( | vec3d | P0, |
vec3d | P1, | ||
vec3d | Q0, | ||
vec3d | Q1, | ||
vec3d & | P, | ||
vec3d & | Q, | ||
double | eps = epsilon |
||
) |
Get the nearest point on a line to another (skew) line.
P0 | a point on the first line. |
P1 | another point on the first line. |
Q0 | a point on the second line. |
Q1 | another point on the second line. |
P | to return the nearest point on the first line. |
Q | to return the nearest point on the second line. |
eps | value for contolling the limit of precision |
true
if there is one nesarpoint per line, otherwise false
(the lines are parallel.) Get the nearest point on a plane to a particular point.
P | a point. |
Q0 | a point on the plane. |
Q1 | a second point on the plane. |
Q2 | a third points on the plane, not on the line Q0Q1. |
eps | value for contolling the limit of precision |
Get the nearest point on a space to a particular point.
P | a point. |
points | independant points determining the space (one, two or three points as the space is a point, line or plane.) |
eps | value for contolling the limit of precision |
Get the nearest point on a line to a particular point.
P | a point. |
Q0 | a point on the line. |
Q1 | another point on the line. |
vec3d nearest_point | ( | vec3d | P, |
const vector< vec3d > & | points, | ||
const vector< int > & | idxs, | ||
double | eps = epsilon |
||
) |
Get the nearest point on a space to a particular point.
P | a point. |
points | a set of points. |
idxs | the index numbers of independant points from points that determine the space (one, two or three index numbers as the space is a point, line or plane.) |
eps | value for contolling the limit of precision |
bool two_plane_intersect | ( | vec3d | Q0, |
vec3d | n0, | ||
vec3d | Q1, | ||
vec3d | n1, | ||
vec3d & | P, | ||
vec3d & | dir, | ||
double | eps = epsilon |
||
) |
Get the line where two planes intersect.
Q0 | a point on the first plane. |
n0 | the normal to the first plane. |
Q1 | a point on the second plane. |
n1 | the normal to the second plane. |
P | to return a point on the line of intersection. |
dir | to return the direction of the line of intersection. |
eps | value for contolling the limit of precision |
true
if the planes intersect, otherwise false
.