omdl
v0.6.1
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_lp (v, vr, centroid=false, incenter=false) |
A general triangle specified by a list of its three vertices. More... | |
module | triangle_sss (s1, s2, s3, vr, v1r, v2r, v3r, centroid=false, incenter=false) |
A general triangle specified by its three side lengths. More... | |
module | triangle_ls (v, vr, centroid=false, incenter=false) |
A general triangle specified by a list of its three side lengths. More... | |
module | triangle_ls_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_sas (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_asa (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_aas (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_ss (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_sa (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 | <decimal-list-2|decimal> A list [rx, ry] of decimals or a single decimal for (rx=ry). |
Example
Definition at line 1103 of file shapes2d.scad.
module ellipse_c | ( | size | , |
core | , | ||
t | , | ||
co | , | ||
cr | = 0 |
||
) |
An ellipse with a removed elliptical core.
size | <decimal-list-2|decimal> A list [rx, ry] of decimals or a single decimal for (rx=ry). |
core | <decimal-list-2|decimal> A list [rx, ry] of decimals or a single decimal for (rx=ry). |
t | <decimal-list-2|decimal> A list [x, y] of decimals or a single decimal for (x=y). |
co | <decimal-list-2> Core offset. A list [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 1144 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 | <decimal-list-2|decimal> A list [rx, ry] of decimals or a single decimal for (rx=ry). |
core | <decimal-list-2|decimal> A list [rx, ry] of decimals or a single decimal for (rx=ry). |
t | <decimal-list-2|decimal> A list [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 | <decimal-list-2> Core offset. A list [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 1254 of file shapes2d.scad.
module ellipse_s | ( | size | , |
a1 | = 0 , |
||
a2 | = 0 |
||
) |
An ellipse sector.
size | <decimal-list-2|decimal> A list [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 1186 of file shapes2d.scad.
module ngon | ( | n | , |
r | , | ||
vr | |||
) |
An n-sided equiangular/equilateral regular polygon.
n | <integer> 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 1069 of file shapes2d.scad.
module rectangle | ( | size | , |
vr | , | ||
vrm | = 0 , |
||
center | = false |
||
) |
A rectangle with edge, fillet, and/or chamfer corners.
size | <decimal-list-2|decimal> A list [x, y] of decimals or a single decimal for (x=y). |
vr | <decimal-list-4|decimal> The corner rounding radius. A list [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 117 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 | <decimal-list-2|decimal> A list [x, y] of decimals or a single decimal for (x=y). |
core | <decimal-list-2|decimal> A list [x, y] of decimals or a single decimal for (x=y). |
t | <decimal-list-2|decimal> A list [x, y] of decimals or a single decimal for (x=y). |
co | <decimal-list-2> Core offset. A list [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
vr | <decimal-list-4|decimal> The default corner rounding radius. A list [v1r, v2r, v3r, v4r] of decimals or a single decimal for (v1r=v2r=v3r=v4r). Unspecified corners are not rounded. |
vr1 | <decimal-list-4|decimal> The outer corner rounding radius. |
vr2 | <decimal-list-4|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 237 of file shapes2d.scad.
module rhombus | ( | size | , |
vr | , | ||
center | = false |
||
) |
A rhombus.
size | <decimal-list-2|decimal> A list [w, h] of decimals or a single decimal for (w=h). |
vr | <decimal-list-4|decimal> The corner rounding radius. A list [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 302 of file shapes2d.scad.
module star2d | ( | size | , |
n | = 5 , |
||
vr | |||
) |
A two-dimensional star.
size | <decimal-list-2|decimal> A list [l, w] of decimals or a single decimal for (size=l=2*w). |
n | <decimal> The number of points. |
vr | <decimal-list-3|decimal> The vertex rounding radius. A list [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
Example
Definition at line 1301 of file shapes2d.scad.
module triangle_aas | ( | 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 | <integer> 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 896 of file shapes2d.scad.
module triangle_asa | ( | 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 | <integer> 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 811 of file shapes2d.scad.
module triangle_lp | ( | v | , |
vr | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a list of its three vertices.
v | <point-2d-list-3> A list [v1, v2, v3] of points [x, y]. |
vr | <decimal-list-3|decimal> The vertex rounding radius. A list [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 480 of file shapes2d.scad.
module triangle_ls | ( | v | , |
vr | , | ||
centroid | = false , |
||
incenter | = false |
||
) |
A general triangle specified by a list of its three side lengths.
v | <decimal-list-3> A list [s1, s2, s3] of decimals. |
vr | <decimal-list-3|decimal> The vertex rounding radius. A list [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 591 of file shapes2d.scad.
module triangle_ls_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 | <decimal-list-3|decimal> The size. A list [s1, s2, s3] of decimals or a single decimal for (s1=s2=s3). |
vc | <decimal-list-3|decimal> The core. A list [s1, s2, s3] of decimals or a single decimal for (s1=s2=s3). |
co | <decimal-list-2> Core offset. A list [x, y] of decimals. |
cr | <decimal> Core z-rotation. |
vr | <decimal-list-3|decimal> The default vertex rounding radius. A list [v1r, v2r, v3r] of decimals or a single decimal for (v1r=v2r=v3r). |
vr1 | <decimal-list-3|decimal> The outer vertex rounding radius. |
vr2 | <decimal-list-3|decimal> The core vertex rounding radius. |
centroid | <boolean> Center centroid at origin. |
incenter | <boolean> Center incenter at origin. |
Example
Definition at line 646 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 | <point-2d> A point [x, y] for vertex 1. |
v2 | <point-2d> A point [x, y] for vertex 2. |
v3 | <point-2d> A point [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 403 of file shapes2d.scad.
module triangle_sa | ( | 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 1016 of file shapes2d.scad.
module triangle_sas | ( | 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 | <integer> 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 740 of file shapes2d.scad.
module triangle_ss | ( | 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 973 of file shapes2d.scad.
module triangle_sss | ( | 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 530 of file shapes2d.scad.