omdl  v0.9.5
OpenSCAD Mechanical Design Library
polygon.scad File Reference

Polygon shapes, conversions, properties, and tests functions. More...

+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

Shapes
function polygon_regular_p (n, r, a, c=origin2d, o=0, vr, cw=true)
 Compute coordinates for an n-sided regular polygon in 2D. More...
 
function polygon_line_p (p1=origin2d, p2=x_axis2d_uv, l, x, y, r, fs, ft, fn=1)
 Compute coordinates along a line in 2D. More...
 
function polygon_arc_p (r=1, c=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, fn, cw=true)
 Compute coordinates of an arc with constant radius between two vectors in 2D. More...
 
function polygon_elliptical_sector_p (r=1, c=origin2d, v1=x_axis2d_uv, v2=x_axis2d_uv, s=true, fn, cw=true)
 Compute coordinates for an elliptical sector in 2D. More...
 
function polygon_trapezoid_p (b=1, h, l=1, a=90, o=origin2d, cw=true)
 Compute the coordinates for a rounded trapezoid in 2D space. More...
 
Properties
function polygon_regular_perimeter (n, r, a)
 Compute the perimeter of an n-sided regular polygon in 2D. More...
 
function polygon_regular_area (n, r, a)
 Compute the area of an n-sided regular polygon in 2D. More...
 
function polygon_perimeter (c, p)
 Calculate the perimeter length of a polygon in 2d. More...
 
function polygon_area (c, p, s=false)
 Compute the signed area of a polygon in a Euclidean 2d-space. More...
 
function polygon3d_area (c, p, n)
 Compute the area of a polygon in a Euclidean 3d-space. More...
 
function polygon_centroid (c, p)
 Compute the center of mass of a polygon in a Euclidean 2d-space. More...
 
function polygon_winding (c, p, t)
 Compute the winding number of a polygon about a point in a Euclidean 2d-space. More...
 
Tests
function polygon_is_clockwise (c, p)
 Test the vertex ordering of a polygon in a Euclidean 2d-space. More...
 
function polygon_is_convex (c, p)
 Test the convexity of a polygon in a Euclidean 2d-space. More...
 
function polygon_wn_is_p_inside (c, p, t)
 Test if a point is inside a polygon in a Euclidean 2d-space using winding number. More...
 
function polygon_as_is_p_inside (c, p, t)
 Test if a point is inside a polygon in a Euclidean 2d-space using angle summation. More...
 
Transforms
function polygon_linear_extrude_pf (c, p, h=1, centroid=false, center=false)
 Convert a polygon in 2D to a polyhedron by adding a height dimension. More...
 
Rounding
function polygon_round_eve_p (r=1, m=1, c=origin2d, v1=x_axis2d_uv, v2=y_axis2d_uv, fn, cw=true)
 Compute coordinates for a constant radius vertex round between two edge vectors in 2D. More...
 
function polygon_round_eve_all_p (c, vr=0, vrm=1, vfn, w=true, cw=true)
 Compute coordinates that round all of the vertices between each adjacent edges in 2D. More...
 
Interpreter
function polygon_turtle_p (s, i=origin2d, c=0)
 Generate list of coordinate points from simple operation step notation. More...
 

Detailed Description

Polygon shapes, conversions, properties, and tests functions.

Author
Roy Allen Sutton
Date
2015-2024

This file is part of omdl, an OpenSCAD mechanical design library.

The omdl is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

The omdl is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with the omdl; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA; or see http://www.gnu.org/licenses/.

Definition in file polygon.scad.