Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

The 20 Line Challenge / [LOCKED] [DBC/P] 2D Shape Algorithm

Author
Message
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Apr 2008 04:43 Edited at: 6th Apr 2008 22:12
During the past weeks, I have been attempting to grasp the basics of procedural methods for such tasks as creating media content.
As an experiment I wrote the following procedure; it draws a perfect 2D polygon with any number of sides (at least three of course).



I am using a PS3 controller to enter this so excuse me for not compressing my code to 20 lines.
I'm not using DB at the moment and so there may be some errors.

Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Apr 2008 04:47 Edited at: 9th Apr 2008 02:12
If you find any errors would you be kind enough to point them out as I have no DB to test on
thanks, hope you like.

Sven B
19
Years of Service
User Offline
Joined: 5th Jan 2005
Location: Belgium
Posted: 5th Apr 2008 19:15 Edited at: 5th Apr 2008 19:15
Okay, the shapes aren't even connected

They're just apparently some random lines sliding a little... One side is on the circle, the other one slides along a line or so it seems.

It's the programmer's life:
Have a problem, solve the problem, and have a new problem to solve.
NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 5th Apr 2008 23:06
That looks awesome, but I'm not sure that it matches the intended result.


I fail at life. No, really.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Apr 2008 02:38 Edited at: 6th Apr 2008 02:39
oh no
I've obviously made an error, or there's a syntax issue.
could someone please post a screenie so can see what the problem is?
thanks

it works perfectly in YaBasic

NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 6th Apr 2008 14:14
It looks to me like there's a sine where there should be a cosine or something somewhere. It makes a load of lines which do some weird conveyor belt effect, but doesn't make the geometric shapes.


I fail at life. No, really.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 6th Apr 2008 22:15
thanks a million nex
the second y was using sine when I meant to put cosine.
hopefully that was the only bug

NeX the Fairly Fast Ferret
19
Years of Service
User Offline
Joined: 10th Apr 2005
Location: The Fifth Plane of Oblivion
Posted: 6th Apr 2008 22:26
Yep, that's good now. A bit jerky, probably because my PC's ancient.


I fail at life. No, really.
Libervurto
17
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 9th Apr 2008 02:12
thanks again nex
is it all connected and rotating at a reasonable speed?
i would like it to take around 3-5 secs per revolution
has anyone got a good idea for an algorithm I could make next?

Login to post a reply

Server time is: 2024-04-19 02:43:58
Your offset time is: 2024-04-19 02:43:58