omdl  v0.9.5
OpenSCAD Mechanical Design Library
Linear Algebra

Euclidean linear algebra functions. More...

+ Collaboration diagram for Linear Algebra:

Files

file  linear_algebra.scad
 Linear algebra mathematical functions.
 

Functions

function multmatrix_p (c, m)
 Multiply all coordinates by a 4x4 transformation matrix in 3D. More...
 
function translate_p (c, v)
 Translate all coordinates dimensions. More...
 
function rotate_p (c, a, v, o=origin3d)
 Rotate all coordinates about one or more axes in 2D or 3D. More...
 
function scale_p (c, v)
 Scale all coordinates dimensions. More...
 
function resize_p (c, v)
 Scale all coordinates dimensions proportionately to fit inside a region. More...
 

Detailed Description

Euclidean linear algebra functions.

Requires:
include <omdl-base.scad>;

Function Documentation

◆ multmatrix_p()

function multmatrix_p ( ,
 
)

Multiply all coordinates by a 4x4 transformation matrix in 3D.

Parameters
c<coords-3d> A list of 3d coordinate points.
m<matrix-4x4> A 4x4 transformation matrix (decimal-list-4-list4).
Returns
<coords-3d> A list of 3d coordinate points multiplied by the transformation matrix.

See Wikipedia and multmatrix for more information.

◆ resize_p()

function resize_p ( ,
 
)

Scale all coordinates dimensions proportionately to fit inside a region.

Parameters
c<coords-nd> A list of nd coordinate points.
v<decimal-list-n> A list of bounds for each dimension.
Returns
<coords-nd> A list of proportionately scaled coordinate points which exactly fit the region bounds v.
+ Here is the caller graph for this function:

◆ rotate_p()

function rotate_p ( ,
,
,
= origin3d 
)

Rotate all coordinates about one or more axes in 2D or 3D.

Parameters
c<coords-3d | coords-2d> A list of 3d or 2d coordinate points.
a<decimal-list-3 | decimal> The axis rotation angle. A list [ax, ay, az] or a single decimal to specify az only.
v<vector-3d> An arbitrary axis for the rotation. When specified, the rotation angle will be a or az about the line v that passes through point o.
o<point-3d> A 3d point origin for the rotation. Ignored when v is not specified.
Returns
<coords-3d | coords-2d> A list of 3d or 2d rotated coordinates. Rotation order is rz, ry, rx.

See Wikipedia for more information on transformation matrix and axis rotation.

+ Here is the caller graph for this function:

◆ scale_p()

function scale_p ( ,
 
)

Scale all coordinates dimensions.

Parameters
c<coords-nd> A list of nd coordinate points.
v<decimal-list-n> A list of scalers for each dimension.
Returns
<coords-nd> A list of scaled coordinate points.

◆ translate_p()

function translate_p ( ,
 
)

Translate all coordinates dimensions.

Parameters
c<coords-nd> A list of nd coordinate points.
v<decimal-list-n> A list of translations for each dimension.
Returns
<coords-nd> A list of translated coordinate points.

See Wikipedia for more information and transformation matrix.

+ Here is the caller graph for this function: