Added the Polars.calculateVMG function, which calculates the VMG from a given wind angle, wind speed, and angle to destination. In may not be completely correct at the moment, so it's a work in progress. #story[873]main
parent
693da8a82a
commit
238b97c016
@ -0,0 +1,45 @@
|
|||||||
|
package seng302.Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by f123 on 10-May-17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This class encapsulates VMG - that is, velocity made good. It has a speed component and a bearing component.
|
||||||
|
*/
|
||||||
|
public class VMG {
|
||||||
|
|
||||||
|
///Speed component of the VMG.
|
||||||
|
double speed;
|
||||||
|
|
||||||
|
///Bearing component of the VMG.
|
||||||
|
double bearing;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ctor. Creates a VMG object with a given speed and bearing (that is, a velocity).
|
||||||
|
* @param speed Speed component of the VMG.
|
||||||
|
* @param bearing Bearing component of the VMG.
|
||||||
|
*/
|
||||||
|
public VMG(double speed, double bearing) {
|
||||||
|
this.speed = speed;
|
||||||
|
this.bearing = bearing;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the speed component of this VMG object.
|
||||||
|
* @return Speed component of this VMG object.
|
||||||
|
*/
|
||||||
|
public double getSpeed() {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the bearing component of this VMG object.
|
||||||
|
* @return Bearing component of this VMG object.
|
||||||
|
*/
|
||||||
|
public double getBearing() {
|
||||||
|
return bearing;
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in new issue