protected void computePolygon() {
trS=Math.min(width,height)/2-2;
vertexAngle=glyph.getOrient();
vertices=glyph.getVertices();
xcoords=new int[vertices.length];
ycoords=new int[vertices.length];
for (int j=0;j< vertices.length-1;j++){
xcoords[j]=(int)Math.round(cWidth+trS*Math.cos(vertexAngle)*vertices[j]);
ycoords[j]=(int)Math.round(cHeight-trS*Math.sin(vertexAngle)*vertices[j]);
vertexAngle+=2*Math.PI/vertices.length;
}//last iteration outside to loop to avoid one vertexAngle computation too many
xcoords[vertices.length-1]=(int)Math.round(cWidth+trS*Math.cos(vertexAngle)*vertices[vertices.length-1]);
ycoords[vertices.length-1]=(int)Math.round(cHeight-trS*Math.sin(vertexAngle)*vertices[vertices.length-1]);
p=new Polygon(xcoords,ycoords,vertices.length);
}
|