CompForm Assignment 2 - Problem 5 · posted by vaibhav bhawsar Sep 21, 05:30

Problem 2 Touching Ovals Necklace Clock

Problem 5. Create a function called drawNecklace that draws a pearl necklace. Feel free to shade the pearls or make them sparkle in the light of the moving mouse.

void drawNecklace ( Vec2d c, float hr, float vr, int numberOfPoints )
{
	for(int i = 0; i < numberOfPoints; i++)
	{
		float angle = 2*PI / numberOfPoints * i;
		float x = sin(angle) * hr;
		float y = cos(angle) * vr;
		Vec2d p(x,y);
		p = p+c;
		drawCircle(p,20,20);
	}
}

Comment

Commenting is closed for this article.