omdl  v0.6.1
OpenSCAD Mechanical Design Library
Linear Algebra

Linear algebra transformations on Euclidean coordinates. More...

+ Collaboration diagram for Linear Algebra:

Files

file  math-base.scad
 Include file wrapper of math base primitives.
 

Functions

function multmatrix_lp (c, m)
 Multiply all coordinates by a 4x4 3d-transformation matrix. More...
 
function translate_lp (c, v)
 Translate all coordinates dimensions. More...
 
function rotate_lp (c, a, v, o=origin3d)
 Rotate all coordinates about one or more axes in Euclidean 2d or 3d space. More...
 
function scale_lp (c, v)
 Scale all coordinates dimensions. More...
 
function resize_lp (c, v)
 Scale all coordinates dimensions proportionately to fit inside a region. More...
 

Detailed Description

Linear algebra transformations on Euclidean coordinates.

Function Documentation

function multmatrix_lp ( ,
 
)

Multiply all coordinates by a 4x4 3d-transformation matrix.

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.

function resize_lp ( ,
 
)

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.
function rotate_lp ( ,
,
,
= origin3d 
)

Rotate all coordinates about one or more axes in Euclidean 2d or 3d space.

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.

function scale_lp ( ,
 
)

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.
function translate_lp ( ,
 
)

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.