It seems there are many versions of pie out there.
In OpenScad it is always a good idea to avoid Boolean ops. Thus the
following version is more basic. While it doesn't explicitly account for $fs
(indeed polygon() seems to enforce it), it copes well with $fn, $fa, and any
pieSlice(10, 10, 23, $fa=3);
module pieSlice(r=10, start_angle=0, end_angle=45)
{
polygon(pie(r, start_angle, end_angle));
function pie(r=40, a1=0, a2=150) =
let(start = a1%360)
let(end = (a2%360-start)>=0?a2%360:a2%360+360)
let(fa = $fn==0?$fa:360/$fn)
let(step = (end-start)/ceil((end-start)/fa)- 1e-7)
r*[[0,0], for(i=[start:step:end]) [cos(i), sin(i)]];
}
--
Sent from: http://forum.openscad.org/
Add my version for completeness. It's part of my lib so I'll only post the
function signature here
'cos the lib needs to be downloaded anyway.
It takes a different approach, requiring any 3 points (PQR) in the 3D space.
function arcPts(
pqr
, n=6 // # of points produced
, rad= undef // radius, default = dPQ
, a = undef // angle, default = aPQR
, a2 = undef // a 2nd angle, if given, start from a pt
defined by a and rad
// , then move upward away from plane
PQR
, ratio= 1 // If given, replace rad.
)
See the following pic for demo, which is generated with this code
https://bitbucket.org/runsun/scadx/src/master/demos/demo_arcPts.scad .
http://forum.openscad.org/file/t602/180916-demo_arcPts.png
$ Runsun Pan, PhD $ libs: scadx , doctest , faces ( git ), offline doc ( git ), runscad.py ( 2 , git ), editor of choice: CudaText ( OpenSCAD lexer ); $ Tips ; $ Snippets
--
Sent from: http://forum.openscad.org/