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
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.
Offline
This can be imitated in the current Scratch using a very simple script:
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
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
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
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.
Offline
Offline
MathWizz wrote:
Fully agree, but I would make this project completely pointless.
![]()
But it would open so many doors!
Think of the DOORS!
Offline
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.
Offline
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