 |
AppletTalk.com Java discussions newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
cheryl j via JavaKB.com Guest
|
Posted: Wed Aug 24, 2005 11:36 pm Post subject: PLEASE HELP ME ... need to tile polygon |
|
|
Hi, im desperately trying to tile polygon shape across the whole of the
canvas but all i seem to end up with is just one line, i need to loop it so
it draw polygon across whole canvas!!!!!
if(tiled)
{
for( int y=1; y
{
for(int x=0; x<10;x++)
g.setColor(new Color(250,0,0));
g.fillPolygon(xPoints, yPoints, xPoints.length);
for(int i=0; i
xPoints[i] +=200;
}
}
|
|
| Back to top |
|
 |
Andrew Thompson Guest
|
Posted: Thu Aug 25, 2005 6:28 am Post subject: Re: PLEASE HELP ME ... need to tile polygon |
|
|
On Wed, 24 Aug 2005 23:36:30 GMT, cheryl j via JavaKB.com wrote:
| Quote: | PLEASE HELP ME ... need to tile polygon
|
Please don't SHOUT. It will not get answers sooner, and is
more likely to get your post ignored than answered.
Also, I would recommend against putting 'please help me'
in a post at all. If people will help, they will help,
it makes little or no difference if you say 'please'.
| Quote: | Hi, im desperately trying to tile polygon shape across the whole of the
canvas but all i seem to end up with is just one line, i need to loop it so
it draw polygon across whole canvas!!!!!
|
I cannot see what is wrong from your snippet, (though
if xPoints.length = 1, that might explain it) I suggest
you poast an SSCCE.
<http://www.physci.org/codes/sscce.jsp>
Since you are apparently new to this, I will also add..
<http://www.physci.org/codes/javafaq.jsp#usenet>
--
Andrew Thompson
physci.org 1point1c.org javasaver.com lensescapes.com athompson.info
"Give me a whiskey, don't think twice.."
The Angels 'Marseille'
|
|
| Back to top |
|
 |
Matt Humphrey Guest
|
Posted: Thu Aug 25, 2005 3:16 pm Post subject: Re: PLEASE HELP ME ... need to tile polygon |
|
|
"cheryl j via JavaKB.com" <forum (AT) JavaKB (DOT) com> wrote
| Quote: | Hi, im desperately trying to tile polygon shape across the whole of the
canvas but all i seem to end up with is just one line, i need to loop it
so
it draw polygon across whole canvas!!!!!
if(tiled)
{
for( int y=1; y
{
for(int x=0; x<10;x++)
g.setColor(new Color(250,0,0));
g.fillPolygon(xPoints, yPoints, xPoints.length);
for(int i=0; i
xPoints[i] +=200;
}
}
|
You need to think about what needs to happen to the polygon points in order
to make them appear tiled in a grid. You are incrementing the X, but not
the Y, so the polygon stays on one line. When the X-loop ends, you need to
increment the Y values, but also to reset the X values back (relatively) to
zero or you'll end up with a diagonal.
It's also not clear to me why your outer loop (y-loop) is over the number of
points in the polygon or why it starts at 1. I would have expected
something like for (int y = 0; y < numRows; ++y) where numRows is the
number of rows to be tiled, just as you use 10 for the number of columns (0
through 9) to be tiled.
Cheers,
Matt Humphrey [email]matth (AT) ivizNOSPAM (DOT) com[/email] http://www.iviz.com/
|
|
| Back to top |
|
 |
Tor Iver Wilhelmsen Guest
|
Posted: Mon Aug 29, 2005 2:42 pm Post subject: Re: PLEASE HELP ME ... need to tile polygon |
|
|
"cheryl j via JavaKB.com" <forum (AT) JavaKB (DOT) com> writes:
| Quote: | Hi, im desperately trying to tile polygon shape across the whole of the
canvas but all i seem to end up with is just one line, i need to loop it so
it draw polygon across whole canvas!!!!!
|
If you can use Java2D, look into transforming the coordinate system
instead of adjusting the polygon values: They should be constant
relative to some point shich you move around.
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|