Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write in Java & use the STDDraw class in the code. Example inputs for STDDraw: void line (double x0, double y0, double x1,double y1)

Please write in Java & use the STDDraw class in the code. Example inputs for STDDraw:

void line (double x0, double y0, double x1,double y1)

void point (double x, double y)

static void square(double x, double y, double r)

Draw a Spirograph which is a curve that is formed rolling a curve inside or outside of another circle. The trick to drawing such a curve is to place the pen at any point on the rolling circle. If the radius of the fixed circle is R, the radius of the moving circle is r , and the offset of the pen point is a then the resulting curve is defined by: x = (R+r)*cos(t) - (r+a)*cos(((R+r)/r)*t) y = (R+r)*sin(t) - (r+a)*sin(((R+r)/r)*t) where t is a parameter that ranges from 0 t 100 in small increments (say 0.01)

Input

All Input for the above Task needs to taken as Commandline Arguments. No Input will be taken from the Standard Input Stream. The input consists of three numbers namely R, r, a which presents the following quantities R - Radius of the Larger Circle r - Radius of the smaller Circle a - Offset of the pen point in the moving circle

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Android 4 Application Development

Authors: Reto Meier

3rd Edition

1118223853, 9781118223857

More Books

Students also viewed these Programming questions