Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

use Python language to draw squared spiral forms using color data saved in text files. An example of spiral form is shown in Figure 1.

use Python language to draw squared spiral forms using color data saved in text files. An example of spiral form is shown in Figure 1. The program input is a text file, which contains n lines. Each line contains three integer numbers representing the Red, Green and Blue values of the color used to draw a line segment (see Figures 2, 3 and 4). Three text files are provided: colors1.txt, colors2.txt and colors3.txt.

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribed

colors1.txt

193 205 64 148 133 90 107 158 162 215 38 164 227 199 210 183 81 122 51 187 133 228 78 55 98 228 166 97 158 178 250 39 69 228 87 80 17 102 9 152 166 212 200 119 239 182 99 94 57 202 95 206 78 5 34 48 159 101 53 120 210 15 244 196 103 34 223 227 159 118 222 182 160 144 36 25 182 168 190 139 121 247 165 27 143 66 166 183 97 246 133 86 21 26 148 122 223 85 104 213 183 244 157 105 131 110 128 186 150 112 95 69 140 32 177 96 203 64 86 124 40 127 199 238 160 144 175 40 161 235 77 193 112 93 154 37 3 114 42 146 178 84 184 130 179 183 165 55 136 201 154 71 28 28 30 213 124 193 148 123 87 172 47 250 193 35 157 193 205 114 100 18 107 150 41 22 54 174 72 79 244 92 68 77 238 87 255 239 49 74 71 73 199 131 236 213 23 236 249 154 214 230 171 199 17 121 93 191 115 51 39 23 53 230 150 37 230 138 148 60 7 162 183 9 96 116 208 19 141 212 142 154 221 198 56 148 241 226 157 45 38 35 203 72 37 153 147 197 203 189 229 46 26 96 108 84 240 79 137 116 86 149 51 162 78 158 76 146 60 87 185 61 124 81 247 152 5 142 224 87 210 106 122 210 7 38 95 156 151 4 45 16 233 246 201 197 27 153 247 69

colors2.txt

31 155 198 203 90 145 240 38 114 150 209 175 212 191 169 159 182 246 28 48 17 196 48 151 243 79 159 22 29 28

colors3.txt

22 135 217202 60 192109 186 10 198 81 117 234 151 172 65 69 162 61 139 198 201 120 20 135 174 169 170 40 27 187 255 43 147 30 141 109 69 11 109 67 31 32 165 197 10 52 231 162 213 157 68 138 137 131 68 195 236 84 108 207 143 56 110 107 242 146 250 24 234 253 185 106 59 49 161 133 79 40 74 88 87 153 88 129 76 152 95 145 54 65 231 32 32 28 204 44 237 226 146 189 135 167 36 29 105 170 50 152 197 80210 77 162 169 208 226 59 162 59 170 25 49 2 81 36 51 230 31 4 53 41 14 18 32 161 123 167 233 5 126 29 71 81 186 206 241 199 234 92

Objective: In this assignment we aim to use Python language to draw squared spiral forms using color data saved in text files. An example of spiral form is shown in Figure 1. The program input is a text file, which contains n lines. Each line contains three integer numbers representing the Red, Green and Blue values of the color used to draw a line segment (see Figures 2, 3 and 4). Three text files are provided: colors I.txt, colors2.txt and colors 3.txt The program uses a loop where, in each iteration, it reads from the input text file three principal color components, Red, Green and Blue and then draws one of the following four line segments 1. Horizontal line segment from left to right. 2. Vertical line segment from up to down. 3. Horizontal line segment from right to left. 4. Vertical line segment from down to up. It is worth to note that the line segments are drawn iteratively in the order mentioned above, and always the next line starts from the end of the previous line as described in the following algorithm

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

Data Management Databases And Organizations

Authors: Richard T. Watson

6th Edition

1943153035, 978-1943153039

More Books

Students also viewed these Databases questions