Commit bb898b00 authored by Philip Levis's avatar Philip Levis
Browse files

Update how the position of flyers on the front window and the stairwell

are calculated, by Charlie's request.
  - Front window flyers and now spaced 2 feet back from the window.
  - Exterior stair edge flyers are now spaced 2 feet away from the stair.
  - Exterior stair edge flyers can now be placed along edge of platform.
  - Inner stair edge flyers can be placed along edge of platform.

There is a bug in how the position of inner edge stair flyers are
placed: the stair calculations are a bit off, such that the angles
don't add up right. This means that on the upper stair, the flyers
seem to hang from under, rather than the edge of, the stair. I'll
look into it and fix it soon.
parent 5a746970
......@@ -419,6 +419,8 @@ class UIFlightDrawer extends UI3dComponent implements Geometry {
drawPlatform(pg, 0f);
drawPlatform(pg, 180f);
drawPlatform(pg, 360f);
drawStairFlight(pg, -180f, true);
drawStairFlight(pg, 0f, false);
drawStairFlight(pg, 0, true);
drawStairFlight(pg, 180f, false);
drawStairFlight(pg, 180f, true);
......@@ -431,10 +433,20 @@ class UIFlightDrawer extends UI3dComponent implements Geometry {
* window.
*/
private void drawWalls(PGraphics pg) {
pg.fill(#c0c0c0);
pg.stroke(#202020);
pg.beginShape();
pg.vertex(0.0, 0,0, 0.0);
pg.vertex(FRONT_WINDOW_WIDTH, 0, 0);
pg.vertex(FRONT_WINDOW_WIDTH, -180f, 0);
pg.vertex(0, -180f, 0);
pg.endShape(CLOSE);
// Vertical bars: need a polygon not a rectangle
// because their top has an angle with the roof.
pg.fill(#c0c0c0);
pg.stroke(#202020);
for (int i = 0; i < VBAR_OFFSETS.length; i++) {
float offset = VBAR_OFFSETS[i];
float center = FRONT_WINDOW_VBAR_HEIGHTS[i];
......@@ -470,21 +482,21 @@ class UIFlightDrawer extends UI3dComponent implements Geometry {
// Bottom floor: 45 degree angle means back corner is at sqrt(2)
pg.beginShape();
pg.fill(#808080);
pg.vertex(0, -2, 0);
pg.vertex(FRONT_WINDOW_WIDTH, -2, 0);
pg.vertex(FRONT_WINDOW_WIDTH * 0.707, -2, FRONT_WINDOW_WIDTH * 0.707);
pg.vertex(0, -180f, 0);
pg.vertex(FRONT_WINDOW_WIDTH, -180f, 0);
pg.vertex(FRONT_WINDOW_WIDTH * 0.707, -180f, FRONT_WINDOW_WIDTH * 0.707);
pg.endShape(CLOSE);
// Back wall: 45 degree angle means far corner is at sqrt(2)
pg.fill(#f0f0f0);
pg.beginShape();
pg.vertex(0, 0, 0);
pg.vertex(0, -180f, 0);
pg.vertex(0, FRONT_WINDOW_CORNER_HEIGHT, 0);
pg.vertex(FRONT_WINDOW_WIDTH * 0.707,
FRONT_WINDOW_CORNER_HEIGHT,
FRONT_WINDOW_CORNER_HEIGHT * 0.707);
pg.vertex(FRONT_WINDOW_WIDTH * 0.707,
0,
-180f,
FRONT_WINDOW_CORNER_HEIGHT * 0.707);
pg.endShape(CLOSE);
}
......
......@@ -106,7 +106,7 @@ public class FlyerModel extends LXModel implements Flyer {
BACK_WALL_OFFSETS[i] = yPos;
}
OUTER_STAIR_EDGE = new StairEdgePoint[10];
OUTER_STAIR_EDGE = new StairEdgePoint[16];
PMatrix3D matrix = new PMatrix3D();
// Move so center of bottom platform is at 0,0
matrix.translate(FRONT_WINDOW_WIDTH * (1f + 0.707f) / 2f,
......@@ -118,33 +118,44 @@ public class FlyerModel extends LXModel implements Flyer {
// as a series of X,Y,Z points, with a normalized (0-1) value of
// how far along the stairway it is. For a point P along the edge,
// you find which two points it is between then interpolate between
// them. Stairways are 2 units long and the edges of the corner are
// 1 unit long, for total of 12 (2 + 1 + 1 + 2 + 2 + 1 + 1 + 2)
// units.
// them. Stairways are 4 units long, the edges of the corner are
// 2 unit long, and the platform is 1 unit long, for total of
// 12 (1 + 4 + 2 + 2 + 4 + 1) + (1 + 4 + 2 + 2 + 4 + 1) = 28 units.
// Move to left corner of platform
matrix.translate(-168.0f + 126.0f * (float)Math.sin((float)Math.PI/8f),
0,
32.0f + 126f * (float)Math.cos((float)Math.PI/8f));
// Move to back left corner of platform, then rotate to direction
// of stair and move away from the stair by 2 feet: flyers don't
// hang directly below the stair edge
matrix.translate(-168.0f, 0, 32.0f);
matrix.rotateY((float)Math.PI/8f);
matrix.translate(-2.0f * Geometry.FEET, 0, 0);
OUTER_STAIR_EDGE[0] = new StairEdgePoint(0f, matrix);
// Front left corner of platform
matrix.translate(0, 0, 126f);
OUTER_STAIR_EDGE[1] = new StairEdgePoint(1f/28f, matrix);
// Up flight of stairs
matrix.rotateY((float)Math.PI/8f);
matrix.translate(0, 90f, 186f);
OUTER_STAIR_EDGE[1] = new StairEdgePoint(2f/12f, matrix);
OUTER_STAIR_EDGE[2] = new StairEdgePoint(5f/28f, matrix);
// Move to corner of point platform
matrix.translate(0, 0, 128f);
OUTER_STAIR_EDGE[2] = new StairEdgePoint(3f/12f, matrix);
OUTER_STAIR_EDGE[3] = new StairEdgePoint(7f/28f - 0.000001f, matrix);
// Turn corner of point platform, move to last point
// Turn corner of point platform, move to last point by moving to actual
// corner, turning, then moving out by 2f again
matrix.translate(2.0f * Geometry.FEET, 0, 0);
matrix.rotateY(3f *(float) Math.PI / 4f);
matrix.translate(-2.0f * Geometry.FEET, 0, 0);
OUTER_STAIR_EDGE[4] = new StairEdgePoint(7f/28f, matrix);
matrix.translate(0, 0, 128f);
OUTER_STAIR_EDGE[3] = new StairEdgePoint(4f/12f, matrix);
// Up flight of stairs
OUTER_STAIR_EDGE[5] = new StairEdgePoint(9f/28f, matrix);
matrix.translate(0, 90f, 186f);
OUTER_STAIR_EDGE[4] = new StairEdgePoint(6f/12f - 0.00001f, matrix);
OUTER_STAIR_EDGE[6] = new StairEdgePoint(13f/28f, matrix);
// To back right corner of platform
matrix.translate(0, 0, 126f);
OUTER_STAIR_EDGE[7] = new StairEdgePoint(14f/28f -0.00001f , matrix);
matrix = new PMatrix3D();
// Move so center of middle platform is at 0,0
......@@ -153,30 +164,39 @@ public class FlyerModel extends LXModel implements Flyer {
FRONT_WINDOW_WIDTH * (0.707f) / 2f);
matrix.rotateY(- 5.0f/8.0f *(float) Math.PI);
// Move to left corner of platform
matrix.translate(-168.0f + 126.0f *(float)Math.sin((float)Math.PI/8f),
0,
32.0f + 126f * (float)Math.cos((float)Math.PI/8f));
OUTER_STAIR_EDGE[5] = new StairEdgePoint(6f/12f, matrix);
// Up flight of stairs
// Move to back left corner of platform
matrix.translate(-168.0f, 0, 32.0f);
matrix.rotateY((float)Math.PI/8f);
matrix.translate(-2.0f * Geometry.FEET, 0, 0);
OUTER_STAIR_EDGE[8] = new StairEdgePoint(14f/28f, matrix);
// Front left corner of platform
matrix.translate(0, 0, 126f);
OUTER_STAIR_EDGE[9] = new StairEdgePoint(15f/28f, matrix);
// Up flight of stairs
matrix.translate(0, 90f, 186f);
OUTER_STAIR_EDGE[6] = new StairEdgePoint(8f/12f, matrix);
OUTER_STAIR_EDGE[10] = new StairEdgePoint(19f/28f, matrix);
// Move to corner of point platform
matrix.translate(0, 0, 128f);
OUTER_STAIR_EDGE[7] = new StairEdgePoint(9f/12f, matrix);
OUTER_STAIR_EDGE[11] = new StairEdgePoint(21f/28f - 0.000001f, matrix);
// Turn corner of point platform, move to last point
// Turn corner of point platform, move to last point by
// moving to actual corner, rotating, the moving back out
// 2 feet.
matrix.translate(2.0f * Geometry.FEET, 0, 0);
matrix.rotateY(3f * (float)Math.PI / 4f);
matrix.translate(-2.0f * Geometry.FEET, 0, 0);
OUTER_STAIR_EDGE[12] = new StairEdgePoint(21f/28f, matrix);
matrix.translate(0, 0, 128f);
OUTER_STAIR_EDGE[8] = new StairEdgePoint(10f/12f, matrix);
OUTER_STAIR_EDGE[13] = new StairEdgePoint(23f/28f, matrix);
// Up flight of stairs
matrix.translate(0, 90f, 186f);
OUTER_STAIR_EDGE[9] = new StairEdgePoint(12f/12f, matrix);
OUTER_STAIR_EDGE[14] = new StairEdgePoint(27f/28f, matrix);
matrix.translate(0, 0, 126f);
OUTER_STAIR_EDGE[15] = new StairEdgePoint(28f/28f, matrix);
INNER_STAIR_EDGE = new StairEdgePoint[10];
matrix = new PMatrix3D();
......@@ -190,9 +210,8 @@ public class FlyerModel extends LXModel implements Flyer {
// as a series of X,Y,Z points, with a normalized (0-1) value of
// how far along the stairway it is. For a point P along the edge,
// you find which two points it is between then interpolate between
// them. Stairways are 2 units long and the edges of the corner are
// 1 unit long, for total of 12 (2 + 1 + 1 + 2 + 2 + 1 + 1 + 2)
// units.
// them. Stairways are 2 units long and the platform is 1 unit long,
// for total of 10 (2 + 2 + 1 + 2 + 2 + 1) units.
matrix.translate((float)(- 168.0
+ 126.0 * Math.sin(Math.PI/8.0)
+ 69.0 * Math.sin(5.0 / 8.0 * Math.PI)
......@@ -203,71 +222,70 @@ public class FlyerModel extends LXModel implements Flyer {
+ 69.0 * Math.cos(5.0 / 8.0 * Math.PI)
- 21.0 * Math.cos(Math.PI/8.0)));
matrix.rotateY(1.0f/8.0f * (float)Math.PI);
INNER_STAIR_EDGE[0] = new StairEdgePoint(0f, matrix);
matrix.translate((float)(21.0 * Math.sin(Math.PI/8.0)),
matrix.translate(0,
0,
(float)(21.0 * Math.cos(Math.PI/8.0)));
INNER_STAIR_EDGE[1] = new StairEdgePoint(0.05f, matrix);
21f);
INNER_STAIR_EDGE[0] = new StairEdgePoint(0, matrix);
matrix.translate(0,
90.0f,
186.0f);
INNER_STAIR_EDGE[2] = new StairEdgePoint(0.25f, matrix);
INNER_STAIR_EDGE[1] = new StairEdgePoint(2f/10f, matrix);
matrix.rotateY((float)(3.0 * Math.PI / 4.0));
matrix.translate(0,
90.0f,
186.0f);
INNER_STAIR_EDGE[3] = new StairEdgePoint(0.45f, matrix);
INNER_STAIR_EDGE[2] = new StairEdgePoint(4f/10f - .0001f, matrix);
matrix.translate((float)(21.0 * Math.sin(Math.PI/8.0)),
0,
(float)(21.0 * Math.cos(Math.PI/8.0)));
INNER_STAIR_EDGE[4] = new StairEdgePoint(0.499999f, matrix);
matrix.translate(0, 0, 21f);
// Edge of platform
INNER_STAIR_EDGE[3] = new StairEdgePoint(4f/10f, matrix);
matrix.rotateY(5f/8f * (float)Math.PI);
matrix.translate(0, 0, 180f);
INNER_STAIR_EDGE[4] = new StairEdgePoint(5f/10f - .0001f, matrix);
matrix = new PMatrix3D();
// Move so center of bottom platform is at 0,0
// Move so center of middle platform is at 0,0
matrix.translate(FRONT_WINDOW_WIDTH * (1f + 0.707f) / 2f,
180f,
FRONT_WINDOW_WIDTH * (0.707f) / 2f);
matrix.rotateY(- 5.0f/8.0f * (float)Math.PI);
// The segments of the inner edge of the stairs are respresented
// Move so center is at inner edge of bottom of stair
matrix.translate((float)(- 168.0
+ 126.0 * Math.sin(Math.PI/8.0)
+ 69.0 * Math.sin(5.0 / 8.0 * Math.PI)
- 21.0 * Math.sin(Math.PI/8.0)),
0f,
0,
(float)(32.0
+ 126.0 * Math.cos(Math.PI/8.0)
+ 69.0 * Math.cos(5.0 / 8.0 * Math.PI)
- 21.0 * Math.cos(Math.PI/8.0)));
matrix.rotateY(1.0f/8.0f * (float)Math.PI);
INNER_STAIR_EDGE[5] = new StairEdgePoint(0.5f, matrix);
matrix.translate((float)(21.0 * Math.sin(Math.PI/8.0)),
matrix.translate(0,
0,
(float)(21.0 * Math.cos(Math.PI/8.0)));
INNER_STAIR_EDGE[6] = new StairEdgePoint(0.55f, matrix);
21f);
INNER_STAIR_EDGE[5] = new StairEdgePoint(5f/10f, matrix);
matrix.translate(0,
90.0f,
186.0f);
INNER_STAIR_EDGE[7] = new StairEdgePoint(0.75f, matrix);
INNER_STAIR_EDGE[6] = new StairEdgePoint(7f/10f, matrix);
matrix.rotateY((float)(3.0 * Math.PI / 4.0));
matrix.translate(0,
90.0f,
186.0f);
INNER_STAIR_EDGE[8] = new StairEdgePoint(0.95f, matrix);
INNER_STAIR_EDGE[7] = new StairEdgePoint(9f/10f - .0001f, matrix);
matrix.translate((float)(21.0 * Math.sin(Math.PI/8.0)),
0,
(float)(21.0 * Math.cos(Math.PI/8.0)));
INNER_STAIR_EDGE[9] = new StairEdgePoint(1.0f, matrix);
matrix.translate(0, 0, 21f);
// Edge of platform
INNER_STAIR_EDGE[8] = new StairEdgePoint(9f/10f, matrix);
matrix.rotateY(5f/8f * (float)Math.PI);
matrix.translate(0, 0, 180f);
INNER_STAIR_EDGE[9] = new StairEdgePoint(10f/10f, matrix);
}
......@@ -438,10 +456,10 @@ public class FlyerModel extends LXModel implements Flyer {
// the FlyerConfig changes. -pal
FlyerConfig.FaceConfig fConfig = this.config.faceConfig;
if (fConfig.face.equals("F")) {
return 10.0f;
return 2.0f * Geometry.FEET;
} else if (fConfig.face.equals("C")) {
int pipe = (int)fConfig.pipe;
float startz = 12f;
float startz = 2.0f * Geometry.FEET;
float endz = 0.0f;
switch (pipe) {
case 0:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment