Pentominoes
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Pentominoes
These are great fun: http://en.wikipedia.org/wiki/Pentomino
and it is dead easy to set up a base for this sort of thing . . .
one of the problems seems to be working out if shapes are overlapping each other.
and it is dead easy to set up a base for this sort of thing . . .
one of the problems seems to be working out if shapes are overlapping each other.
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Rotating non-square images still STINKS:
set the angle:
rotate:
set the angle:
rotate:
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
and a script in each shape to drag each group.
Now the fun really starts with all those little white TARGETS and how to do the INTERSECT code.
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Obviously THIS is not "on":
The dark green-grey around the grid of targets is an image "MASQ" where the bit
that overlaps the grid if targets (well, lies behind it) is completely transparent.
Now the green block contains the following code, which should send it 'home' if it overlaps
any of "MASQ", but as you can see from the picture above does not:
I wonder why?
If one leaves out "pixels" the shape returns home even when it is inwith the transparent area.
The dark green-grey around the grid of targets is an image "MASQ" where the bit
that overlaps the grid if targets (well, lies behind it) is completely transparent.
Now the green block contains the following code, which should send it 'home' if it overlaps
any of "MASQ", but as you can see from the picture above does not:
I wonder why?
If one leaves out "pixels" the shape returns home even when it is inwith the transparent area.
Re: Pentominoes
It's been stinking for the last 5 years or so...richmond62 wrote:Rotating non-square images still STINKS:
I lost a lot of hair working on rotation of various objects...
Paul
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Well, I have found the best way to deal with this problem is to overlay one's image on a square graphic which
is transparent and has 0 width borders: group the 2: give them a daft name such as "DAFT" and then do this
in the Message box:
import snapshot from group "DAFT"
and, Hey-Nonny-Nonny-Nonny-No (and other equally meaningless magic-sounding phrases)
one ends up with a square image containing one's original image, at which point you
can rotate it to your heart's content without any distortion.
is transparent and has 0 width borders: group the 2: give them a daft name such as "DAFT" and then do this
in the Message box:
import snapshot from group "DAFT"
and, Hey-Nonny-Nonny-Nonny-No (and other equally meaningless magic-sounding phrases)
one ends up with a square image containing one's original image, at which point you
can rotate it to your heart's content without any distortion.
Last edited by richmond62 on Tue Feb 03, 2015 11:25 am, edited 1 time in total.
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pentominoes
Hi Richmond,
you might want to have a look at this post from Jim James Hurley to the use-list.
http://runtime-revolution.278305.n4.nab ... l#a4276694
Kind regards
Bernd
you might want to have a look at this post from Jim James Hurley to the use-list.
http://runtime-revolution.278305.n4.nab ... l#a4276694
Kind regards
Bernd
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pentominoes
Or you might want to see Jim James Hurley's idea in a stack
I don't know if this helps.
Kind regards
Bernd
I don't know if this helps.
Kind regards
Bernd
- Attachments
-
- turnImageCenterOfMassII.livecode.zip
- (76.64 KiB) Downloaded 357 times
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pentominoes
Hi Richmond,
from the dictionary
Kind regards
Bernd
from the dictionary
AndThe current setting of the resizeQuality property is used to determine whether to apply filtering to the rotation operation. If set to normal no filtering is used; if set to good or best a bilinear filter is used which significantly reduces the distortion that will naturally occur when an image is rotated.
The rotation operation does not have an inverse. Since some amount of distortion is unavoidable when rotating an image by an amount that is not a multiple of 90 degrees, rotating an image clockwise, then counterclockwise by the same amount does not completely restore the original image.
I would use angle, see stack aboveTo rotate an image in a reversible way, or to do repeated rotations without progressive distortion of the image, set its angle property instead of using the rotate command. Unlike the rotate command, the angle property affects only the screen display of the image, not the actual picture data in it, so setting it repeatedly does not introduce distortion.
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Thanks, Bernd,
I'm not really having a vast problem with rotation because, as I wrote earlier, I make sure
that all non-square images are "embedded" in a square, transparent space.
However, I do think that, in the great scheme of things, it would ne super if one
could roatet non-square images, as they are - Ding-an-Sich, without distortion.
I'm not really having a vast problem with rotation because, as I wrote earlier, I make sure
that all non-square images are "embedded" in a square, transparent space.
However, I do think that, in the great scheme of things, it would ne super if one
could roatet non-square images, as they are - Ding-an-Sich, without distortion.
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
What I am much more troubled about is the fact that "threshhold" with
INTERSECT does not appear to work properly.
INTERSECT does not appear to work properly.
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pentominoes
Hi Richmond,
did you try the stack I posted?
Kind regards
Bernd
did you try the stack I posted?
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Yes, I did, and I cannot see how that helps with THRESHOLD in any way whatsoever as that stack only uses one image.
However, I seem to have solved the THRESHOLD problem:
Obviously my image I am using for my Pentominoes game has got something wrong with it.
However, I seem to have solved the THRESHOLD problem:
Obviously my image I am using for my Pentominoes game has got something wrong with it.
-
- VIP Livecode Opensource Backer
- Posts: 4002
- Joined: Sun Jan 07, 2007 9:12 pm
- Location: Bochum, Germany
Re: Pentominoes
Hi Richmond,
Kind regards
Bernd
It was more related to your rotate problem.Yes, I did, and I cannot see how that helps with THRESHOLD in any way whatsoever as that stack only uses one image.
Kind regards
Bernd
-
- Livecode Opensource Backer
- Posts: 9387
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Pentominoes
Aha. Thanks, Bernd, I did not jalouse it was for the rotation "problem".