float halfWidth = piece.getWidth() / 2;
final float thicknessEpsilon = 0.0002f;
if (piece.isDoorOrWindow()) {
float wallDistance = thicknessEpsilon / 2;
if (piece instanceof HomeDoorOrWindow) {
HomeDoorOrWindow doorOrWindow = (HomeDoorOrWindow) piece;
if (piece.isResizable()
&& isItemResizable(piece)) {
piece.setDepth(thicknessEpsilon
+ wallAtPoint.getThickness() / doorOrWindow.getWallThickness());
}
wallDistance += piece.getDepth() * doorOrWindow.getWallDistance();
}
float halfDepth = piece.getDepth() / 2;
if (distanceToRightSide < distanceToLeftSide) {
angle = wallAngle;
xPiece = x + sinAngle * (distanceToLeftSide + wallDistance);