private Geometry [] createWallGeometries(int wallSide, HomeTexture texture) {
float [][] wallSidePoints = getWallSidePoints(wallSide);
float [] textureReferencePoint = wallSide == LEFT_WALL_SIDE
? wallSidePoints [0]
: wallSidePoints [wallSidePoints.length - 1];
Shape wallShape = getShape(wallSidePoints);
Area wallArea = new Area(wallShape);
float wallHeightAtStart = getWallHeightAtStart();
float wallHeightAtEnd = getWallHeightAtEnd();
float maxWallHeight = Math.max(wallHeightAtStart, wallHeightAtEnd);
// Compute wall angles and top line factors
Wall wall = (Wall)getUserData();
double wallYawAngle = Math.atan2(wall.getYEnd() - wall.getYStart(), wall.getXEnd() - wall.getXStart());
double cosWallYawAngle = Math.cos(wallYawAngle);
double sinWallYawAngle = Math.sin(wallYawAngle);
double wallXStartWithZeroYaw = cosWallYawAngle * wall.getXStart() + sinWallYawAngle * wall.getYStart();
double wallXEndWithZeroYaw = cosWallYawAngle * wall.getXEnd() + sinWallYawAngle * wall.getYEnd();
boolean roundWall = wall.getArcExtent() != null && wall.getArcExtent() != 0;
double topLineAlpha;
double topLineBeta;
if (wallHeightAtStart == wallHeightAtEnd) {
topLineAlpha = 0;
topLineBeta = wallHeightAtStart;
} else {
topLineAlpha = (wallHeightAtEnd - wallHeightAtStart) / (wallXEndWithZeroYaw - wallXStartWithZeroYaw);
topLineBeta = wallHeightAtStart - topLineAlpha * wallXStartWithZeroYaw;
}
// Search which doors or windows intersect with this wall side
List<DoorOrWindowArea> windowIntersections = new ArrayList<DoorOrWindowArea>();
for (HomePieceOfFurniture piece : getVisibleDoorsAndWindows(this.home.getFurniture())) {
if (piece.getElevation() < maxWallHeight) {
Shape pieceShape = getShape(piece.getPoints());
Area pieceArea = new Area(pieceShape);
Area intersectionArea = new Area(wallShape);
intersectionArea.intersect(pieceArea);
if (!intersectionArea.isEmpty()) {
windowIntersections.add(new DoorOrWindowArea(intersectionArea, Arrays.asList(new HomePieceOfFurniture [] {piece})));