omdl
v0.6.1
OpenSCAD Mechanical Design Library
|
Algebraic operations on Euclidean vectors. More...
Files | |
file | math-base.scad |
Include file wrapper of math base primitives. | |
Functions | |
function | distance_pp (p1, p2) |
Compute the distance between two Euclidean points. More... | |
function | is_left_ppp (p1, p2, p3) |
Test if a point is left, on, or right of an infinite line in a Euclidean 2d-space. More... | |
function | dimension_2to3_v (v) |
Return 3d vector unchanged or add a zeroed third dimension to 2d vector. More... | |
function | get_line_dim (l) |
Return the number of dimensions of a Euclidean line (or vector). More... | |
function | get_line_tp (l) |
Return the terminal point of a Euclidean line (or vector). More... | |
function | get_line_ip (l) |
Return the initial point of a Euclidean line (or vector). More... | |
function | get_line2origin (l) |
Shift a Euclidean line (or vector) to the origin. More... | |
function | dot_ll (l1, l2) |
Compute the dot product of two lines (or vectors). More... | |
function | cross_ll (l1, l2) |
Compute the cross product of two lines (or vectors) in a Euclidean 3d or 2d-space. More... | |
function | striple_lll (l1, l2, l3) |
Compute the scalar triple product of three lines (or vectors) in a Euclidean 3d or 2d-space. More... | |
function | angle_ll (l1, l2) |
Compute the angle between two lines (or vectors) in a Euclidean 3d or 2d-space. More... | |
function | angle_lll (l1, l2, n) |
Compute the angle between two lines (or vectors) in a Euclidean 3d-space. More... | |
function | unit_l (l) |
Compute the normalized unit vector of a Euclidean line (or vector). More... | |
function | are_coplanar_lll (l1, l2, l3, d=6) |
Test if three lines (or vectors) are coplanar in Euclidean 3d-space. More... | |
function | get_pnorm2nv (pn, cw=true) |
Convert a planes' normal specification into a normal vector. More... | |
Algebraic operations on Euclidean vectors.
See validation results.
function angle_ll | ( | l1 | , |
l2 | |||
) |
Compute the angle between two lines (or vectors) in a Euclidean 3d or 2d-space.
l1 | <line-3d|line-2d> A 3d or 2d line (or vector) 1. |
l2 | <line-3d|line-2d> A 3d or 2d line (or vector) 2. |
See Lines and vectors for argument specification and conventions.
function angle_lll | ( | l1 | , |
l2 | , | ||
n | |||
) |
Compute the angle between two lines (or vectors) in a Euclidean 3d-space.
l1 | <line-3d> A 3d line (or vector) 1. |
l2 | <line-3d> A 3d line (or vector) 2. |
n | <line-3d> A 3d normal line (or vector). |
See Lines and vectors for argument specification and conventions.
function are_coplanar_lll | ( | l1 | , |
l2 | , | ||
l3 | , | ||
d | = 6 |
||
) |
Test if three lines (or vectors) are coplanar in Euclidean 3d-space.
l1 | <line-3d> A 3d line (or vector) 1. |
l2 | <line-3d> A 3d line (or vector) 2. |
l3 | <line-3d> A 3d line (or vector) 3. |
d | <integer> The number of decimal places to consider. |
See Lines and vectors for argument specification and conventions. See Wikipedia for more information.
function cross_ll | ( | l1 | , |
l2 | |||
) |
Compute the cross product of two lines (or vectors) in a Euclidean 3d or 2d-space.
l1 | <line-3d|line-2d> A 3d or 2d line (or vector) 1. |
l2 | <line-3d|line-2d> A 3d or 2d line (or vector) 2. |
l1
with l2
. Returns undef when lines (or vectors) have different dimensions.This function supports the abstraction outlined in Lines and vectors. The built-in operation will be more efficient in situations that do not make use of the aforementioned abstraction.
See Lines and vectors for argument specification and conventions. See Wikipedia cross and determinant for more information.
function dimension_2to3_v | ( | v | ) |
Return 3d vector unchanged or add a zeroed third dimension to 2d vector.
v | <vector-3d|vector-2d> A vector. |
function distance_pp | ( | p1 | , |
p2 | |||
) |
Compute the distance between two Euclidean points.
p1 | <point> A point coordinate 1. |
p2 | <point> A point coordinate 2. |
When p2
is not given, it is assumed to be at the origin. This function is similar to norm.
function dot_ll | ( | l1 | , |
l2 | |||
) |
Compute the dot product of two lines (or vectors).
l1 | <line> A n-dimensional line (or vector) 1. |
l2 | <line> A n-dimensional line (or vector) 2. |
l1
with l2
. Returns undef when lines (or vectors) have different dimensions.This function supports the abstraction outlined in Lines and vectors. The built-in operation will be more efficient in situations that do not make use of the aforementioned abstraction.
See Lines and vectors for argument specification and conventions. See Wikipedia for more information.
function get_line2origin | ( | l | ) |
Shift a Euclidean line (or vector) to the origin.
l | <line> A line (or vector). |
See Lines and vectors for argument specification and conventions.
function get_line_dim | ( | l | ) |
Return the number of dimensions of a Euclidean line (or vector).
l | <line> A line (or vector). |
See Lines and vectors for argument specification and conventions.
function get_line_ip | ( | l | ) |
Return the initial point of a Euclidean line (or vector).
l | <line> A line (or vector). |
See Lines and vectors for argument specification and conventions.
function get_line_tp | ( | l | ) |
Return the terminal point of a Euclidean line (or vector).
l | <line> A line (or vector). |
See Lines and vectors for argument specification and conventions.
function get_pnorm2nv | ( | pn | , |
cw | = true |
||
) |
Convert a planes' normal specification into a normal vector.
pn | <pnorm> A plane normal specification. |
cw | <boolean> Point ordering. When the plane specified as non-collinear points, this indicates ordering. |
See Planes' normal for argument specification and conventions.
function is_left_ppp | ( | p1 | , |
p2 | , | ||
p3 | |||
) |
Test if a point is left, on, or right of an infinite line in a Euclidean 2d-space.
p1 | <point-2d> A 2d point coordinate 1. |
p2 | <point-2d> A 2d point coordinate 2. |
p3 | <point-2d> A 2d point coordinate 3. |
p3
left of the line through p1
and p2
, (= 0) for p3 on the line, and (< 0) for p3 right of the line.Function patterned after Dan Sunday, 2012.
function striple_lll | ( | l1 | , |
l2 | , | ||
l3 | |||
) |
Compute the scalar triple product of three lines (or vectors) in a Euclidean 3d or 2d-space.
l1 | <line-3d|line-2d> A 3d or 2d line (or vector) 1. |
l2 | <line-3d|line-2d> A 3d or 2d line (or vector) 2. |
l3 | <line-3d|line-2d> A 3d or 2d line (or vector) 3. |
[l1, l2, l3] = l1 * (l2 x l3)
See Lines and vectors for argument specification and conventions. See Wikipedia for more information.
(l2 x l3)
, a scalar value, which is then multiplied by l1
. function unit_l | ( | l | ) |
Compute the normalized unit vector of a Euclidean line (or vector).
l | <line> A line (or vector). |
See Lines and vectors for argument specification and conventions.