----- Original Message -----
Sent: Tuesday, May 22, 2001 4:18 PM
Subject: Re: [JAVA2D] GeneralPath/Area
problem
Is
p1 created just before this code? If it's a GeneralPath that you're reusing
you'll need to have called reset() on it.
Also, if you could extract a full code segment that reproduces this
then I can definitely help you. I just need to be able to see all the
details.
Jeff
Kardatzke
Hi all
I have a problem with using the Area object. I
first fill a generalpath and then making a new Area object.
But when i try to get the cooridinat back from
the area object i got the coordinates in a different order and with some
more. Who can seay what im doing wrong?
with regards AANT
i use the code:
//Here i make the Area object
p1.moveTo(
(float)coor[minYindex].getX(),
(float)coor[minYindex].getY());
for(int i = 0; i <
pp.length; i++)
p1.lineTo( (float)pp[i].getX(),
(float)pp[i].getY());
p1.closePath();
Area area = new Area( p1
);
Vector hoekpunten = new Vector();
//in the following code i try to get the
coordinates back out of the area object
PathIterator iterator =
area.getPathIterator(null);
double[] coords = new
double[6];
while( !iterator.isDone()
)
{
switch(
iterator.currentSegment(coords)
)
{
case
PathIterator.SEG_MOVETO:
case
PathIterator.SEG_LINETO:
// case
PathIterator.SEG_CLOSE:
hoekpunten.add( new
xyzPoint(coords[0],coords[1]) );
System.out.println("in decode X,Y =
coor: "+coords[0]+" , "+coords[1]
);
break;
}
iterator.next();
}
//The println is only because of the debugging
and that why i know that the coordinates are not the the proper order and
not the same number