private void addWall() { Vector3d normal = new Vector3d(0.0, 0.0, 1.0); double centroidHeight = 2.0; ArrayList<Point2d> pointList = new ArrayList<Point2d>(); Point2d wallPoint0 = new Point2d(WALL_START_X, WALL_Y); Point2d wallPoint1 = new Point2d(WALL_START_X + WALL_LENGTH, WALL_Y); Point2d wallPoint2 = new Point2d(WALL_START_X + WALL_LENGTH, WALL_Y + Math.signum(WALL_Y) * WALL_THICKNESS); Point2d wallPoint3 = new Point2d(WALL_START_X, WALL_Y + Math.signum(WALL_Y) * WALL_THICKNESS); pointList.add(wallPoint0); pointList.add(wallPoint1); pointList.add(wallPoint2); pointList.add(wallPoint3); ConvexPolygon2d convexPolygon = new ConvexPolygon2d(pointList); RotatableConvexPolygonTerrainObject rightWall = new RotatableConvexPolygonTerrainObject( normal, convexPolygon, centroidHeight, YoAppearance.Brown()); combinedTerrainObject.addTerrainObject(rightWall); }
private void addPillars() { Vector3d normal = new Vector3d(0.0, 0.0, 1.0); double centroidHeight = 2.0; Point2d bottomLeft = new Point2d(-PILLAR_WIDTH / 2.0, PILLAR_WIDTH / 2.0); Point2d bottomRight = new Point2d(-PILLAR_WIDTH / 2.0, -PILLAR_WIDTH / 2.0); Point2d topLeft = new Point2d(PILLAR_WIDTH / 2.0, PILLAR_WIDTH / 2.0); Point2d topRight = new Point2d(PILLAR_WIDTH / 2.0, -PILLAR_WIDTH / 2.0); double pillarDistance = WALL_LENGTH / (NUM_PILLARS - 1.0); Vector2d offset = new Vector2d(0.0, -WALL_Y + PILLAR_WIDTH / 2.0); for (int i = 0; i < NUM_PILLARS; i++) { ArrayList<Point2d> points = new ArrayList<Point2d>(); offset.setX(WALL_START_X + pillarDistance * i); Point2d localBottomLeft = new Point2d(); localBottomLeft.add(bottomLeft, offset); Point2d localBottomRight = new Point2d(); localBottomRight.add(bottomRight, offset); Point2d localTopLeft = new Point2d(); localTopLeft.add(topLeft, offset); Point2d localTopRight = new Point2d(); localTopRight.add(topRight, offset); points.add(localBottomLeft); points.add(localBottomRight); points.add(localTopLeft); points.add(localTopRight); ConvexPolygon2d convexPolygon = new ConvexPolygon2d(points); AppearanceDefinition appearance = YoAppearance.Brown(); // YoAppearance.makeTransparent(appearance, 0.7f); RotatableConvexPolygonTerrainObject pillar = new RotatableConvexPolygonTerrainObject( normal, convexPolygon, centroidHeight, appearance); combinedTerrainObject.addTerrainObject(pillar); } }