![]() |
omdl
v0.9.8
OpenSCAD Mechanical Design Library
|
Roundable polygons generated in 2D space. More...
Files | |
file | polygon.scad |
Roundable polygons generated in 2D space. | |
Rounding | |
module | pg_corner_round (r=1, m=1, c=origin2d, v1=x_axis2d_uv, v2=y_axis2d_uv) |
A polygon edge round with constant radius between two vectors. More... | |
Round side general | |
module | pg_rectangle_rs (size=1, o, sr, center=false) |
A polygon rectangle with side rounding. More... | |
Round vertex general | |
module | pg_elliptical_sector (r=1, c=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, s=true) |
A polygon elliptical sector. More... | |
module | pg_trapezoid (b=1, h, l=1, a=90, o=origin2d, vr, vrm=1, vfn, center=false) |
A polygon trapezoid with individual vertex rounding and arc facets. More... | |
module | pg_rectangle (size=1, o, vr, vrm=1, vfn, center=false) |
A polygon rectangle with vertex rounding. More... | |
module | pg_rhombus (size=1, o, vr, vrm=1, vfn, center=false) |
A polygon rhombus with vertex rounding. More... | |
module | pg_ngon (n=3, r=1, o, vr, vrm=1, vfn, center=true) |
A n-sided regular polygon with vertex rounding. More... | |
Round vertex triangles | |
module | pg_triangle_ppp (c, o, vr, vrm=1, vfn, cm=0) |
A polygon triangle specified by three coordinate points with vertex rounding. More... | |
module | pg_triangle_sss (v, a=x_axis_ci, o, vr, vrm=1, vfn, cm=0) |
A polygon triangle specified by three side lengths with vertex rounding. More... | |
module | pg_triangle_sas (v, a=x_axis_ci, o, vr, vrm=1, vfn, cm=0) |
A polygon triangle specified by size-angle-size with vertex rounding. More... | |
module | pg_triangle_asa (v, a=x_axis_ci, o, vr, vrm=1, vfn, cm=0) |
A polygon triangle specified by angle-size-angle with vertex rounding. More... | |
module | pg_triangle_aas (v, a=x_axis_ci, o, vr, vrm=1, vfn, cm=0) |
A polygon triangle specified by angle-angle-size with vertex rounding. More... | |
Roundable polygons generated in 2D space.
Requires: |
---|
include <omdl-base.scad>; |
module pg_corner_round | ( | r | = 1 , |
m | = 1 , |
||
c | = origin2d , |
||
v1 | = x_axis2d_uv , |
||
v2 | = y_axis2d_uv |
||
) |
A polygon edge round with constant radius between two vectors.
r | <decimal> The round radius. |
m | <integer> The round mode. |
c | <point-2d> The round center coordinate [x, y]. |
v1 | <line-2d | decimal> The round start angle. A 2d line, vector, or decimal angle 1. |
v2 | <line-2d | decimal> The round end angle. A 2d line, vector, or decimal angle 2. |
fn | <integer> The number of facets (optional). |
cw | <boolean> The coordinate point ordering. |
Normally, angle 1 should be less than angle 2. The edge coordinates will start at angle 1, end at angle 2, and will have radius r
along a rounded transition from edge 1 to 2. When cw
= true the coordinates will start at edge 1 and increase toward edge 2. When cw
= false this ordering is reversed.
The round mode may be one of the following:
mode | name | description |
---|---|---|
1 | fillet | fillet from one edge to the next |
2 | round | round from one edge to the next |
3 | chamfer | bevel from one edge to the next |
Object example
Definition at line 563 of file polygon.scad.
module pg_elliptical_sector | ( | r | = 1 , |
c | = origin2d , |
||
v1 | = x_axis2d_uv , |
||
v2 | = x_axis2d_uv , |
||
s | = true |
||
) |
A polygon elliptical sector.
r | <decimal-list-2 | decimal> The elliptical radius. A list [rx, ry] of decimals or a single decimal for (rx=ry). |
c | <point-2d> The center coordinate [x, y]. |
v1 | <line-2d | decimal> The sector angle 1. A 2d line, vector, or decimal. |
v2 | <line-2d | decimal> The sector angle 2. A 2d line, vector, or decimal. |
s | <boolean> Use signed vector angle conversions. When false, positive angle conversion will be used. |
fn | <integer> The number of facets (optional). |
cw | <boolean> The coordinate point ordering. |
The coordinates will be between angle 1 and angle 2 and will be ordered clockwise. The sector sweep direction can be controlled by the sign of the angles. When fn
is undefined, its value is determined by get_fn().
Object example
Definition at line 676 of file polygon.scad.
module pg_ngon | ( | n | = 3 , |
r | = 1 , |
||
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
center | = true |
||
) |
A n-sided regular polygon with vertex rounding.
n | <integer> The number of sides. |
r | <decimal> The radius. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-n | decimal> The vertices rounding radius. |
vrm | <integer-list-n | integer> The vertices rounding mode. |
vfn | <integer-list-n | integer> The vertices arc fragment number. |
center | <boolean> Center about origin. |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Object example
Definition at line 865 of file polygon.scad.
module pg_rectangle | ( | size | = 1 , |
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
center | = false |
||
) |
A polygon rectangle with vertex rounding.
size | <decimal-list-2 | decimal> A list [x, y] of decimals or a single decimal for (x=y). |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-4 | decimal> The vertices rounding radius. |
vrm | <integer-list-4 | integer> The vertices rounding mode. |
vfn | <integer-list-4> The vertices arc fragment number. |
center | <boolean> Center about origin. |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Object example
Definition at line 764 of file polygon.scad.
module pg_rectangle_rs | ( | size | = 1 , |
o | , | ||
sr | , | ||
center | = false |
||
) |
A polygon rectangle with side rounding.
size | <decimal-list-2 | decimal> A list [x, y] of decimals or a single decimal for (x=y). |
o | <point-2d> The origin offset coordinate [x, y]. |
sr | <decimal-list-2 | decimal> The side rounding radius. |
center | <boolean> Center about origin. |
The side rounding radius may be zero, positive, or negative. When positive, the rounding arc is swept clockwise. When negative, the arc is swept counter clockwise. A positive radius must be greater than the side length. The arch center point is located along a line that starts at the mid-point of the side vertices and extends perpendicularly by the radius distance. The arch is swept about the center point with constant radius from one vertex to the next.
Object example
Definition at line 615 of file polygon.scad.
module pg_rhombus | ( | size | = 1 , |
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
center | = false |
||
) |
A polygon rhombus with vertex rounding.
size | <decimal-list-2 | decimal> A list [x, y] of decimals or a single decimal for (x=y). |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-4 | decimal> The vertices rounding radius. |
vrm | <integer-list-4 | integer> The vertices rounding mode. |
vfn | <integer-list-4> The vertices arc fragment number. |
center | <boolean> Center about origin. |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Object example
Definition at line 815 of file polygon.scad.
module pg_trapezoid | ( | b | = 1 , |
h | , | ||
l | = 1 , |
||
a | = 90 , |
||
o | = origin2d , |
||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
center | = false |
||
) |
A polygon trapezoid with individual vertex rounding and arc facets.
b | <decimal-list-2 | decimal> The base lengths. A list [b1, b2] of 2 decimals or a single decimal for (b1=b2). |
h | <decimal> The perpendicular height between bases. |
l | <decimal> The left side leg length. |
a | <decimal> The angle between the lower base and left leg. |
o | <point-2d> The origin offset coordinate [x, y]. |
cw | <boolean> Polygon vertex ordering. |
When both h
and l
are specified, h
has precedence. The function generates parallelograms, rectangles, and squares with the appropriate parameter assignments. See Wikipedia for more general information on trapezoids.
vr | <decimal-list-4 | decimal> The vertices rounding radius. |
vrm | <integer-list-4 | integer> The vertices rounding mode. |
vfn | <integer-list-4> The vertices arc fragment number. |
center | <boolean> Center origin at trapezoid centroid. |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Object example
Definition at line 715 of file polygon.scad.
module pg_triangle_aas | ( | v | , |
a | = x_axis_ci , |
||
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
cm | = 0 |
||
) |
A polygon triangle specified by angle-angle-size with vertex rounding.
v | <decimal-list-3> A list, [a1, a2, s1], a side length, one adjacent and the opposite angle. |
a | <integer> The triangle side alignment axis index < x_axis_ci | y_axis_ci >. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-3 | decimal> The vertices rounding radius. |
vrm | <integer-list-3 | integer> The vertices rounding mode. |
vfn | <integer-list-3 | integer> The vertices arc fragment number. |
cm | <integer> The center mode; [0,1,2, or 3]. |
cm | value description |
---|---|
0 | origin at vertex v1 |
1 | origin at triangle centroid |
2 | origin at triangle incenter |
3 | origin at triangle circumcenter |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Parameter location
Object example
Definition at line 1233 of file polygon.scad.
module pg_triangle_asa | ( | v | , |
a | = x_axis_ci , |
||
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
cm | = 0 |
||
) |
A polygon triangle specified by angle-size-angle with vertex rounding.
v | <decimal-list-3> A list, [a1, s3, a2], the side length and two adjacent angles. |
a | <integer> The triangle side alignment axis index < x_axis_ci | y_axis_ci >. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-3 | decimal> The vertices rounding radius. |
vrm | <integer-list-3 | integer> The vertices rounding mode. |
vfn | <integer-list-3 | integer> The vertices arc fragment number. |
cm | <integer> The center mode; [0,1,2, or 3]. |
cm | value description |
---|---|
0 | origin at vertex v1 |
1 | origin at triangle centroid |
2 | origin at triangle incenter |
3 | origin at triangle circumcenter |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Parameter location
Object example
Definition at line 1168 of file polygon.scad.
module pg_triangle_ppp | ( | c | , |
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
cm | = 0 |
||
) |
A polygon triangle specified by three coordinate points with vertex rounding.
c | <coords-list-3> A list, [v1, v2, v3], the vertex coordinates in 2d. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-3 | decimal> The vertices rounding radius. |
vrm | <integer-list-3 | integer> The vertices rounding mode. |
vfn | <integer-list-3 | integer> The vertices arc fragment number. |
cm | <integer> The center mode; [0,1,2, or 3]. |
cm | value description |
---|---|
0 | origin at vertex v1 |
1 | origin at triangle centroid |
2 | origin at triangle incenter |
3 | origin at triangle circumcenter |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Parameter location
Object example
Definition at line 966 of file polygon.scad.
module pg_triangle_sas | ( | v | , |
a | = x_axis_ci , |
||
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
cm | = 0 |
||
) |
A polygon triangle specified by size-angle-size with vertex rounding.
v | <decimal-list-3> A list, [s1, a3, s2], the side lengths and the included angle. |
a | <integer> The triangle side alignment axis index < x_axis_ci | y_axis_ci >. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-3 | decimal> The vertices rounding radius. |
vrm | <integer-list-3 | integer> The vertices rounding mode. |
vfn | <integer-list-3 | integer> The vertices arc fragment number. |
cm | <integer> The center mode; [0,1,2, or 3]. |
cm | value description |
---|---|
0 | origin at vertex v1 |
1 | origin at triangle centroid |
2 | origin at triangle incenter |
3 | origin at triangle circumcenter |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Parameter location
Object example
Definition at line 1103 of file polygon.scad.
module pg_triangle_sss | ( | v | , |
a | = x_axis_ci , |
||
o | , | ||
vr | , | ||
vrm | = 1 , |
||
vfn | , | ||
cm | = 0 |
||
) |
A polygon triangle specified by three side lengths with vertex rounding.
v | <decimal-list-3> A list, [s1, s2, s3], the side lengths. |
a | <integer> The triangle side alignment axis index < x_axis_ci | y_axis_ci >. |
o | <point-2d> The origin offset coordinate [x, y]. |
vr | <decimal-list-3 | decimal> The vertices rounding radius. |
vrm | <integer-list-3 | integer> The vertices rounding mode. |
vfn | <integer-list-3 | integer> The vertices arc fragment number. |
cm | <integer> The center mode; [0,1,2, or 3]. |
cm | value description |
---|---|
0 | origin at vertex v1 |
1 | origin at triangle centroid |
2 | origin at triangle incenter |
3 | origin at triangle circumcenter |
Each vertex may be assigned an individual rounding radius, rounding mode, and facet number as described in polygon_round_eve_all_p by using the parameters: vr
, vrm
, and vfn
. When vr
is undefined, no rounding is performed on the polygon vertices.
Parameter location
Object example
Definition at line 1038 of file polygon.scad.