omdl  v0.6.1
OpenSCAD Mechanical Design Library
Other Shapes

Mathematical functions for other shapes. More...

+ Collaboration diagram for Other Shapes:

Files

file  math_oshapes.scad
 Other shapes mathematical functions.
 

Functions

function rpolygon_lp (n, r, a, vr, cw=true)
 Compute the coordinates for an n-sided regular polygon. More...
 
function rpolygon_area (n, r, a)
 Compute the area of an n-sided regular polygon. More...
 
function rpolygon_perimeter (n, r, a)
 Compute the perimeter of an n-sided regular polygon. More...
 

Detailed Description

Mathematical functions for other shapes.

Function Documentation

function rpolygon_area ( ,
,
 
)

Compute the area of an n-sided regular polygon.

Parameters
n<integer> The number of sides.
r<decimal> The vertex circumradius of the circumcircle.
a<decimal> The inradius of the incircle.
Returns
<decimal> Area of the n-sided regular polygon.

The radius can be specified by either the circumradius r or the inradius a. If both are specified, r is used.

function rpolygon_lp ( ,
,
,
vr  ,
cw  = true 
)

Compute the coordinates for an n-sided regular polygon.

Parameters
n<integer> The number of sides.
r<decimal> The vertex circumradius of the circumcircle.
a<decimal> The inradius of the incircle.
vr<decimal> The vertex rounding radius.
cw<boolean> Use clockwise point ordering.
Returns
<coords-2d> A list of coordinates points [[x, y], ...].

The radius can be specified by either the circumradius r or the inradius a. If both are specified, r is used.

Example

vr=5;
hull()
{
for ( p = rpolygon_lp( r=20, n=5, vr=vr ) )
translate( p )
circle( r=vr );
}

+ Here is the caller graph for this function:

function rpolygon_perimeter ( ,
,
 
)

Compute the perimeter of an n-sided regular polygon.

Parameters
n<integer> The number of sides.
r<decimal> The vertex circumradius of the circumcircle.
a<decimal> The inradius of the incircle.
Returns
<decimal> Perimeter length of the n-sided regular polygon.

The radius can be specified by either the circumradius r or the inradius a. If both are specified, r is used.