omdl
v0.9.5
OpenSCAD Mechanical Design Library
|
For geometric specifications and geometric algebra, omdl adopts the following type specifications and conventions.
name | description |
---|---|
point | a list of numbers to identify a location in space |
vector | a direction and magnitude in space |
line | a start and end point in space (line wiki) |
normal | a vector that is perpendicular to a given object |
pnorm | a vector that is perpendicular to a plane |
plane | a flat 2d infinite surface (plane wiki) |
coords | a list of points in space |
matrix | a rectangular array of values |
When a particular dimension is expected, the dimensional expectation is appended to the end of the name after a '-' dash as in the following table.
name | description |
---|---|
point-Nd | a point in an 'N' dimensional space |
vector-Nd | a vector in an 'N' dimensional space |
line-Nd | a line in an 'N' dimensional space |
coords-Nd | a coordinate list in an 'N' dimensional space |
matrix-MxN | a 'M' by 'N' matrix of values |
A vector has a direction and magnitude in space. A line, too, has direction and magnitude, but also has location, as it starts at one point in space and ends at another. Although a line can be specified in one dimension, most library functions operate on two and/or three dimensional lines. Operators in omdl make use of a common convention for specifying Euclidean vectors and straight lines as summarized in the following table:
Given two points 'p1'
and 'p2'
, in space:
no. | form | description |
---|---|---|
1 | p2 | a vector from the origin to 'p2' |
2 | [p2] | a vector from the origin to 'p2' |
3 | [p1, p2] | a line from 'p1' to 'p2' |
The functions is_point(), is_vector(), is_line(), line_dim(), line_tp(), line_ip(), vol_to_point(), and vol_to_origin(), are available for type identification and convertion.
Example
Operators in omdl use a common convention for specifying planes. A plane is identified by a point on its surface together with its normal vector specified by pnorm, which is discussed in the following section. A list with a point and normal together specify the plane as follows:
name | form |
---|---|
plane | [point, pnorm] |
The data type pnorm refers to a convention for specifying a direction vector that is perpendicular to a plane. Given three points 'p1'
, 'p2'
, 'p3'
, and three vectors 'v1'
, 'v2'
, 'vn'
, the planes' normal can be specified in any of the following forms:
no. | form | description |
---|---|---|
1 | vn | the predetermined normal vector to the plane |
2 | [vn] | the predetermined normal vector to the plane |
3 | [v1, v2] | two distinct but intersecting vectors |
4 | [p1, p2, p3] | three (or more) non-collinear coplanar points |
The functions is_plane() and plane_to_normal() are available for type identification and convertion.
Example