mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-08 21:30:57 +00:00
further implementations on TrapezoidCourseDesignFactoryImpl.java
This commit is contained in:
1 parent
fcf71e5195
commit
fe13fd54e8
2 files changed
+32
-32
No files matched your search
+5
-25
@@ -13,7 +13,11 @@ public class PositionedMarkImpl extends MarkImpl implements PositionedMark {
|
||||
private Position position;
|
||||
|
||||
public PositionedMarkImpl(String name, Position position) {
|
||||
super(name);
|
||||
this(name, position, MarkType.BUOY);
|
||||
}
|
||||
|
||||
public PositionedMarkImpl(String name, Position position, MarkType markType) {
|
||||
super(name, name, markType, null, null, null);
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@@ -22,28 +26,4 @@ public class PositionedMarkImpl extends MarkImpl implements PositionedMark {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColor() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShape() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MarkType getType() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+27
-7
@@ -13,13 +13,12 @@ import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.NauticalMileDistance;
|
||||
|
||||
public class TrapezoidCourseDesignFactoryImpl extends AbstractCourseDesignFactory {
|
||||
|
||||
//we use 0.67 here, because also ISAF doesn't calculate with 1/3
|
||||
|
||||
// we use 0.67 here, because also ISAF doesn't calculate with 1/3
|
||||
private final double REACH_LEG_FACTOR = 0.67;
|
||||
private final Distance FINISH_LEG_LENGTH = new NauticalMileDistance(0.15);
|
||||
private final int LUV_BUOY1_ANGLE_TO_WIND = 0;
|
||||
private final int LUV_BUOY2_ANGLE_TO_WIND = 100;
|
||||
private final Distance LUV_BUOY1_TO_LUV_BUOY2_DISTANCE = new NauticalMileDistance(0.03);
|
||||
private final int LUV_BUOY_ANGLE_TO_WIND_OFFSET = 0;
|
||||
private final int BUOY2_ANGLE_TO_WIND = 180;
|
||||
private final int GATE_LENGTH_TO_HULL_LENGTH_FACTOR = 10;
|
||||
private final int GATE_XS_WIND_ANGLE = 270;
|
||||
private final int GATE_XP_WIND_ANGLE = 90;
|
||||
@@ -61,7 +60,9 @@ public class TrapezoidCourseDesignFactoryImpl extends AbstractCourseDesignFactor
|
||||
throw new IllegalArgumentException(
|
||||
"There was no speed diagram for the given boat class and the given wind.");
|
||||
}
|
||||
|
||||
|
||||
// alternate form of:
|
||||
// number_of_rounds*(leg_length*upwind_speed)+number_of_rounds*(leg_length*d)+(REACH_LEG_FACTOR*leg_length*reach_speed)+FINISH_LEG_LENGTH*reach_speed=target_time
|
||||
double legLength = (targetTime.getTimeInMinutes() - FINISH_LEG_LENGTH.getNauticalMiles()
|
||||
* speedTable.get(PointOfSail.Reach))
|
||||
/ (speedTable.get(PointOfSail.Downwind) * numberOfRounds.getNumberOfRounds()
|
||||
@@ -70,11 +71,30 @@ public class TrapezoidCourseDesignFactoryImpl extends AbstractCourseDesignFactor
|
||||
|
||||
Distance legDistance = new NauticalMileDistance(legLength);
|
||||
Position luvBuoyPosition = getPositionForGivenPointDistanceAndBearing(this.product.getReferencePoint(),
|
||||
legDistance, windDirection.add(new DegreeBearingImpl(LUV_BUOY1_ANGLE_TO_WIND)));
|
||||
legDistance, windDirection.add(new DegreeBearingImpl(LUV_BUOY_ANGLE_TO_WIND_OFFSET)));
|
||||
DecimalFormat legLengthFormat = new DecimalFormat("0.00");
|
||||
result.add(new PositionedMarkImpl("1 " + legLengthFormat.format(legDistance.getNauticalMiles()),
|
||||
luvBuoyPosition));
|
||||
|
||||
// reach leg
|
||||
Position topReachBuoy = getPositionForGivenPointDistanceAndBearing(
|
||||
luvBuoyPosition,
|
||||
legDistance.scale(REACH_LEG_FACTOR),
|
||||
windDirection.add(new DegreeBearingImpl(BUOY2_ANGLE_TO_WIND
|
||||
+ ((TrapezoidCourseLayouts) courseLayout).getReachAngle())));
|
||||
result.add(new PositionedMarkImpl("2", topReachBuoy));
|
||||
|
||||
// downwind gate
|
||||
Position downWindGateMid = getPositionForGivenPointDistanceAndBearing(topReachBuoy, legDistance,
|
||||
windDirection.add(new DegreeBearingImpl(BUOY2_ANGLE_TO_WIND)));
|
||||
|
||||
result.add(new PositionedMarkImpl("3S", getPositionForGivenPointDistanceAndBearing(downWindGateMid, boatClass
|
||||
.getHullLength().scale(GATE_LENGTH_TO_HULL_LENGTH_FACTOR / 2), windDirection.add(new DegreeBearingImpl(
|
||||
GATE_XS_WIND_ANGLE)))));
|
||||
result.add(new PositionedMarkImpl("4P", getPositionForGivenPointDistanceAndBearing(downWindGateMid, boatClass
|
||||
.getHullLength().scale(GATE_LENGTH_TO_HULL_LENGTH_FACTOR / 2), windDirection.add(new DegreeBearingImpl(
|
||||
GATE_XP_WIND_ANGLE)))));
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user