Skip to content
wang429 edited this page Dec 30, 2011 · 4 revisions

Circle

makeCircle()

Creates a Shape containing vertices resembling a circle

Arguments:

  • Vector center
  • integer radius
  • double/float angle. ** In radians ** multiplied by pi ** somewhat helps with determining resolution.

Implementation:

x = radius * cos(angle);
y = radius * sin(angle);

where theta is incremented by angle to create circle. Inserted Vectors will be shifted by center values.

Notes:

  • Not sure if calculating for only one quadrant and using negatives for the rest is faster or worth the time saved.
  • Still need to determine a resolution for circles.

Rectangle

makeRect()

Makes a Shape containing vertices in the shape of a rectangle

Arguments:

  • Vector corner (bottom left)
  • int width
  • int height

Implementation:

clockwise insert of 4 points. corner, corner + (0,height), corner + (width,height), corner + (width,0)

Notes:

Squares will just use makeRect();

Clone this wiki locally