Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.
|
Forum Index : Microcontroller and PC projects : (MM-DM-UBW32) The 3D Mite !
Page 1 of 2 | |||||
Author | Message | ||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Heya I just discover the MM some day's ago and have build 3 different sort. Now for see what it can do i just have made some 3D graphics tests. The 3D Algorithm are pretty simple (no back face computing). only the 3D meshes is showed and rotate in your screen OK i stop babbling ... here are the sources. 3D Cube test: 10 'Number of Faces and Number of Points 11 DATA 35,19 12 'Points from the 3D Object 13 DATA -10.0,-10.0,-10.0 14 DATA 0.0,-10.0,-10.0 15 DATA -10.0,-10.0,0.0 16 DATA 10.0,-10.0,-10.0 17 DATA 10.0,-10.0,0.0 18 DATA 10.0,-10.0,10.0 19 DATA 0.0,-10.0,10.0 20 DATA -10.0,-10.0,10.0 21 DATA 10.0,0.0,-10.0 22 DATA 10.0,10.0,-10.0 23 DATA 10.0,10.0,0.0 24 DATA 10.0,10.0,10.0 25 DATA 10.0,0.0,10.0 26 DATA 0.0,10.0,-10.0 27 DATA -10.0,10.0,-10.0 28 DATA -10.0,10.0,0.0 29 DATA -10.0,10.0,10.0 30 DATA 0.0,10.0,10.0 31 DATA -10.0,0.0,-10.0 32 DATA -10.0,0.0,10.0 33 'Faces from the 3D Object 34 DATA 0,1,2 35 DATA 1,3,4 36 DATA 5,6,4 37 DATA 6,7,2 38 DATA 2,1,6 39 DATA 1,4,6 40 DATA 3,8,4 41 DATA 8,9,10 42 DATA 11,12,10 43 DATA 12,5,4 44 DATA 4,8,12 45 DATA 8,10,12 46 DATA 9,13,10 47 DATA 13,14,15 48 DATA 16,17,15 49 DATA 17,11,10 50 DATA 10,13,17 51 DATA 13,15,17 52 DATA 14,18,15 53 DATA 18,0,2 54 DATA 7,19,2 55 DATA 19,16,15 56 DATA 15,18,19 57 DATA 18,2,19 58 DATA 3,1,8 59 DATA 1,0,18 60 DATA 9,8,13 61 DATA 14,13,18 62 DATA 8,1,13 63 DATA 1,18,13 64 DATA 7,6,19 65 DATA 6,5,12 66 DATA 12,11,17 67 DATA 17,16,19 68 DATA 19,6,17 69 DATA 6,12,17 10000 OPTION base 0 10010 CLEAR 10020 CLS 10030 DIM sinx(360) 10040 DIM cosx(360) 10050 'We get the number of points and faces 10060 RESTORE 10070 READ nbface 10080 READ nbpoint 10090 DIM px(NbPoint) 10100 DIM py(NbPoint) 10110 DIM pz(NbPoint) 10120 DIM face(NbFace,3) 10130 DIM nx(NbPoint) 10140 DIM ny(NbPoint) 10150 deg = 3.14159 / 180 10160 'Record the sinus and cosinus table 10170 FOR a = 0 TO 359 10180 sinx(a) = SIN(a*deg) 10190 cosx(a) = COS(a*deg) 10200 NEXT a 10210 'Read the points from the 3D Meshe 10220 FOR a = 0 TO NbPoint 10230 READ px(a),py(a),pz(a) 10240 NEXT a 10250 'Record the Faces from the 3D Cube 10260 FOR a = 0 TO NbFace 10270 FOR b = 0 TO 2 10280 READ face(a,b) 10290 NEXT b 10300 NEXT a 10310 'Starting Angles 10320 ax = 45 10330 ay = 20 10340 az = 0 10350 'Zoom on the 3D Cube 10360 zoom = 5 10370 'Cube Center 10380 dx = 152 10390 dy = 108 10400 'Rotate the 3D Cube 10410 DO WHILE 1 10420 sx = sinx(ax) 10430 sy = sinx(ay) 10440 sz = sinx(az) 10450 cx = cosx(ax) 10460 cy = cosx(ay) 10470 cz = cosx(az) 10480 FOR i = 0 TO NbPoint 10490 tx = px(i) 10500 ty = py(i) 10510 tz = pz(i) 10520 'Save the old coordinates 10530 'Rotate on X axis 10540 y = ty * cx - tz * sx 10550 z = ty * sx + tz * cx 10560 ty = y 10570 tz = z 10580 'Rotate on Z axis 10590 x = tx * cz - ty * sz 10600 y = tx * sz + ty * cz 10610 tx = x 10620 ty = y 10630 'Rotate on Y axis 10640 x = tx * cy - tz * sy 10650 z = tx * sy + tz * cy 10660 'Save the screen points coordinates 10670 nx(i) = INT(x * zoom + dx) 10680 ny(i) = INT(y * zoom + dy) 10690 NEXT i 10700 'Erase the old 3D Cube and trace the new one 10710 CLS 10720 FOR i = 0 TO NbFace 10730 LINE(nx(face(i,0)),ny(face(i,0)))-(nx(face(i,1)),ny(face(i,1 ))),1 10740 LINE(nx(face(i,1)),ny(face(i,1)))-(nx(face(i,2)),ny(face(i,2 ))),1 10750 NEXT i 10760 'Increment all angles 10770 ax = ax + 3 10780 ay = ay + 3 10790 az = az + 3 10800 IF ax>359 THEN 10810 ax = ax - 360 10820 ENDIF 10830 IF ay>359 THEN 10840 ay = ay - 360 10850 ENDIF 10860 IF az > 359 THEN 10870 az = az - 360 10880 ENDIF 10890 LOOP As you can see i record the sinus and cosines in a array to not recompute them every cycle. For get the points and faces from the meshes i just have made a little VB6 converter to get a basic file code from a ASCII STL file. At end i just merge the points/faces file to the base 3D program. Enjoy. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Here is the 3D Ball test part 1 source code. 10 'Number of Faces and Number of Points 11 DATA 223,113 12 'Points from the 3D Object 13 DATA 3.6,1.5,-9.2 14 DATA 3.9,0.0,-9.2 15 DATA 0.0,0.0,-10.0 16 DATA 6.5,2.7,-7.1 17 DATA 7.0,0.0,-7.1 18 DATA 8.4,3.5,-4.1 19 DATA 9.1,0.0,-4.1 20 DATA 9.2,3.9,0.0 21 DATA 10.0,0.0,0.0 22 DATA 8.5,3.6,3.9 23 DATA 9.2,0.0,3.9 24 DATA 6.6,2.8,7.0 25 DATA 7.1,0.0,7.0 26 DATA 3.7,1.6,9.1 27 DATA 4.1,0.0,9.1 28 DATA 0.0,0.0,10.0 29 DATA 2.8,2.7,-9.2 30 DATA 5.0,5.0,-7.1 31 DATA 6.5,6.4,-4.1 32 DATA 7.1,7.0,0.0 33 DATA 6.6,6.5,3.9 34 DATA 5.0,5.0,7.0 35 DATA 2.9,2.9,9.1 36 DATA 1.6,3.5,-9.2 37 DATA 2.9,6.4,-7.1 38 DATA 3.7,8.4,-4.1 39 DATA 4.1,9.1,0.0 40 DATA 3.7,8.4,3.9 41 DATA 2.9,6.5,7.0 42 DATA 1.6,3.7,9.1 43 DATA 0.0,3.9,-9.2 44 DATA 0.0,7.0,-7.1 45 DATA 0.0,9.1,-4.1 46 DATA 0.0,10.0,0.0 47 DATA 0.0,9.2,3.9 48 DATA 0.0,7.1,7.0 49 DATA 0.0,4.1,9.1 50 DATA -1.5,3.6,-9.2 51 DATA -2.7,6.5,-7.1 52 DATA -3.5,8.4,-4.1 53 DATA -3.9,9.2,0.0 54 DATA -3.6,8.5,3.9 55 DATA -2.8,6.6,7.0 56 DATA -1.6,3.7,9.1 57 DATA -2.7,2.8,-9.2 58 DATA -5.0,5.0,-7.1 59 DATA -6.4,6.5,-4.1 60 DATA -7.0,7.1,0.0 61 DATA -6.5,6.6,3.9 62 DATA -5.0,5.0,7.0 63 DATA -2.9,2.9,9.1 64 DATA -3.5,1.6,-9.2 65 DATA -6.4,2.9,-7.1 66 DATA -8.4,3.7,-4.1 67 DATA -9.1,4.1,0.0 68 DATA -8.4,3.7,3.9 69 DATA -6.5,2.9,7.0 70 DATA -3.7,1.6,9.1 71 DATA -3.9,0.0,-9.2 72 DATA -7.0,0.0,-7.1 73 DATA -9.1,0.0,-4.1 74 DATA -10.0,0.0,0.0 75 DATA -9.2,0.0,3.9 76 DATA -7.1,0.0,7.0 77 DATA -4.1,0.0,9.1 78 DATA -3.6,-1.5,-9.2 79 DATA -6.5,-2.7,-7.1 80 DATA -8.4,-3.5,-4.1 81 DATA -9.2,-3.9,0.0 82 DATA -8.5,-3.6,3.9 83 DATA -6.6,-2.8,7.0 84 DATA -3.7,-1.6,9.1 85 DATA -2.8,-2.7,-9.2 86 DATA -5.0,-5.0,-7.1 87 DATA -6.5,-6.4,-4.1 88 DATA -7.1,-7.0,0.0 89 DATA -6.6,-6.5,3.9 90 DATA -5.0,-5.0,7.0 91 DATA -2.9,-2.9,9.1 92 DATA -1.6,-3.5,-9.2 93 DATA -2.9,-6.4,-7.1 94 DATA -3.7,-8.4,-4.1 95 DATA -4.1,-9.1,0.0 96 DATA -3.7,-8.4,3.9 97 DATA -2.9,-6.5,7.0 98 DATA -1.6,-3.7,9.1 99 DATA 0.0,-3.9,-9.2 100 DATA 0.0,-7.0,-7.1 101 DATA 0.0,-9.1,-4.1 102 DATA 0.0,-10.0,0.0 103 DATA 0.0,-9.2,3.9 104 DATA 0.0,-7.1,7.0 105 DATA 0.0,-4.1,9.1 106 DATA 1.5,-3.6,-9.2 107 DATA 2.7,-6.5,-7.1 108 DATA 3.5,-8.4,-4.1 109 DATA 3.9,-9.2,0.0 110 DATA 3.6,-8.5,3.9 111 DATA 2.8,-6.6,7.0 112 DATA 1.6,-3.7,9.1 113 DATA 2.7,-2.8,-9.2 114 DATA 5.0,-5.0,-7.1 115 DATA 6.4,-6.5,-4.1 116 DATA 7.0,-7.1,0.0 117 DATA 6.5,-6.6,3.9 118 DATA 5.0,-5.0,7.0 119 DATA 2.9,-2.9,9.1 120 DATA 3.5,-1.6,-9.2 121 DATA 6.4,-2.9,-7.1 122 DATA 8.4,-3.7,-4.1 123 DATA 9.1,-4.1,0.0 124 DATA 8.4,-3.7,3.9 125 DATA 6.5,-2.9,7.0 126 DATA 3.7,-1.6,9.1 127 'Faces from the 3D Object 128 DATA 0,1,2 129 DATA 3,4,1 130 DATA 3,1,0 131 DATA 5,6,4 132 DATA 5,4,3 133 DATA 7,8,6 134 DATA 7,6,5 135 DATA 9,10,8 136 DATA 9,8,7 137 DATA 11,12,10 138 DATA 11,10,9 139 DATA 13,14,12 140 DATA 13,12,11 141 DATA 15,14,13 142 DATA 16,0,2 143 DATA 17,3,0 144 DATA 17,0,16 145 DATA 18,5,3 146 DATA 18,3,17 147 DATA 19,7,5 148 DATA 19,5,18 149 DATA 20,9,7 150 DATA 20,7,19 151 DATA 21,11,9 152 DATA 21,9,20 153 DATA 22,13,11 154 DATA 22,11,21 155 DATA 15,13,22 156 DATA 23,16,2 157 DATA 24,17,16 158 DATA 24,16,23 159 DATA 25,18,17 160 DATA 25,17,24 161 DATA 26,19,18 162 DATA 26,18,25 163 DATA 27,20,19 164 DATA 27,19,26 165 DATA 28,21,20 166 DATA 28,20,27 167 DATA 29,22,21 168 DATA 29,21,28 169 DATA 15,22,29 170 DATA 30,23,2 171 DATA 31,24,23 172 DATA 31,23,30 173 DATA 32,25,24 174 DATA 32,24,31 175 DATA 33,26,25 176 DATA 33,25,32 177 DATA 34,27,26 178 DATA 34,26,33 179 DATA 35,28,27 180 DATA 35,27,34 181 DATA 36,29,28 182 DATA 36,28,35 183 DATA 15,29,36 184 DATA 37,30,2 185 DATA 38,31,30 186 DATA 38,30,37 187 DATA 39,32,31 188 DATA 39,31,38 189 DATA 40,33,32 190 DATA 40,32,39 191 DATA 41,34,33 192 DATA 41,33,40 193 DATA 42,35,34 194 DATA 42,34,41 195 DATA 43,36,35 196 DATA 43,35,42 197 DATA 15,36,43 198 DATA 44,37,2 199 DATA 45,38,37 200 DATA 45,37,44 201 DATA 46,39,38 202 DATA 46,38,45 203 DATA 47,40,39 204 DATA 47,39,46 205 DATA 48,41,40 206 DATA 48,40,47 207 DATA 49,42,41 208 DATA 49,41,48 209 DATA 50,43,42 210 DATA 50,42,49 211 DATA 15,43,50 212 DATA 51,44,2 213 DATA 52,45,44 214 DATA 52,44,51 215 DATA 53,46,45 216 DATA 53,45,52 217 DATA 54,47,46 218 DATA 54,46,53 219 DATA 55,48,47 220 DATA 55,47,54 221 DATA 56,49,48 222 DATA 56,48,55 223 DATA 57,50,49 224 DATA 57,49,56 225 DATA 15,50,57 226 DATA 58,51,2 227 DATA 59,52,51 228 DATA 59,51,58 229 DATA 60,53,52 230 DATA 60,52,59 231 DATA 61,54,53 232 DATA 61,53,60 233 DATA 62,55,54 234 DATA 62,54,61 235 DATA 63,56,55 236 DATA 63,55,62 237 DATA 64,57,56 238 DATA 64,56,63 239 DATA 15,57,64 240 DATA 65,58,2 241 DATA 66,59,58 242 DATA 66,58,65 243 DATA 67,60,59 244 DATA 67,59,66 245 DATA 68,61,60 246 DATA 68,60,67 247 DATA 69,62,61 248 DATA 69,61,68 249 DATA 70,63,62 250 DATA 70,62,69 251 DATA 71,64,63 252 DATA 71,63,70 253 DATA 15,64,71 254 DATA 72,65,2 255 DATA 73,66,65 256 DATA 73,65,72 257 DATA 74,67,66 258 DATA 74,66,73 259 DATA 75,68,67 260 DATA 75,67,74 261 DATA 76,69,68 262 DATA 76,68,75 263 DATA 77,70,69 264 DATA 77,69,76 265 DATA 78,71,70 266 DATA 78,70,77 267 DATA 15,71,78 268 DATA 79,72,2 269 DATA 80,73,72 270 DATA 80,72,79 271 DATA 81,74,73 272 DATA 81,73,80 273 DATA 82,75,74 274 DATA 82,74,81 275 DATA 83,76,75 276 DATA 83,75,82 277 DATA 84,77,76 278 DATA 84,76,83 279 DATA 85,78,77 280 DATA 85,77,84 281 DATA 15,78,85 282 DATA 86,79,2 283 DATA 87,80,79 284 DATA 87,79,86 285 DATA 88,81,80 286 DATA 88,80,87 287 DATA 89,82,81 288 DATA 89,81,88 289 DATA 90,83,82 290 DATA 90,82,89 291 DATA 91,84,83 292 DATA 91,83,90 293 DATA 92,85,84 294 DATA 92,84,91 295 DATA 15,85,92 296 DATA 93,86,2 297 DATA 94,87,86 298 DATA 94,86,93 299 DATA 95,88,87 300 DATA 95,87,94 301 DATA 96,89,88 302 DATA 96,88,95 303 DATA 97,90,89 304 DATA 97,89,96 305 DATA 98,91,90 306 DATA 98,90,97 307 DATA 99,92,91 308 DATA 99,91,98 309 DATA 15,92,99 310 DATA 100,93,2 311 DATA 101,94,93 312 DATA 101,93,100 313 DATA 102,95,94 314 DATA 102,94,101 315 DATA 103,96,95 316 DATA 103,95,102 317 DATA 104,97,96 318 DATA 104,96,103 319 DATA 105,98,97 320 DATA 105,97,104 321 DATA 106,99,98 322 DATA 106,98,105 323 DATA 15,99,106 324 DATA 107,100,2 325 DATA 108,101,100 326 DATA 108,100,107 327 DATA 109,102,101 328 DATA 109,101,108 329 DATA 110,103,102 330 DATA 110,102,109 331 DATA 111,104,103 332 DATA 111,103,110 333 DATA 112,105,104 334 DATA 112,104,111 335 DATA 113,106,105 336 DATA 113,105,112 337 DATA 15,106,113 338 DATA 1,107,2 339 DATA 4,108,107 340 DATA 4,107,1 341 DATA 6,109,108 342 DATA 6,108,4 343 DATA 8,110,109 344 DATA 8,109,6 345 DATA 10,111,110 346 DATA 10,110,8 347 DATA 12,112,111 348 DATA 12,111,10 349 DATA 14,113,112 350 DATA 14,112,12 351 DATA 15,113,14 10000 OPTION base 0 10010 CLEAR 10020 CLS 10030 DIM sinx(360) 10040 DIM cosx(360) 10050 'We get the number of points and faces 10060 RESTORE 10070 READ nbface 10080 READ nbpoint 10090 DIM px(NbPoint) 10100 DIM py(NbPoint) 10110 DIM pz(NbPoint) 10120 DIM face(NbFace,3) 10130 DIM nx(NbPoint) 10140 DIM ny(NbPoint) 10150 deg = 3.14159 / 180 10160 'Record the sinus and cosinus table 10170 FOR a = 0 TO 359 10180 sinx(a) = SIN(a*deg) 10190 cosx(a) = COS(a*deg) 10200 NEXT a 10210 'Read the points from the 3D Meshe 10220 FOR a = 0 TO NbPoint 10230 READ px(a),py(a),pz(a) 10240 NEXT a 10250 'Record the Faces from the 3D Cube 10260 FOR a = 0 TO NbFace 10270 FOR b = 0 TO 2 10280 READ face(a,b) 10290 NEXT b 10300 NEXT a 10310 'Starting Angles 10320 ax = 45 10330 ay = 20 10340 az = 0 10350 'Zoom on the 3D Cube 10360 zoom = 5 10370 'Cube Center 10380 dx = 152 10390 dy = 108 10400 'Rotate the 3D Cube 10410 DO WHILE 1 10420 sx = sinx(ax) 10430 sy = sinx(ay) 10440 sz = sinx(az) 10450 cx = cosx(ax) 10460 cy = cosx(ay) 10470 cz = cosx(az) 10480 FOR i = 0 TO NbPoint 10490 tx = px(i) 10500 ty = py(i) 10510 tz = pz(i) 10520 'Save the old coordinates 10530 'Rotate on X axis 10540 y = ty * cx - tz * sx 10550 z = ty * sx + tz * cx 10560 ty = y 10570 tz = z 10580 'Rotate on Z axis 10590 x = tx * cz - ty * sz 10600 y = tx * sz + ty * cz 10610 tx = x 10620 ty = y 10630 'Rotate on Y axis 10640 x = tx * cy - tz * sy 10650 z = tx * sy + tz * cy 10660 'Save the screen points coordinates 10670 nx(i) = INT(x * zoom + dx) 10680 ny(i) = INT(y * zoom + dy) 10690 NEXT i 10700 'Erase the old 3D Cube and trace the new one 10710 CLS 10720 FOR i = 0 TO NbFace 10730 LINE(nx(face(i,0)),ny(face(i,0)))-(nx(face(i,1)),ny(face(i,1 ))),1 10740 LINE(nx(face(i,1)),ny(face(i,1)))-(nx(face(i,2)),ny(face(i,2 ))),1 10750 NEXT i 10760 'Increment all angles 10770 ax = ax + 3 10780 ay = ay + 3 10790 az = az + 3 10800 IF ax>359 THEN 10810 ax = ax - 360 10820 ENDIF 10830 IF ay>359 THEN 10840 ay = ay - 360 10850 ENDIF 10860 IF az > 359 THEN 10870 az = az - 360 10880 ENDIF 10890 LOOP Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
3D Ball Test part 2 174 DATA 32,24,31 175 DATA 33,26,25 176 DATA 33,25,32 177 DATA 34,27,26 178 DATA 34,26,33 179 DATA 35,28,27 180 DATA 35,27,34 181 DATA 36,29,28 182 DATA 36,28,35 183 DATA 15,29,36 184 DATA 37,30,2 185 DATA 38,31,30 186 DATA 38,30,37 187 DATA 39,32,31 188 DATA 39,31,38 189 DATA 40,33,32 190 DATA 40,32,39 191 DATA 41,34,33 192 DATA 41,33,40 193 DATA 42,35,34 194 DATA 42,34,41 195 DATA 43,36,35 196 DATA 43,35,42 197 DATA 15,36,43 198 DATA 44,37,2 199 DATA 45,38,37 200 DATA 45,37,44 201 DATA 46,39,38 202 DATA 46,38,45 203 DATA 47,40,39 204 DATA 47,39,46 205 DATA 48,41,40 206 DATA 48,40,47 207 DATA 49,42,41 208 DATA 49,41,48 209 DATA 50,43,42 210 DATA 50,42,49 211 DATA 15,43,50 212 DATA 51,44,2 213 DATA 52,45,44 214 DATA 52,44,51 215 DATA 53,46,45 216 DATA 53,45,52 217 DATA 54,47,46 218 DATA 54,46,53 219 DATA 55,48,47 220 DATA 55,47,54 221 DATA 56,49,48 222 DATA 56,48,55 223 DATA 57,50,49 224 DATA 57,49,56 225 DATA 15,50,57 226 DATA 58,51,2 227 DATA 59,52,51 228 DATA 59,51,58 229 DATA 60,53,52 230 DATA 60,52,59 231 DATA 61,54,53 232 DATA 61,53,60 233 DATA 62,55,54 234 DATA 62,54,61 235 DATA 63,56,55 236 DATA 63,55,62 237 DATA 64,57,56 238 DATA 64,56,63 239 DATA 15,57,64 240 DATA 65,58,2 241 DATA 66,59,58 242 DATA 66,58,65 243 DATA 67,60,59 244 DATA 67,59,66 245 DATA 68,61,60 246 DATA 68,60,67 247 DATA 69,62,61 248 DATA 69,61,68 249 DATA 70,63,62 250 DATA 70,62,69 251 DATA 71,64,63 252 DATA 71,63,70 253 DATA 15,64,71 254 DATA 72,65,2 255 DATA 73,66,65 256 DATA 73,65,72 257 DATA 74,67,66 258 DATA 74,66,73 259 DATA 75,68,67 260 DATA 75,67,74 261 DATA 76,69,68 262 DATA 76,68,75 263 DATA 77,70,69 264 DATA 77,69,76 265 DATA 78,71,70 266 DATA 78,70,77 267 DATA 15,71,78 268 DATA 79,72,2 269 DATA 80,73,72 270 DATA 80,72,79 271 DATA 81,74,73 272 DATA 81,73,80 273 DATA 82,75,74 274 DATA 82,74,81 275 DATA 83,76,75 276 DATA 83,75,82 277 DATA 84,77,76 278 DATA 84,76,83 279 DATA 85,78,77 280 DATA 85,77,84 281 DATA 15,78,85 282 DATA 86,79,2 283 DATA 87,80,79 284 DATA 87,79,86 285 DATA 88,81,80 286 DATA 88,80,87 287 DATA 89,82,81 288 DATA 89,81,88 289 DATA 90,83,82 290 DATA 90,82,89 291 DATA 91,84,83 292 DATA 91,83,90 293 DATA 92,85,84 294 DATA 92,84,91 295 DATA 15,85,92 296 DATA 93,86,2 297 DATA 94,87,86 298 DATA 94,86,93 299 DATA 95,88,87 300 DATA 95,87,94 301 DATA 96,89,88 302 DATA 96,88,95 303 DATA 97,90,89 304 DATA 97,89,96 305 DATA 98,91,90 306 DATA 98,90,97 307 DATA 99,92,91 308 DATA 99,91,98 309 DATA 15,92,99 310 DATA 100,93,2 311 DATA 101,94,93 312 DATA 101,93,100 313 DATA 102,95,94 314 DATA 102,94,101 315 DATA 103,96,95 316 DATA 103,95,102 317 DATA 104,97,96 318 DATA 104,96,103 319 DATA 105,98,97 320 DATA 105,97,104 321 DATA 106,99,98 322 DATA 106,98,105 323 DATA 15,99,106 324 DATA 107,100,2 325 DATA 108,101,100 326 DATA 108,100,107 327 DATA 109,102,101 328 DATA 109,101,108 329 DATA 110,103,102 330 DATA 110,102,109 331 DATA 111,104,103 332 DATA 111,103,110 333 DATA 112,105,104 334 DATA 112,104,111 335 DATA 113,106,105 336 DATA 113,105,112 337 DATA 15,106,113 338 DATA 1,107,2 339 DATA 4,108,107 340 DATA 4,107,1 341 DATA 6,109,108 342 DATA 6,108,4 343 DATA 8,110,109 344 DATA 8,109,6 345 DATA 10,111,110 346 DATA 10,110,8 347 DATA 12,112,111 348 DATA 12,111,10 349 DATA 14,113,112 350 DATA 14,112,12 351 DATA 15,113,14 10000 OPTION base 0 10010 CLEAR 10020 CLS 10030 DIM sinx(360) 10040 DIM cosx(360) 10050 'We get the number of points and faces 10060 RESTORE 10070 READ nbface 10080 READ nbpoint 10090 DIM px(NbPoint) 10100 DIM py(NbPoint) 10110 DIM pz(NbPoint) 10120 DIM face(NbFace,3) 10130 DIM nx(NbPoint) 10140 DIM ny(NbPoint) 10150 deg = 3.14159 / 180 10160 'Record the sinus and cosinus table 10170 FOR a = 0 TO 359 10180 sinx(a) = SIN(a*deg) 10190 cosx(a) = COS(a*deg) 10200 NEXT a 10210 'Read the points from the 3D Meshe 10220 FOR a = 0 TO NbPoint 10230 READ px(a),py(a),pz(a) 10240 NEXT a 10250 'Record the Faces from the 3D Cube 10260 FOR a = 0 TO NbFace 10270 FOR b = 0 TO 2 10280 READ face(a,b) 10290 NEXT b 10300 NEXT a 10310 'Starting Angles 10320 ax = 45 10330 ay = 20 10340 az = 0 10350 'Zoom on the 3D Cube 10360 zoom = 5 10370 'Cube Center 10380 dx = 152 10390 dy = 108 10400 'Rotate the 3D Cube 10410 DO WHILE 1 10420 sx = sinx(ax) 10430 sy = sinx(ay) 10440 sz = sinx(az) 10450 cx = cosx(ax) 10460 cy = cosx(ay) 10470 cz = cosx(az) 10480 FOR i = 0 TO NbPoint 10490 tx = px(i) 10500 ty = py(i) 10510 tz = pz(i) 10520 'Save the old coordinates 10530 'Rotate on X axis 10540 y = ty * cx - tz * sx 10550 z = ty * sx + tz * cx 10560 ty = y 10570 tz = z 10580 'Rotate on Z axis 10590 x = tx * cz - ty * sz 10600 y = tx * sz + ty * cz 10610 tx = x 10620 ty = y 10630 'Rotate on Y axis 10640 x = tx * cy - tz * sy 10650 z = tx * sy + tz * cy 10660 'Save the screen points coordinates 10670 nx(i) = INT(x * zoom + dx) 10680 ny(i) = INT(y * zoom + dy) 10690 NEXT i 10700 'Erase the old 3D Cube and trace the new one 10710 CLS 10720 FOR i = 0 TO NbFace 10730 LINE(nx(face(i,0)),ny(face(i,0)))-(nx(face(i,1)),ny(face(i,1 ))),1 10740 LINE(nx(face(i,1)),ny(face(i,1)))-(nx(face(i,2)),ny(face(i,2 ))),1 10750 NEXT i 10760 'Increment all angles 10770 ax = ax + 3 10780 ay = ay + 3 10790 az = az + 3 10800 IF ax>359 THEN 10810 ax = ax - 360 10820 ENDIF 10830 IF ay>359 THEN 10840 ay = ay - 360 10850 ENDIF 10860 IF az > 359 THEN 10870 az = az - 360 10880 ENDIF 10890 LOOP Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
3D Ball Test part 3 338 DATA 1,107,2 339 DATA 4,108,107 340 DATA 4,107,1 341 DATA 6,109,108 342 DATA 6,108,4 343 DATA 8,110,109 344 DATA 8,109,6 345 DATA 10,111,110 346 DATA 10,110,8 347 DATA 12,112,111 348 DATA 12,111,10 349 DATA 14,113,112 350 DATA 14,112,12 351 DATA 15,113,14 10000 OPTION base 0 10010 CLEAR 10020 CLS 10030 DIM sinx(360) 10040 DIM cosx(360) 10050 'We get the number of points and faces 10060 RESTORE 10070 READ nbface 10080 READ nbpoint 10090 DIM px(NbPoint) 10100 DIM py(NbPoint) 10110 DIM pz(NbPoint) 10120 DIM face(NbFace,3) 10130 DIM nx(NbPoint) 10140 DIM ny(NbPoint) 10150 deg = 3.14159 / 180 10160 'Record the sinus and cosinus table 10170 FOR a = 0 TO 359 10180 sinx(a) = SIN(a*deg) 10190 cosx(a) = COS(a*deg) 10200 NEXT a 10210 'Read the points from the 3D Meshe 10220 FOR a = 0 TO NbPoint 10230 READ px(a),py(a),pz(a) 10240 NEXT a 10250 'Record the Faces from the 3D Meshe 10260 FOR a = 0 TO NbFace 10270 FOR b = 0 TO 2 10280 READ face(a,b) 10290 NEXT b 10300 NEXT a 10310 'Starting Angles 10320 ax = 45 10330 ay = 20 10340 az = 0 10350 'Zoom on the 3D Cube 10360 zoom = 5 10370 'Cube Center 10380 dx = 152 10390 dy = 108 10400 'Rotate the 3D Cube 10410 DO WHILE 1 10420 sx = sinx(ax) 10430 sy = sinx(ay) 10440 sz = sinx(az) 10450 cx = cosx(ax) 10460 cy = cosx(ay) 10470 cz = cosx(az) 10480 FOR i = 0 TO NbPoint 10490 tx = px(i) 10500 ty = py(i) 10510 tz = pz(i) 10520 ' 10530 'Rotate on X axis 10540 y = ty * cx - tz * sx 10550 z = ty * sx + tz * cx 10560 ty = y 10570 tz = z 10580 'Rotate on Z axis 10590 x = tx * cz - ty * sz 10600 y = tx * sz + ty * cz 10610 tx = x 10620 ty = y 10630 'Rotate on Y axis 10640 x = tx * cy - tz * sy 10650 z = tx * sy + tz * cy 10660 'Save the screen points coordinates 10670 nx(i) = INT(x * zoom + dx) 10680 ny(i) = INT(y * zoom + dy) 10690 NEXT i 10700 'Erase the old meshe and trace the new one 10710 CLS 10720 FOR i = 0 TO NbFace 10730 LINE(nx(face(i,0)),ny(face(i,0)))-(nx(face(i,1)),ny(face(i,1 ))),1 10740 LINE(nx(face(i,1)),ny(face(i,1)))-(nx(face(i,2)),ny(face(i,2 ))),1 10750 NEXT i 10760 'Increment all angles 10770 ax = ax + 3 10780 ay = ay + 3 10790 az = az + 3 10800 IF ax>359 THEN 10810 ax = ax - 360 10820 ENDIF 10830 IF ay>359 THEN 10840 ay = ay - 360 10850 ENDIF 10860 IF az > 359 THEN 10870 az = az - 360 10880 ENDIF 10890 LOOP Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
crackerjack Senior Member Joined: 11/07/2011 Location: AustraliaPosts: 164 |
Hey Thanks. This is really cool stuff. I'll be trying it out soon as I'd like to try incorporate it with the Wii Nunchuck controllers I have coming in the mail. Cheers! |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2914 |
Hey Darthmite, Pretty cool (well sounds it), I am going to have to find a VGA monitor to give it a go... Welcome to `the shed' I havent seen your posts before Mick PS. Anyone know why the back shed screen is now 3 times wider than my actual screen (PC)? Mik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Hi Darthmite The first two work perfectly, most impressed by the first one. Reminds me of the days when I played around with 3D blocks on my Microbee, though the Maximite is a bucket load faster. The 3rd and 4th listings dont run, 3rd one has a Index out of bounts error on line 10730, and the 4th one has a No more data to read error line 10230 I also noticed where the 1st and 2nd listing start at line 10, the last two start at line 173 and 338. Could the first few lines have gone missing in action when you pasted the code? Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
bigmik Guru Joined: 20/06/2011 Location: AustraliaPosts: 2914 |
Hi Glenn, I think all of the 3 parts have to be added together to make 1 file for the 3d ball... It must have been as the listing is quite long Mik Mick's uMite Stuff can be found >>> HERE (Kindly hosted by Dontronics) <<< |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Hi , @Gizmo ,like bigmik said , you have to add all 3 parts in one file. I was not able to paste the complete listing in only one post ... we are probably limited in post length due to spam. Cheer. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
You know I've had a few members say that and I cant work it out. I thought it was a bug in the forum software or something, but as a test I've managed to post entire book chapters into a single post and it accepts it. Could someone give me some more information on this? How are you told there is a limit on th epost size, does the forum give you a message, or does the keyboard stop responding, or is part of the post missing after you post it? Also, if you do see the post limit condition, what browser are you using. I need a few clues, or a way to replicate the condition. Any help would be appreciated. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
Bill.b Senior Member Joined: 25/06/2011 Location: AustraliaPosts: 226 |
Hi Glen The forum posted a message saying You have exeeded 20,000 characters, I am not shaw of the exact number indicated as it was some time ago that i possed a long entry. this message appeared in a seperate window when I selected post reply. In the interests of the environment, this post has been constructed entirely from recycled electrons. |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
Thanks Bill, need some more clues though, anyone. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
camfab Newbie Joined: 10/09/2011 Location: AustraliaPosts: 13 |
ignore this folks, i was just trying a large post to help out, then found i couldnt delete it! can posts be deleted with the edit tool? Fre Sprky ///.../// |
||||
Gizmo Admin Group Joined: 05/06/2004 Location: AustraliaPosts: 5078 |
I think so. I'll clean up the thread once we're done anyway. I know this is all a bit off topic but I really need to sort this bug. If I can get the exact wording of the message, I can search for it in the software code. Glenn The best time to plant a tree was twenty years ago, the second best time is right now. JAQ |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Hi , Here when i have copy/paste the source code everything was OK. Then when i push 'Post Reply' , everything was OK too But ... when i have look the result on forum i have see that the code was not complete and i just have copy/paste the rest in the 2 other part of my post. For the 3rd part of the source i get a message that i have to wait because of spam. I was probably a little too fast for my 3rd post , it was OK after 1min waiting and reposting. Cheer. Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Heya So , i worked a little on my STL/PLY to Basic converter ... Now i cut the points/faces Basic line when they are > 100 chars. Its allot shorter now By the way i have add the back face algorithm to remove the back-face from the 3D Meshes when we show it on the screen. It's not perfect but it work :) Here are the source for the Cube and the Ball. I will post the Converter later when i have removed some bugs. the 3D Cube source : 10'Number of Faces and Number of Points 11 data 35,19 12'Points from the 3D Object 13 data -10.0,-10.0,-10.0,0.0,-10.0,-10.0,-10.0,-10.0,0.0,10.0,-10.0 ,-10.0,10.0,-10.0,0.0,10.0,-10.0,10.0 14 data 0.0,-10.0,10.0,-10.0,-10.0,10.0,10.0,0.0,-10.0,10.0,10.0,-10 .0,10.0,10.0,0.0,10.0,10.0,10.0,10.0,0.0,10.0 15 data 0.0,10.0,-10.0,-10.0,10.0,-10.0,-10.0,10.0,0.0,-10.0,10.0,10 .0,0.0,10.0,10.0,-10.0,0.0,-10.0,-10.0,0.0,10.0 16'Faces from the 3D Object 17 data 0,1,2,1,3,4,5,6,4,6,7,2,2,1,6,1,4,6,3,8,4,8,9,10,11,12,10,12 ,5,4,4,8,12,8,10,12,9,13,10,13,14,15 18 data 16,17,15,17,11,10,10,13,17,13,15,17,14,18,15,18,0,2,7,19,2,1 9,16,15,15,18,19,18,2,19,3,1,8,1,0,18 19 data 9,8,13,14,13,18,8,1,13,1,18,13,7,6,19,6,5,12,12,11,17,17,16, 19,19,6,17,6,12,17 20000 OPTION base 0 20010 CLEAR 20020 CLS 20030 DIM sinx(360) 20040 DIM cosx(360) 20050 'We get the number of points and faces 20060 RESTORE 20070 READ nbface 20080 READ nbpoint 20090 DIM px(NbPoint) 20100 DIM py(NbPoint) 20110 DIM pz(NbPoint) 20120 DIM face(NbFace,3) 20130 DIM bFace(NbFace,3) 20140 DIM nx(NbPoint) 20150 DIM ny(NbPoint) 20160 deg = 3.14159 / 180 20170 'Record the sinus and cosinus table 20180 FOR a = 0 TO 359 20190 sinx(a) = SIN(a*deg) 20200 cosx(a) = COS(a*deg) 20210 NEXT a 20220 'Read the points from the 3D Meshes 20230 FOR a = 0 TO NbPoint 20240 READ px(a),py(a),pz(a) 20250 NEXT a 20260 'Read the Faces from the 3D Meshes 20270 FOR a = 0 TO NbFace 20280 FOR b = 0 TO 2 20290 READ face(a,b) 20300 NEXT b 20310 NEXT a 20320 'Starting Angles 20330 ax = 45 20340 ay = 20 20350 az = 0 20360 'Zoom on the 3D Cube 20370 zoom = 5 20380 'Cube Center 20390 dx = 152 20400 dy = 108 20410 'Rotate the 3D Cube 20420 DO WHILE 1 20430 sx = sinx(ax) 20440 sy = sinx(ay) 20450 sz = sinx(az) 20460 cx = cosx(ax) 20470 cy = cosx(ay) 20480 cz = cosx(az) 20490 FOR i = 0 TO NbPoint 20500 tx = px(i) 20510 ty = py(i) 20520 tz = pz(i) 20530 ' 20540 'Rotate on X axis 20550 y = ty * cx - tz * sx 20560 z = ty * sx + tz * cx 20570 ty = y 20580 tz = z 20590 'Rotate on Z axis 20600 x = tx * cz - ty * sz 20610 y = tx * sz + ty * cz 20620 tx = x 20630 ty = y 20640 'Rotate on Y axis 20650 x = tx * cy - tz * sy 20660 z = tx * sy + tz * cy 20670 'Save the screen points coordinates 20680 nx(i) = INT(x * zoom + dx) 20690 ny(i) = INT(y * zoom + dy) 20700 NEXT i 20710 'We go compute the BackFace 20720 NbVisible = -1 20730 FOR i = 0 TO NbFace 20740 pts1x = nx(face(i,0)) 20750 pts1y = ny(face(i,0)) 20760 pts2x = nx(face(i,1)) 20770 pts2y = ny(face(i,1)) 20780 pts3x = nx(face(i,2)) 20790 pts3y = ny(face(i,2)) 20800 Nvector1 = (((pts1x / 100) - (pts2x / 100)) * ((pts3y / 100) - (pts2y / 100))) 20810 Nvector2 = (((pts3x / 100) - (pts2x / 100)) * ((pts1y / 100) - (pts2y / 100))) 20820 IF (nvector1 - nvector2) >= 0 THEN 20830 NbVisible = NbVisible + 1 20840 bFace(NbVisible,0) = face(i,0) 20850 bFace(NbVisible,1) = face(i,1) 20860 bFace(NbVisible,2) = face(i,2) 20870 ENDIF 20880 NEXT i 20890 'Erase the old Meshes and trace the new one 20900 CLS 20910 FOR i = 0 TO NbVisible 20920 LINE(nx(bFace(i,0)),ny(bFace(i,0)))-(nx(bFace(i,1)),ny(bFace (i,1))),1 20930 LINE(nx(bFace(i,1)),ny(bFace(i,1)))-(nx(bFace(i,2)),ny(bFace (i,2))),1 20940 NEXT i 20950 'Increment all angles 20960 ax = ax + 3 20970 ay = ay + 3 20980 az = az + 3 20990 IF ax>359 THEN 21000 ax = ax - 360 21010 ENDIF 21020 IF ay>359 THEN 21030 ay = ay - 360 21040 ENDIF 21050 IF az > 359 THEN 21060 az = az - 360 21070 ENDIF 21080 LOOP Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
And here the 3D Ball source : 10'Number of Faces and Number of Points 11 data 223,113 12'Points from the 3D Object 13 data 3.6,1.5,-9.2,3.9,0.0,-9.2,0.0,0.0,-10.0,6.5,2.7,-7.1,7.0,0.0 ,-7.1,8.4,3.5,-4.1,9.1,0.0,-4.1,9.2,3.9,0.0 14 data 10.0,0.0,0.0,8.5,3.6,3.9,9.2,0.0,3.9,6.6,2.8,7.0,7.1,0.0,7.0 ,3.7,1.6,9.1,4.1,0.0,9.1,0.0,0.0,10.0 15 data 2.8,2.7,-9.2,5.0,5.0,-7.1,6.5,6.4,-4.1,7.1,7.0,0.0,6.6,6.5,3 .9,5.0,5.0,7.0,2.9,2.9,9.1,1.6,3.5,-9.2 16 data 2.9,6.4,-7.1,3.7,8.4,-4.1,4.1,9.1,0.0,3.7,8.4,3.9,2.9,6.5,7. 0,1.6,3.7,9.1,0.0,3.9,-9.2,0.0,7.0,-7.1 17 data 0.0,9.1,-4.1,0.0,10.0,0.0,0.0,9.2,3.9,0.0,7.1,7.0,0.0,4.1,9. 1,-1.5,3.6,-9.2,-2.7,6.5,-7.1,-3.5,8.4,-4.1 18 data -3.9,9.2,0.0,-3.6,8.5,3.9,-2.8,6.6,7.0,-1.6,3.7,9.1,-2.7,2.8 ,-9.2,-5.0,5.0,-7.1,-6.4,6.5,-4.1 19 data -7.0,7.1,0.0,-6.5,6.6,3.9,-5.0,5.0,7.0,-2.9,2.9,9.1,-3.5,1.6 ,-9.2,-6.4,2.9,-7.1,-8.4,3.7,-4.1 20 data -9.1,4.1,0.0,-8.4,3.7,3.9,-6.5,2.9,7.0,-3.7,1.6,9.1,-3.9,0.0 ,-9.2,-7.0,0.0,-7.1,-9.1,0.0,-4.1 21 data -10.0,0.0,0.0,-9.2,0.0,3.9,-7.1,0.0,7.0,-4.1,0.0,9.1,-3.6,-1 .5,-9.2,-6.5,-2.7,-7.1,-8.4,-3.5,-4.1 22 data -9.2,-3.9,0.0,-8.5,-3.6,3.9,-6.6,-2.8,7.0,-3.7,-1.6,9.1,-2.8 ,-2.7,-9.2,-5.0,-5.0,-7.1,-6.5,-6.4,-4.1 23 data -7.1,-7.0,0.0,-6.6,-6.5,3.9,-5.0,-5.0,7.0,-2.9,-2.9,9.1,-1.6 ,-3.5,-9.2,-2.9,-6.4,-7.1,-3.7,-8.4,-4.1 24 data -4.1,-9.1,0.0,-3.7,-8.4,3.9,-2.9,-6.5,7.0,-1.6,-3.7,9.1,0.0, -3.9,-9.2,0.0,-7.0,-7.1,0.0,-9.1,-4.1 25 data 0.0,-10.0,0.0,0.0,-9.2,3.9,0.0,-7.1,7.0,0.0,-4.1,9.1,1.5,-3. 6,-9.2,2.7,-6.5,-7.1,3.5,-8.4,-4.1 26 data 3.9,-9.2,0.0,3.6,-8.5,3.9,2.8,-6.6,7.0,1.6,-3.7,9.1,2.7,-2.8 ,-9.2,5.0,-5.0,-7.1,6.4,-6.5,-4.1 27 data 7.0,-7.1,0.0,6.5,-6.6,3.9,5.0,-5.0,7.0,2.9,-2.9,9.1,3.5,-1.6 ,-9.2,6.4,-2.9,-7.1,8.4,-3.7,-4.1 28 data 9.1,-4.1,0.0,8.4,-3.7,3.9,6.5,-2.9,7.0,3.7,-1.6,9.1 29'Faces from the 3D Object 30 data 0,1,2,3,4,1,3,1,0,5,6,4,5,4,3,7,8,6,7,6,5,9,10,8,9,8,7,11,12 ,10,11,10,9,13,14,12,13,12,11,15,14,13 31 data 16,0,2,17,3,0,17,0,16,18,5,3,18,3,17,19,7,5,19,5,18,20,9,7,2 0,7,19,21,11,9,21,9,20,22,13,11,22,11,21 32 data 15,13,22,23,16,2,24,17,16,24,16,23,25,18,17,25,17,24,26,19,1 8,26,18,25,27,20,19,27,19,26,28,21,20 33 data 28,20,27,29,22,21,29,21,28,15,22,29,30,23,2,31,24,23,31,23,3 0,32,25,24,32,24,31,33,26,25,33,25,32 34 data 34,27,26,34,26,33,35,28,27,35,27,34,36,29,28,36,28,35,15,29, 36,37,30,2,38,31,30,38,30,37,39,32,31 35 data 39,31,38,40,33,32,40,32,39,41,34,33,41,33,40,42,35,34,42,34, 41,43,36,35,43,35,42,15,36,43,44,37,2 36 data 45,38,37,45,37,44,46,39,38,46,38,45,47,40,39,47,39,46,48,41, 40,48,40,47,49,42,41,49,41,48,50,43,42 37 data 50,42,49,15,43,50,51,44,2,52,45,44,52,44,51,53,46,45,53,45,5 2,54,47,46,54,46,53,55,48,47,55,47,54 38 data 56,49,48,56,48,55,57,50,49,57,49,56,15,50,57,58,51,2,59,52,5 1,59,51,58,60,53,52,60,52,59,61,54,53 39 data 61,53,60,62,55,54,62,54,61,63,56,55,63,55,62,64,57,56,64,56, 63,15,57,64,65,58,2,66,59,58,66,58,65 40 data 67,60,59,67,59,66,68,61,60,68,60,67,69,62,61,69,61,68,70,63, 62,70,62,69,71,64,63,71,63,70,15,64,71 41 data 72,65,2,73,66,65,73,65,72,74,67,66,74,66,73,75,68,67,75,67,7 4,76,69,68,76,68,75,77,70,69,77,69,76 42 data 78,71,70,78,70,77,15,71,78,79,72,2,80,73,72,80,72,79,81,74,7 3,81,73,80,82,75,74,82,74,81,83,76,75 43 data 83,75,82,84,77,76,84,76,83,85,78,77,85,77,84,15,78,85,86,79, 2,87,80,79,87,79,86,88,81,80,88,80,87 44 data 89,82,81,89,81,88,90,83,82,90,82,89,91,84,83,91,83,90,92,85, 84,92,84,91,15,85,92,93,86,2,94,87,86 45 data 94,86,93,95,88,87,95,87,94,96,89,88,96,88,95,97,90,89,97,89, 96,98,91,90,98,90,97,99,92,91,99,91,98 46 data 15,92,99,100,93,2,101,94,93,101,93,100,102,95,94,102,94,101, 103,96,95,103,95,102,104,97,96,104,96,103 47 data 105,98,97,105,97,104,106,99,98,106,98,105,15,99,106,107,100, 2,108,101,100,108,100,107,109,102,101 48 data 109,101,108,110,103,102,110,102,109,111,104,103,111,103,110, 112,105,104,112,104,111,113,106,105 49 data 113,105,112,15,106,113,1,107,2,4,108,107,4,107,1,6,109,108,6 ,108,4,8,110,109,8,109,6,10,111,110 50 data 10,110,8,12,112,111,12,111,10,14,113,112,14,112,12,15,113,14 20000 OPTION base 0 20010 CLEAR 20020 CLS 20030 DIM sinx(360) 20040 DIM cosx(360) 20050 'We get the number of points and faces 20060 RESTORE 20070 READ nbface 20080 READ nbpoint 20090 DIM px(NbPoint) 20100 DIM py(NbPoint) 20110 DIM pz(NbPoint) 20120 DIM face(NbFace,3) 20130 DIM bFace(NbFace,3) 20140 DIM nx(NbPoint) 20150 DIM ny(NbPoint) 20160 deg = 3.14159 / 180 20170 'Record the sinus and cosinus table 20180 FOR a = 0 TO 359 20190 sinx(a) = SIN(a*deg) 20200 cosx(a) = COS(a*deg) 20210 NEXT a 20220 'Read the points from the 3D Meshes 20230 FOR a = 0 TO NbPoint 20240 READ px(a),py(a),pz(a) 20250 NEXT a 20260 'Read the Faces from the 3D Meshes 20270 FOR a = 0 TO NbFace 20280 FOR b = 0 TO 2 20290 READ face(a,b) 20300 NEXT b 20310 NEXT a 20320 'Starting Angles 20330 ax = 45 20340 ay = 20 20350 az = 0 20360 'Zoom on the 3D Cube 20370 zoom = 5 20380 'Cube Center 20390 dx = 152 20400 dy = 108 20410 'Rotate the 3D Cube 20420 DO WHILE 1 20430 sx = sinx(ax) 20440 sy = sinx(ay) 20450 sz = sinx(az) 20460 cx = cosx(ax) 20470 cy = cosx(ay) 20480 cz = cosx(az) 20490 FOR i = 0 TO NbPoint 20500 tx = px(i) 20510 ty = py(i) 20520 tz = pz(i) 20530 ' 20540 'Rotate on X axis 20550 y = ty * cx - tz * sx 20560 z = ty * sx + tz * cx 20570 ty = y 20580 tz = z 20590 'Rotate on Z axis 20600 x = tx * cz - ty * sz 20610 y = tx * sz + ty * cz 20620 tx = x 20630 ty = y 20640 'Rotate on Y axis 20650 x = tx * cy - tz * sy 20660 z = tx * sy + tz * cy 20670 'Save the screen points coordinates 20680 nx(i) = INT(x * zoom + dx) 20690 ny(i) = INT(y * zoom + dy) 20700 NEXT i 20710 'We go compute the BackFace 20720 NbVisible = -1 20730 FOR i = 0 TO NbFace 20740 pts1x = nx(face(i,0)) 20750 pts1y = ny(face(i,0)) 20760 pts2x = nx(face(i,1)) 20770 pts2y = ny(face(i,1)) 20780 pts3x = nx(face(i,2)) 20790 pts3y = ny(face(i,2)) 20800 Nvector1 = (((pts1x / 100) - (pts2x / 100)) * ((pts3y / 100) - (pts2y / 100))) 20810 Nvector2 = (((pts3x / 100) - (pts2x / 100)) * ((pts1y / 100) - (pts2y / 100))) 20820 IF (nvector1 - nvector2) >= 0 THEN 20830 NbVisible = NbVisible + 1 20840 bFace(NbVisible,0) = face(i,0) 20850 bFace(NbVisible,1) = face(i,1) 20860 bFace(NbVisible,2) = face(i,2) 20870 ENDIF 20880 NEXT i 20890 'Erase the old Meshes and trace the new one 20900 CLS 20910 FOR i = 0 TO NbVisible 20920 LINE(nx(bFace(i,0)),ny(bFace(i,0)))-(nx(bFace(i,1)),ny(bFace (i,1))),1 20930 LINE(nx(bFace(i,1)),ny(bFace(i,1)))-(nx(bFace(i,2)),ny(bFace (i,2))),1 20940 NEXT i 20950 'Increment all angles 20960 ax = ax + 3 20970 ay = ay + 3 20980 az = az + 3 20990 IF ax>359 THEN 21000 ax = ax - 360 21010 ENDIF 21020 IF ay>359 THEN 21030 ay = ay - 360 21040 ENDIF 21050 IF az > 359 THEN 21060 az = az - 360 21070 ENDIF 21080 LOOP Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
elproducts Senior Member Joined: 19/06/2011 Location: United StatesPosts: 282 |
The 3D is great but I'm more interested in your STL to BASIC converter. Is this available and/or documented anywhere? I've just started investigating 3D printing (Makerbot, Reprap, etc) and found some easy to use 3D CAD software that will produce an STL file. I'd like to see if making a Maximite control a 2D or 3D printer could be done and your software seems like a key. I'd like to know more about the STL format. Do you have a good reference you could recommend? www.elproducts.com |
||||
Vikingboy Regular Member Joined: 23/09/2011 Location: AustraliaPosts: 82 |
Hi, Me too ! I am nearly completed my CNC machine and one of the uses for my maximite I was thinking of was as part of the control system for it (monitoring limit/home and other sub systems), I considered if it would be possible to have a standalone system running on the maximite with input of .stl/.DXF /Gcode files etc via the SDcard. Perhaps your code could make this a more reasonable possibility. rgds, Andrew |
||||
darthmite Senior Member Joined: 20/11/2011 Location: FrancePosts: 240 |
Hi, I don't have get reference etc.. from the STL format i just have export a cube and a ball from Rhino and have look how it show I have do the same with the PLY format and here are the results. Joined to this post the VB6 source and executable + all DLL required to run the soft. I dev in VB6 on a virtualbox with XP , it's why i add all dll to be able to use the soft into my Win7 x64 Enjoy. 2011-11-27_063206_STL_Mite.zip Theory is when we know everything but nothing work ... Practice is when everything work but no one know why ;) |
||||
Page 1 of 2 |
Print this page |