added getLength()
This commit is contained in:
parent
ca806aafff
commit
1f6999aefc
1 changed files with 8 additions and 5 deletions
|
@ -210,11 +210,14 @@ public class Path {
|
||||||
*
|
*
|
||||||
* @return Total length of the path (in meters).
|
* @return Total length of the path (in meters).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
|
||||||
*/
|
*/
|
||||||
public float getLength() {
|
public float getLength() {
|
||||||
// TODO:
|
float acc = 0;
|
||||||
return 0;
|
for (Arc l : arcs) {
|
||||||
|
acc += l.getLength();
|
||||||
|
}
|
||||||
|
|
||||||
|
return acc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -225,10 +228,10 @@ public class Path {
|
||||||
* @return Time (in seconds) required to travel this path at the given speed (in
|
* @return Time (in seconds) required to travel this path at the given speed (in
|
||||||
* kilometers-per-hour).
|
* kilometers-per-hour).
|
||||||
*
|
*
|
||||||
* @deprecated Need to be implemented.
|
|
||||||
*/
|
*/
|
||||||
public double getTravelTime(double speed) {
|
public double getTravelTime(double speed) {
|
||||||
return (this.getLength()/speed);
|
double speed2 = speed * 1000/3600;
|
||||||
|
return (this.getLength()/speed2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue