Commit 04278f79 authored by Ashley Chen's avatar Ashley Chen
Browse files

added wing skew getters to Flight, clean up commented out code

parent 5b6a9d23
......@@ -17,6 +17,8 @@ abstract interface Flight extends GeometryConstants {
List<? extends Wing> getAllLeftWings();
List<? extends Wing> getAllRightWings();
int[] getAllWingsSkew();
int[] getAllLeftWingsSkew();
int[] getAllRightWingsSkew();
/* ------------- all flyers, lights ------------- */
List<? extends LightSamplePoint> getAllLights();
......@@ -38,9 +40,12 @@ abstract interface Flight extends GeometryConstants {
* pattern getters for individual flyers
*/
/* ------------- one flyer, motion ------------- */
List<? extends Wing> getFlyerWings(int flyerIndex);
Wing getFlyerLeftWing(int flyerIndex);
Wing getFlyerRightWing(int flyerIndex);
List<? extends Wing> getFlyerWings(int flyerIndex);
int[] getFlyerWingsSkew(int flyerIndex);
int getFlyerLeftWingSkew(int flyerIndex);
int getFlyerRightWingSkew(int flyerIndex);
/* ------------- one flyer, lights ------------- */
List<? extends LightSamplePoint> getFlyerLights(int flyerIndex);
......
......@@ -78,12 +78,9 @@ public class Generator extends LXOutput implements GeometryConstants {
* s = String.format(s, "world");
* assertEquals(s, "hello world!");
*/
// Wing[] wings = flyer.getWings();
Wing lWing = flight.getFlyerLeftWing(flyerIndex);
Wing rWing = flight.getFlyerRightWing(flyerIndex);
int leftWingPos = lWing.getSkew();
int rightWingPos = rWing.getSkew();
int leftWingPos = flight.getFlyerLeftWingSkew(flyerIndex);
int rightWingPos = flight.getFlyerRightWingSkew(flyerIndex);
LightSamplePointModel bodyLightPoint = flight.getFlyerBodyLight(flyerIndex);
......
......@@ -72,7 +72,6 @@ interface GeometryConstants {
/**
* Body LED dimensions
*/
// TODO (achen) am i interpreting this right?
public final static float LENGTH_BODY_CROSS = 22 * INCHES;
public final static float WIDTH_BODY_CROSS = (float) (3.8125 * INCHES);
public final static float DEPTH_BODY_CROSS = (float) (.394 * INCHES);
......@@ -85,20 +84,6 @@ interface GeometryConstants {
final static float SIDE_EDGE_DISTANCE = (float) (18.04 * INCHES);
final static float INNER_EDGE_DISTANCE = (float) (20.69 * INCHES);
final static float WING_THICKNESS_MM = 8;
// List<LXPoint> wingPoints = new ArrayList<LXPoint>(Arrays.asList(
// new LXPoint(3.480, 0.152, 0),
// new LXPoint(0.005, 6.297, 0),
// new LXPoint(0.148, 6.542, 0),
// new LXPoint(20.841, 6.539, 0),
// new LXPoint(20.919, 6.179, 0),
// new LXPoint(3.974, 0.005, 0)
//// 3.480 0.152
//// 0.005 6.297
//// 0.148 6.542
//// 20.841 6.539
//// 20.919 6.179
//// 3.974 0.005
// ));
// REVIEW(mcslee): changed to LXVector... if you're just storing geometry
// here that is fine to use, but keep in mind these are a static global
......@@ -130,7 +115,6 @@ interface GeometryConstants {
// REVIEW(mcslee): note that these need to be constructed for each wing instance,
// if a static array is used then you'll end up pointing at the same underlying
// point instances
// LXModel wingLights = new LXModel(wingLightPoints);
public default List<LXVector> buildLights() {
return new ArrayList<LXVector>(lightGeometryPoints);
}
......
......@@ -37,20 +37,4 @@ abstract interface LightSamplePoint extends GeometryConstants {
// }
// return getBodyIndex() * NUM_LIGHT_POINTS_PER_FLYER + getLocation().position;
// }
// default LXVector getXYZ() {
// Integer wingIndex = getWingIndex();
// if (wingIndex != null) {
// return lightGeometryPoints.get((wingIndex % NUM_WINGS_PER_FLYER) * NUM_LIGHT_POINTS_PER_WING + getLocation().position);
// }
// return lightGeometryPoints.get(getLocation().position);
// }
// Uses the color representation of LXStudio
// void setColor(int color);
// int getColor();
// // What range is this value? -pal
// // TODO (achen) define brightness range. Very likely 0 - 100
// void setBrightness(int brightness);
}
......@@ -119,6 +119,24 @@ class FlightModel extends LXModel implements Flight {
.toArray();
}
@Override
public int[] getAllLeftWingsSkew() {
return IntStream
.range(0, wings.length)
.filter(i -> i % NUM_WINGS_PER_FLYER == 0)
.map(i -> wings[i].getSkew())
.toArray();
}
@Override
public int[] getAllRightWingsSkew() {
return IntStream
.range(0, wings.length)
.filter(i -> i % NUM_WINGS_PER_FLYER == 1)
.map(i -> wings[i].getSkew())
.toArray();
}
/* ------------- all flyers, lights ------------- */
@Override
......@@ -197,6 +215,14 @@ class FlightModel extends LXModel implements Flight {
}
/* ------------- one flyer, motion ------------- */
@Override
public List<WingModel> getFlyerWings(int flyerIndex) {
return IntStream
.range(flyerIndex * NUM_WINGS_PER_FLYER, flyerIndex * NUM_WINGS_PER_FLYER + NUM_WINGS_PER_FLYER)
.mapToObj(i -> wings[i])
.collect(Collectors.toList());
}
@Override
public WingModel getFlyerLeftWing(int flyerIndex) {
return wings[flyerIndex * NUM_WINGS_PER_FLYER];
......@@ -208,11 +234,21 @@ class FlightModel extends LXModel implements Flight {
}
@Override
public List<WingModel> getFlyerWings(int flyerIndex) {
public int[] getFlyerWingsSkew(int flyerIndex) {
return IntStream
.range(flyerIndex * NUM_WINGS_PER_FLYER, flyerIndex * NUM_WINGS_PER_FLYER + NUM_WINGS_PER_FLYER)
.mapToObj(i -> wings[i])
.collect(Collectors.toList());
.map(i -> wings[i].getSkew())
.toArray();
}
@Override
public int getFlyerLeftWingSkew(int flyerIndex) {
return wings[flyerIndex * NUM_WINGS_PER_FLYER].getSkew();
}
@Override
public int getFlyerRightWingSkew(int flyerIndex) {
return wings[flyerIndex * NUM_WINGS_PER_FLYER + 1].getSkew();
}
/* ------------- one flyer, lights ------------- */
......
......@@ -10,14 +10,6 @@ abstract interface Wing extends GeometryConstants {
boolean getIsRight();
// List<? extends LXPoint> getLightPoints();
static int getIndex(int flyerIndex, boolean isRight) {
return flyerIndex * NUM_WINGS_PER_FLYER + isRightAsInt(isRight);
}
static int isRightAsInt(boolean isRight) {
return isRight ? 1 : 0;
}
default int getIndex() {
return flyerIndex * NUM_WINGS_PER_FLYER + isRightAsInt();
}
......@@ -29,8 +21,4 @@ abstract interface Wing extends GeometryConstants {
int getSkew();
void setSkew(int skew);
// List<? extends LXPoint> lightPointList = new ArrayList<>();
}
\ No newline at end of file
Supports Markdown
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