**This is an old revision of the document!**

Introduction

All rounded shapes have a `resolution`

option which controls tesselation. If `resolution`

is set to 8, then 8 polygons are used to create 360 degrees of revolution.

This allows each design to control the amount of detail present, but beware that calculations and rendering time will also increase. For example, the number of polygons increases quadratically with each increase of the `resolution`

for spheres.

EXAMPLE

If the `resolution`

option is omitted, the following resolution is used.

- CSG.defaultResolution2D = 32

OpenSCAD like functions support the `fn`

parameter, which is the same as `resolution`

.

A two dimensional shape made with four straight sides where all interior angles are right angles (90°).

*Learn about rectangles at MathIsFun.com*

The following show examples of creating rectangles. The radius specifies the size. Rectangles with different radius for X and Y axis can be specified by supplying an array of values.

Defaults:

- radius : 1 or [1,1]
- center : [0,0]

square(5); // square 5 x 5 square([2,3]); // rectangle 2 x 3 square({size: [2,4], center: true}); // rectangle 2 x 4, centered on both X and Y axis

The CSG library functions can also be used. *NOTE: Deprecated in the V2 API*

CAG.rectangle({center: [0,0], radius: [5, 10]}); CAG.roundedRectangle({center: [0,0], radius: [10, 50], roundradius: 1, resolution: 4});

A two dimensional shape made by drawing a curve that is always the same distance from a center. All points are the same distance from the center.

*Learn about circles at MathIsFun.com*

The following show examples of creating circles. The radius specifies the size. The resolution option determines the number of segments to create in 360 degrees of rotation.

*Note: See the start of 2D Primitives for information about the resolution of two dimensional shapes.*

Defaults:

- radius : 1
- center : [0,0]
- resolution: defaultResolution2D (32)

let c1 = circle(1) let c2 = circle({r: 2, fn:5}) // fn = number of segments to approximate the circle let c3 = circle({r: 3, center: true})

The CSG library functions can also be used. *NOTE: Deprecated in the V2 API*

let c4 = CAG.circle({center: [0,0], radius: 3, resolution: 32})