This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-12-08 12:33:09

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Fill Polygon

With flash player, this is more possible than ever since flash has native support for this.

How it would work:

1. Start drawing a polygon with "polygon down", similar to pen down. A better name might be in order  wink
2. Move the sprite around. This adds points to the polygon in a similar fashion to adding lines by keeping the pen down.
3. Stop drawing with "Polygon up" or a better name.

This would open scratch up to a whole new realm of possibilities (with the addition of only 2 blocks!). Please consider this.  smile

Offline

 

#2 2011-12-08 13:03:31

veggieman001
Scratcher
Registered: 2010-02-20
Posts: 1000+

Re: Fill Polygon

I agree wholeheartedly!  big_smile


Posts: 20000 - Show all posts

Offline

 

#3 2011-12-08 13:13:54

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fill Polygon

This can be imitated in the current Scratch using a very simple script:
http://dl.dropbox.com/u/11532575/forums/polygons.gif

However, it's a very slow and glitchy process, and you cannot draw polygons using gotoXY. You need to actually navigate through the image to get it to draw. By the way, the script example above uses the mouse to draw filled polygons.

Offline

 

#4 2011-12-08 14:21:23

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: Fill Polygon

I'm going for something native and high performance, of course. (see my minecraft project)

Filling polygons is a large part of programming beyond scratch (with OpenGL, directX etc) so it would be great to introduce it to scratch 2.0 for learning purposes.

Offline

 

#5 2011-12-08 14:23:32

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Fill Polygon

Dawgles wrote:

I'm going for something native and high performance, of course. (see my minecraft project)

Filling polygons is a large part of programming beyond scratch (with OpenGL, directX etc) so it would be great to introduce it to scratch 2.0 for learning purposes.

Of course, I know, I was just pointing out a slow alternative that would work fine in turbo mode.

Offline

 

#6 2011-12-08 15:00:43

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: Fill Polygon

LS97 wrote:

Dawgles wrote:

I'm going for something native and high performance, of course. (see my minecraft project)

Filling polygons is a large part of programming beyond scratch (with OpenGL, directX etc) so it would be great to introduce it to scratch 2.0 for learning purposes.

Of course, I know, I was just pointing out a slow alternative that would work fine in turbo mode.

Not for lots of polygons.  sad

Offline

 

#7 2011-12-08 15:56:59

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Fill Polygon

Fully agree, but I would make this project completely pointless.  tongue


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#8 2011-12-10 08:30:33

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: Fill Polygon

MathWizz wrote:

Fully agree, but I would make this project completely pointless.  tongue

But it would open so many doors!
Think of the DOORS!

Offline

 

#9 2011-12-10 10:08:15

coolstuff
Community Moderator
Registered: 2008-03-06
Posts: 1000+

Re: Fill Polygon

Sounds like a fabulous idea! I support!  big_smile

Offline

 

#10 2011-12-11 13:01:38

Dawgles
Scratcher
Registered: 2011-07-29
Posts: 100+

Re: Fill Polygon

Thanks!

If anyone has any ideas on how to simplify the design, post it here. The easier and less intrusive it is the higher the chance (I bet) the scratch team has of adding it.  smile

Offline

 

#11 2011-12-12 16:28:03

DarthPickley
Scratcher
Registered: 2008-06-13
Posts: 100+

Re: Fill Polygon

I think this is great.

once, I thought "all we need is a [ fill triangle: ( ) ( ) , ( ) ( ) , ( ) ( ) ] block."
but then, as I kept trying to find an algorithm that would decompose any polygon into triangles which lay within the polygon, I found it difficult to find a solution that always worked.

More generally, I was not able to find a way to decompose any smooth Jordan curve into convex regions in a way that would contain the entire region inside a polygon.
However, I can find the area of any polygon (weighted by turning number CW)

but I don't know how you would do the polygon draw block. Maybe with a list of pairs of coordinates, or a pair of lists of coordinates...

Offline

 

Board footer