omdl
v0.5
OpenSCAD Mechanical Design Library
|
Point, vector, and plane computations. More...
Files | |
file | math.scad |
Mathematical functions. | |
Functions | |
function | distance_pp (p1, p2) |
Compute the distance between two points in a Euclidean 1, 2, or 3D-space. More... | |
function | dot_vv (v1t, v2t, v1i, v2i) |
Compute the dot product of two vectors. More... | |
function | cross_vv (v1t, v2t, v1i, v2i) |
Compute the cross product of two vectors in a Euclidean 3D-space (2D). More... | |
function | striple_vvv (v1t, v2t, v3t, v1i, v2i, v3i) |
Compute scalar triple product of two vectors in a Euclidean 3D-space. More... | |
function | angle_vv (v1t, v2t, v1i, v2i) |
Compute the angle between two vectors in a Euclidean 2 or 3D-space. More... | |
function | angle_vvn (v1t, v2t, nvt, v1i, v2i, nvi) |
Compute the angle between two vectors in a Euclidean 3D-space. More... | |
function | unit_v (vt, vi) |
Compute the normalized unit vector for a 1, 2, or 3 term vector. More... | |
function | are_coplanar_vvv (v1t, v2t, v3t, v1i, v2i, v3i) |
Test if three vectors are coplanar in Euclidean 3D-space. More... | |
Point, vector, and plane computations.
See validation results.
function angle_vv | ( | v1t | , |
v2t | , | ||
v1i | , | ||
v2i | |||
) |
Compute the angle between two vectors in a Euclidean 2 or 3D-space.
v1t | <vector> Vector 1 head. A 2 or 3-tuple of coordinates. |
v2t | <vector> Vector 2 head. A 2 or 3-tuple of coordinates. |
v1i | <vector> Vector 1 tail. A 2 or 3-tuple of coordinates. |
v2i | <vector> Vector 2 tail. A 2 or 3-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
function angle_vvn | ( | v1t | , |
v2t | , | ||
nvt | , | ||
v1i | , | ||
v2i | , | ||
nvi | |||
) |
Compute the angle between two vectors in a Euclidean 3D-space.
v1t | <vector> Vector 1 head. A 3-tuple of coordinates. |
v2t | <vector> Vector 2 head. A 3-tuple of coordinates. |
nvt | <vector> Normal vector head. A 3-tuple of coordinates. |
v1i | <vector> Vector 1 tail. A 3-tuple of coordinates. |
v2i | <vector> Vector 2 tail. A 3-tuple of coordinates. |
nvi | <vector> Normal vector tail. A 3-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
function are_coplanar_vvv | ( | v1t | , |
v2t | , | ||
v3t | , | ||
v1i | , | ||
v2i | , | ||
v3i | |||
) |
Test if three vectors are coplanar in Euclidean 3D-space.
v1t | <vector> Vector 1 head. A 3-tuple of coordinates. |
v2t | <vector> Vector 2 head. A 3-tuple of coordinates. |
v3t | <vector> Vector 3 head. A 3-tuple of coordinates. |
v1i | <vector> Vector 1 tail. A 3-tuple of coordinates. |
v2i | <vector> Vector 2 tail. A 3-tuple of coordinates. |
v3i | <vector> Vector 3 tail. A 3-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
See Wikipedia for more information.
function cross_vv | ( | v1t | , |
v2t | , | ||
v1i | , | ||
v2i | |||
) |
Compute the cross product of two vectors in a Euclidean 3D-space (2D).
v1t | <vector> Vector 1 head. A 2 or 3-tuple of coordinates. |
v2t | <vector> Vector 2 head. A 2 or 3-tuple of coordinates. |
v1i | <vector> Vector 1 tail. A 2 or 3-tuple of coordinates. |
v2i | <vector> Vector 2 tail. A 2 or 3-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
See Wikipedia cross and determinant for more information.
function distance_pp | ( | p1 | , |
p2 | |||
) |
Compute the distance between two points in a Euclidean 1, 2, or 3D-space.
p1 | <vector> A 1, 2, or 3-tuple of coordinates. |
p2 | <vector> A 1, 2, or 3-tuple of coordinates. |
When p2
is not given, it is assumed to be at the origin.
function dot_vv | ( | v1t | , |
v2t | , | ||
v1i | , | ||
v2i | |||
) |
Compute the dot product of two vectors.
v1t | <vector> Vector 1 head. An n-tuple of coordinates. |
v2t | <vector> Vector 2 head. An n-tuple of coordinates. |
v1i | <vector> Vector 1 tail. An n-tuple of coordinates. |
v2i | <vector> Vector 2 tail. An n-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
See Wikipedia for more information.
function striple_vvv | ( | v1t | , |
v2t | , | ||
v3t | , | ||
v1i | , | ||
v2i | , | ||
v3i | |||
) |
Compute scalar triple product of two vectors in a Euclidean 3D-space.
v1t | <vector> Vector 1 head. A 2 or 3-tuple of coordinates. |
v2t | <vector> Vector 2 head. A 2 or 3-tuple of coordinates. |
v3t | <vector> Vector 3 head. A 2 or 3-tuple of coordinates. |
v1i | <vector> Vector 1 tail. A 2 or 3-tuple of coordinates. |
v2i | <vector> Vector 2 tail. A 2 or 3-tuple of coordinates. |
v3i | <vector> Vector 3 tail. A 2 or 3-tuple of coordinates. |
Each vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.
[v1, v2, v3] = v1 * (v2 x v3)
See Wikipedia for more information.
(v2 x v3)
, which is a scalar value, and this value is multiplied by v1
, which results in a 2D vector. function unit_v | ( | vt | , |
vi | |||
) |
Compute the normalized unit vector for a 1, 2, or 3 term vector.
vt | <vector> Vector head. A 1, 2, or 3-tuple of coordinates. |
vi | <vector> Vector tail. A 1, 2, or 3-tuple of coordinates. |
The vector may be specified by both its head and tail coordinates. When specified by head coordinate only, the tail is assumed to be at origin.