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.

Code Snippets / [DBP] A box you can drag the corners.

Author
Message
HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 4th Nov 2008 13:46 Edited at: 4th Nov 2008 16:32
Hi All,

Just something that lets you draw a box the you can move the corners to change the shape.



update added midpoints

edit 2
now all points do as they should.



Dark Physics makes any hot drink go cold.
SunDawg
19
Years of Service
User Offline
Joined: 21st Dec 2004
Location: Massachusetts
Posted: 15th Nov 2008 03:39
That's really cool!


My site, for various stuff that I make.
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 16th Nov 2008 00:54
Since you're already using an array, why not take advantage of that with a FOR loop? It should be easy enough to build a function to display a shape of any number of points with only a few lines. Consider this a little challenge for ya


AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 23rd Nov 2008 03:23
Regarding Phaelax's post, I was working on something similar to what he described. Here's the code:



It's not well commented because I wasn't expecting to give it to anybody, sorry.

HowDo
21
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 23rd Nov 2008 12:58
Thank for sharing the code AndrewT, looks very easy to do now you've done all the hard work finding out how to don it.

Now as Phaelax said above to find away of make either code start with three corners then make it so that more sides can be added.

Dark Physics makes any hot drink go cold.
AndrewT
17
Years of Service
User Offline
Joined: 11th Feb 2007
Location: MI, USA
Posted: 23rd Nov 2008 15:43
Quote: "Now as Phaelax said above to find away of make either code start with three corners then make it so that more sides can be added."


I already did. You can use CreatePolygon( ) to create polygons with up to 100 sides, you can optionally draw the midpoints of every side, you can optionally draw the center of any figure, you can drag around any vertex of any figure, and if you have a triangle you can draw medians as well.

Try changing this:



to this:



The first parameter is the ID of the shape, the second is the number of sides, the third is the polygon's size, and the last two are the polygon's starting position.

Login to post a reply

Server time is: 2024-05-18 18:30:10
Your offset time is: 2024-05-18 18:30:10