![]() |
Forum Index : Microcontroller and PC projects : Maximite polygon patterns
![]() ![]() ![]() ![]() |
|||||
Author | Message | ||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
What kind of "didn't work"? Didn't draw what you expected, or what? Do you have a photo of what it did draw? And perhaps a sketch or explanation of what you were hoping for? PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
The code runs on my colour maximite. Do you have a colour or mono maximite? What version of MMBasic? What was the error (including the line number)? If we can get my code example working for you, I will draw a polygon for you. But I need to know why my code didn't work first. Jim VK7JH MMedit |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
Try this one and if it has an error, please tell me the error so I can work out what the probelm is. Play with s, st and z to see the different results. sX will give you ellipses. Jim VK7JH MMedit |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
G'Day Jim Thanks for that, you have verified my theory. The big difference is, you plot the points and then join them. I just wanted to draw the line after converting from polar to cart. But I am pleased and one day when I have time I will try writing the code. Peter |
||||
maxidavid Newbie ![]() Joined: 07/03/2019 Location: AustraliaPosts: 23 |
Hi, I have 4.5C MMBasic. I will type it in again to see if it works. I typed EDIT and then the code then F1 to save. Then RUN I only got a straight diagonal line. Thanks again. |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
I'm not really sure what the first program is supposed to show but they both work for me. I'm using Jim's MMEdit and just a copy and paste to put them into MMEdit. I suggest that you have a typo in your entry. Bill Keep safe. Live long and prosper. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6283 |
It looks like you are not getting the reversal of X working IF X > MM.HRES-SPEED OR X < SPEED THEN XADD=-XADD This should send the line back again. Similar for the Y line. You could put a PRINT statement in to see what is happening to X Jim VK7JH MMedit |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
This is my 2 bobs worth. CLS CPU 100 X0 = 200'x start Y0 = 200'Y start N = 7'number of sides L = 50'length of side For I = 0 to (N-1) XN = X0 + L * Cos(I * 6.28/N) YN - Y0 + L * Sin(I * 6.28/N) Line X0,Y0,XN,YN X0 = XN Y0 = YN NEXT I It runs on an E100 with a 7in touch screen In the getting to work I used degrees instead of radians i.e. 360 instread of 6.28. The results were quite interesting. Peter |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
On an Armmite H7 with 4.3" SSD1963, this [code] > list Option default float CLS CPU 100 X0 = 100 'x start Y0 = 100 'Y start N = 7'number of sides L = 50'length of side For I = 0 To (N-1) XN = X0 + L * Cos(I * 6.28/N) YN = Y0 + L * Sin(I * 6.28/N) Line X0,Y0,XN,YN X0 = XN Y0 = YN Next I [/code] produces this: ![]() The camera (out of focus, sorry) picks up the lines as much fatter than they show on the screen. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
G'Day lizby Good on yer mate! I started thinking this would be very very difficult and it turned out to be very very easy. If you change both 6.28s to 360 and N to 40, you will get the sort of nail and string thing that max was talking about. It's 2:00 am. My phone woke me up. Why do we do these things. ![]() Peter |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Ok. Like this: ![]() [code] > list Option default float CLS CPU 100 X0 = 100 'x start Y0 = 100 'Y start N = 40 'number of sides L = 200 'length of side For I = 0 To (N-1) XN = X0 + L * Cos(I * 360/N) YN = Y0 + L * Sin(I * 360/N) Line X0,Y0,XN,YN X0 = XN Y0 = YN Next I > [/code] PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
I hope that is what max wanted. It could be tidied up by making both 6.28s, Q x 6.28 where Q is the number of laps. Changing L, N, Q would give a big range of shapes. It is now 8:30 am. I went back to bed ![]() Peter |
||||
maxidavid Newbie ![]() Joined: 07/03/2019 Location: AustraliaPosts: 23 |
Hi, Thank you so much for the listings. I have been very busy and haven't had a chance to type them in. I look forward to trying them out. Now I have some interesting stuff to work with. I will use all the code you guys have shared to make some interesting listings. Thanks |
||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3378 |
Glad you brought up this topic--it looks fertile. I hope you mean cut and paste--so much less chance of frustration. Note this is Micromite code--don't know how it compares to the older Maximite syntax. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
maxidavid Newbie ![]() Joined: 07/03/2019 Location: AustraliaPosts: 23 |
Hi, I had to change a couple of lines to get them working. For example: Line X0,Y0,XN,YN to Line (X0,Y0)-(XN,YN) Thanks |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
lizby, max et al Have we a new convert? max, have you been looking at what matherp has been doing ? Peter |
||||
maxidavid Newbie ![]() Joined: 07/03/2019 Location: AustraliaPosts: 23 |
Hi, Who is matherp Peter ? BTW I've been having fun with the polygons :), thanks Guys. Also how can I draw an ellipse ? |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1642 |
Check out the circle command in the manual. Bill Keep safe. Live long and prosper. |
||||
PeterB Guru ![]() Joined: 05/02/2015 Location: AustraliaPosts: 655 |
G'Day David matherp is Peter Mather a very clever bloke who contributes a lot to this forum. Your post got him started and now he has started a new thread "Micromite Spirograph". The most recent entry was 17 March by me. They have generated some impressive patterns. To generate an ellipse you can increase the number of sides to get a circle then play with adjusting the value of L in X or Y not both. It sound like you are on the way ![]() Peter |
||||
maxidavid Newbie ![]() Joined: 07/03/2019 Location: AustraliaPosts: 23 |
Hi, I meant to ask, how do I change the angle of the ellipse ? I could not find that option in the circle command. Is there a way ? Thanks |
||||
![]() ![]() ![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |