public CRVector3d[] getCorners() {
if (shape == SHAPE.RECTANGLE) {
CRVector3d[] corners = new CRVector3d[4];
//-- top right
corners[0] = new CRVector3d(position.x + size.x/2, position.y - size.y/2, 0);
rotateVectorInLocalCoordinates(corners[0]);
//-- bottom right
corners[1] = new CRVector3d(position.x + size.x/2, position.y + size.y/2, 0);
rotateVectorInLocalCoordinates(corners[1]);
//-- bottom left
corners[2] = new CRVector3d(position.x - size.x/2, position.y + size.y/2, 0);
rotateVectorInLocalCoordinates(corners[2]);
//-- top left
corners[3] = new CRVector3d(position.x - size.x/2, position.y - size.y/2, 0);
rotateVectorInLocalCoordinates(corners[3]);
return corners;
} else if (shape == SHAPE.CIRCLE) {
//-- approximate as octagon
CRVector3d[] corners = new CRVector3d[4];
//-- top right
corners[0] = new CRVector3d(position.x + size.x/2, position.y - size.y/2, 0);
rotateVectorInLocalCoordinates(corners[0]);
//-- bottom right
corners[1] = new CRVector3d(position.x + size.x/2, position.y + size.y/2, 0);
rotateVectorInLocalCoordinates(corners[1]);
//-- bottom left
corners[2] = new CRVector3d(position.x - size.x/2, position.y + size.y/2, 0);
rotateVectorInLocalCoordinates(corners[2]);
//-- top left
corners[3] = new CRVector3d(position.x - size.x/2, position.y - size.y/2, 0);
rotateVectorInLocalCoordinates(corners[3]);
return corners;
} else {