omdl
v0.5
OpenSCAD Mechanical Design Library
|
Two dimensional geometric shapes. More...
Files | |
file | shapes2d.scad |
Two-dimensional basic shapes. | |
Functions | |
module | rectangle (size, vr, vrm=0, center=false) |
A rectangle with edge, fillet, and/or chamfer corners. More... | |
module | rectangle_c (size, core, t, co, cr=0, vr, vr1, vr2, vrm=0, vrm1, vrm2, center=false) |
A rectangle with a removed rectangular core. More... | |
module | rhombus (size, vr, center=false) |
A rhombus. More... | |
module | triangle_ppp (v1, v2, v3, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by three vertices. More... | |
module | triangle_vp (v, vr, centroid=false, incenter=false) |
A general triangle specified by a vector of its three vertices. More... | |
module | triangle_lll (s1, s2, s3, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by its three side lengths. More... | |
module | triangle_vl (v, vr, centroid=false, incenter=false) |
A general triangle specified by a vector of its three side lengths. More... | |
module | triangle_vl_c (vs, vc, co, cr=0, vr, vr1, vr2, centroid=false, incenter=false) |
A general triangle specified by its sides with a removed triangular core. More... | |
module | triangle_lal (s1, a, s2, x=1, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by two sides and the included angle. More... | |
module | triangle_ala (a1, s, a2, x=1, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by a side and two adjacent angles. More... | |
module | triangle_aal (a1, a2, s, x=1, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by a side, one adjacent angle and the opposite angle. More... | |
module | triangle_ll (x, y, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A right-angled triangle specified by its opposite and adjacent side lengths. More... | |
module | triangle_la (x, y, aa, oa, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A right-angled triangle specified by a side length and an angle. More... | |
module | ngon (n, r, vr) |
An n-sided equiangular/equilateral regular polygon. More... | |
module | ellipse (size) |
An ellipse. More... | |
module | ellipse_c (size, core, t, co, cr=0) |
An ellipse with a removed elliptical core. More... | |
module | ellipse_s (size, a1=0, a2=0) |
An ellipse sector. More... | |
module | ellipse_cs (size, core, t, a1=0, a2=0, co, cr=0) |
A sector of an ellipse with a removed elliptical core. More... | |
module | star2d (size, n=5, vr) |
A two dimensional star. More... | |
Two dimensional geometric shapes.
module ellipse | ( | size | ) |
An ellipse.
size | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
Example
Definition at line 1088 of file shapes2d.scad.
module ellipse_c | ( | size | , |
core | , | ||
t | , | ||
co | , | ||
cr | = 0 |
||
) |
An ellipse with a removed elliptical core.
size | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
core | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
t | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
co | <vector> Core offset. A vector [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
Thickness t
core = size - t
; when t
and size
are given. size = core + t
; when t
and core
are given.Example
Definition at line 1129 of file shapes2d.scad.
module ellipse_cs | ( | size | , |
core | , | ||
t | , | ||
a1 | = 0 , |
||
a2 | = 0 , |
||
co | , | ||
cr | = 0 |
||
) |
A sector of an ellipse with a removed elliptical core.
size | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
core | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
t | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
a1 | <decimal> The start angle in degrees. |
a2 | <decimal> The stop angle in degrees. |
co | <vector> Core offset. A vector [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
Thickness t
core = size - t
; when t
and size
are given. size = core + t
; when t
and core
are given.Example
Definition at line 1239 of file shapes2d.scad.
module ellipse_s | ( | size | , |
a1 | = 0 , |
||
a2 | = 0 |
||
) |
An ellipse sector.
size | <vector|decimal> A vector [rx, ry] of decimals or a single decimal for (rx=ry). |
a1 | <decimal> The start angle in degrees. |
a2 | <decimal> The stop angle in degrees. |
Example
Definition at line 1171 of file shapes2d.scad.
module ngon | ( | n | , |
r | , | ||
vr | |||
) |
An n-sided equiangular/equilateral regular polygon.
n | <decimal> The number of sides. |
r | <decimal> The ngon vertex radius. |
vr | <decimal> The vertex rounding radius. |
Example
See Wikipedia for more information.
Definition at line 1054 of file shapes2d.scad.
module rectangle | ( | size | , |
vr | , | ||
vrm | = 0 , |
||
center | = false |
||
) |
A rectangle with edge, fillet, and/or chamfer corners.
size | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
vr | <vector|decimal> The corner rounding radius. A vector [v1r, v2r, v3r, v4r] of decimals or a single decimal for (v1r=v2r=v3r=v4r). Unspecified corners are not rounded. |
vrm | <integer> The corner radius mode. A 4-bit encoded integer that indicates each corner finish. Use bit value 0 for fillet and 1 for chamfer. |
center | <boolean> Center about origin. |
Example
vr
, inset [vr, vr]
from the corner vertex. vr
. Therefore the chamfer length will be vr*sqrt(2)
at 45 degree angles. Definition at line 112 of file shapes2d.scad.
module rectangle_c | ( | size | , |
core | , | ||
t | , | ||
co | , | ||
cr | = 0 , |
||
vr | , | ||
vr1 | , | ||
vr2 | , | ||
vrm | = 0 , |
||
vrm1 | , | ||
vrm2 | , | ||
center | = false |
||
) |
A rectangle with a removed rectangular core.
size | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
core | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
t | <vector|decimal> A vector [x, y] of decimals or a single decimal for (x=y). |
co | <vector> Core offset. A vector [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
vr | <vector|decimal> The default corner rounding radius. A vector [v1r, v2r, v3r, v4r] of decimals or a single decimal for (v1r=v2r=v3r=v4r). Unspecified corners are not rounded. |
vr1 | <vector|decimal> The outer corner rounding radius. |
vr2 | <vector|decimal> The core corner rounding radius. |
vrm | <integer> The default corner radius mode. A 4-bit encoded integer that indicates each corner finish. Use bit value 0 for fillet and 1 for chamfer. |
vrm1 | <integer> The outer corner radius mode. |
vrm2 | <integer> The core corner radius mode. |
center | <boolean> Center about origin. |
Thickness t
core = size - t
; when t
and size
are given. size = core + t
; when t
and core
are given.Example
Definition at line 232 of file shapes2d.scad.
module rhombus | ( | size | , |
vr | , | ||
center | = false |
||
) |
A rhombus.
size | <vector|decimal> A vector [w, h] of decimals or a single decimal for (w=h). |
vr | <vector|decimal> The corner rounding radius. A vector [v1r, v2r, v3r, v4r] of decimals or a single decimal for (v1r=v2r=v3r=v4r). Unspecified corners are not rounded. |
center | <boolean> Center about origin. |
Example
See Wikipedia for more information.
Definition at line 297 of file shapes2d.scad.
module star2d | ( | size | , |
n | = 5 , |
||
vr | |||
) |
A two dimensional star.
size | <vector|decimal> A vector [l, w] of decimals or a single decimal for (size=l=2*w). |
n | <decimal> The number of points. |
vr | <vector|decimal> The vertex rounding radius. A vector [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
Example
Definition at line 1285 of file shapes2d.scad.
module triangle_aal | ( | a1 | , |
a2 | , | ||
s | , | ||
x | = 1 , |
||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a side, one adjacent angle and the opposite angle.
a1 | <decimal> The opposite angle 1 in degrees. |
a2 | <decimal> The adjacent angle 2 in degrees. |
s | <decimal> The side length. |
x | <decimal> The side to draw on the positive x-axis (x=1 for s ). |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
See Wikipedia for more information.
Definition at line 882 of file shapes2d.scad.
module triangle_ala | ( | a1 | , |
s | , | ||
a2 | , | ||
x | = 1 , |
||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a side and two adjacent angles.
a1 | <decimal> The adjacent angle 1 in degrees. |
s | <decimal> The side length adjacent to the angles. |
a2 | <decimal> The adjacent angle 2 in degrees. |
x | <decimal> The side to draw on the positive x-axis (x=1 for s ). |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
See Wikipedia for more information.
Definition at line 799 of file shapes2d.scad.
module triangle_la | ( | x | , |
y | , | ||
aa | , | ||
oa | , | ||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A right-angled triangle specified by a side length and an angle.
x | <decimal> The length of the side along the x-axis. |
y | <decimal> The length of the side along the y-axis. |
aa | <decimal> The adjacent angle in degrees. |
oa | <decimal> The opposite angle in degrees. |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
x
and y
are given, both triangles are rendered. aa
and oa
are given, aa
is used. Definition at line 1002 of file shapes2d.scad.
module triangle_lal | ( | s1 | , |
a | , | ||
s2 | , | ||
x | = 1 , |
||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by two sides and the included angle.
s1 | <decimal> The length of the side 1. |
a | <decimal> The included angle in degrees. |
s2 | <decimal> The length of the side 2. |
x | <decimal> The side to draw on the positive x-axis (x=1 for s1 ). |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
See Wikipedia for more information.
Definition at line 730 of file shapes2d.scad.
module triangle_ll | ( | x | , |
y | , | ||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A right-angled triangle specified by its opposite and adjacent side lengths.
x | <decimal> The length of the side along the x-axis. |
y | <decimal> The length of the side along the y-axis. |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
Definition at line 959 of file shapes2d.scad.
module triangle_lll | ( | s1 | , |
s2 | , | ||
s3 | , | ||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by its three side lengths.
s1 | <decimal> The length of the side 1 (along the x-axis). |
s2 | <decimal> The length of the side 2. |
s3 | <decimal> The length of the side 3. |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
See Wikipedia for more information.
Definition at line 524 of file shapes2d.scad.
module triangle_ppp | ( | v1 | , |
v2 | , | ||
v3 | , | ||
vr | , | ||
v1r | , | ||
v2r | , | ||
v3r | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by three vertices.
v1 | <vector> A vector [x, y] for vertex 1. |
v2 | <vector> A vector [x, y] for vertex 2. |
v3 | <vector> A vector [x, y] for vertex 3. |
vr | <decimal> The default vertex rounding radius. |
v1r | <decimal> Vertex 1 rounding radius. |
v2r | <decimal> Vertex 2 rounding radius. |
v3r | <decimal> Vertex 3 rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
vr
or individually.Replace the hull() operation with calculated tangential intersection of the rounded vertexes.
Remove the all or nothing requirement for vertex rounding.
Definition at line 398 of file shapes2d.scad.
module triangle_vl | ( | v | , |
vr | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a vector of its three side lengths.
v | <vector> A vector [s1, s2, s3] of decimals. |
vr | <vector|decimal> The vertex rounding radius. A vector [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
Definition at line 584 of file shapes2d.scad.
module triangle_vl_c | ( | vs | , |
vc | , | ||
co | , | ||
cr | = 0 , |
||
vr | , | ||
vr1 | , | ||
vr2 | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by its sides with a removed triangular core.
vs | <vector|decimal> The size. A vector [s1, s2, s3] of decimals or a single decimal for (s1=s2=s3). |
vc | <vector|decimal> The core. A vector [s1, s2, s3] of decimals or a single decimal for (s1=s2=s3). |
co | <vector> Core offset. A vector [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
vr | <vector|decimal> The default vertex rounding radius. A vector [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
vr1 | <vector|decimal> The outer vertex rounding radius. |
vr2 | <vector|decimal> The core vertex rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
Definition at line 638 of file shapes2d.scad.
module triangle_vp | ( | v | , |
vr | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a vector of its three vertices.
v | <vector> A vector [v1, v2, v3] of vectors [x, y]. |
vr | <vector|decimal> The vertex rounding radius. A vector [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
Definition at line 474 of file shapes2d.scad.