Question
Random parameters for SVG shapes Description In this part of the assignment, you are to generate random data for SVG shapes. Please follow the instructions
Random parameters for SVG shapes
Description
In this part of the assignment, you are to generate random data for SVG shapes.
Please follow the instructions as specified in the PDF file.
PDF INSTRUCTIONS: Generate pseudo random numbers as characteristic numbers for shapes (i.e., parameters for SVG drawing functions). using the specification in Table 1.
Table 1: Random number ranges
VAR - Description and Range:
* CNT - Shape counter
* SHA - Kind of shape: 0 for circle, 1 for rectangle, 2 for ellipse
* X - xcoordinate of shape (e.g., circle or ellipse center, rectangle topleft corner) in viewport range
* Y - ycoordinate of shape (e.g., circle or ellipse center, rectangle topleft corner) in viewport range
* RAD - Circle radius with small range 0 .. 100
* RX - xEllipse radius small range 10 ..30
* RY - yEllipse radius small range 10 ..30
* W - Rectangle width small range 10 .. 100
* H - Rectangle height small range 10 .. 100
* R - Red color of RGB in range 0 .. 255
* G - Green color of RGB in range 0 .. 255
*B - Blue color of RGB in range 0 .. 255
*OP - Shape opacity in range 0.0 .. 1.0
Print the parameters list for 10 shapes in the console window as follows:
Input: There is no input.
Output: Your program must print out the random data formatted as a table, as specified in the PDF instructions. Each column has a width of 4 characters
Sample Output 1
CNT SHA X Y RAD RX RY W H R G B OP 0 1 745 99 33 18 20 17 22 41 205 186 0.7 1 2 430 5 32 13 25 14 17 27 232 231 0.8 2 2 197 167 24 11 29 22 32 102 50 13 1.0 3 1 43 160 29 25 28 38 26 88 233 94 1.0 4 2 21 155 13 17 18 10 31 14 130 116 0.9 5 0 252 50 39 27 15 34 12 65 225 252 0.6 6 0 693 35 28 21 24 35 10 143 56 92 0.9 7 2 750 171 34 18 11 20 10 236 24 219 0.7 8 1 594 126 15 28 17 29 21 251 41 209 1.0 9 0 171 154 46 14 12 10 23 137 249 92 0.6
Use the following constants and template for generating the random ints and floats for the characteristic numbers for shapes. Do not seed the random number generator.Note that for grading using iLeap, we will use a specific seed.
Hint: Use the constants defined in the following template to solve this part. Please make sure to submit only the functions prngInt, prngFloat and genRandomArtNumbers.
#include#include #include #define MAXNUMSHAPES (10) #define WINWIDTH (800) #define WINHEIGHT (320) #define SHAPEMIN (0) #define SHAPEMAX (2) #define XMIN (0) #define XMAX (WINWIDTH) #define YMIN 0 #define YMAX (WINHEIGHT) #define RADMIN (10) #define RADMAX (50) #define RXMIN (10) #define RXMAX (30) #define RYMIN (10) #define RYMAX (30) #define WMIN (10) #define WMAX (40) #define HMIN (10) #define HMAX (40) #define REDMIN (0) #define REDMAX (255) #define GREENMIN (0) #define GREENMAX (255) #define BLUEMIN (0) #define BLUEMAX (255) #define OPMIN (0.6) #define OPMAX (1.0) #define PRECISION (100.0) //prototypes int main(void); int prng(int iLow, int iHigh); float prngFloat(float fLow, float fLigh, float precision); void genRandomArtNumbers(int n); int prngInt(int iLow, int iHigh) { // Replace with your code }//prngInt float prngFloat(float fLow, float fHigh, float precision) { // Replace with your code }//prngFloat void genRandomArtNumbers(int n) { // Use functions prngInt and prngFloat, and the constants // declared above to print out random data as specified in the instructions. // Replace with your code }//genRandomArtNumbers int main(void){ genRandomArtNumbers(MAXNUMSHAPES); return EXIT_SUCCESS; }//main
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started