User Tools


Rectangle

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

Rectangle 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});