Y2S1-Seabed_Explorer/src/seabedexplorer/data/LaserReading.java
2020-06-07 22:14:52 +01:00

67 lines
1.6 KiB
Java

package seabedexplorer.data;
/**
* LaserReading. Stores an angle, as recorded by a laser camera, as well as a
* distance that is a useful property of the laser camera itself.
*
* @author Dan Lawrence
* @version %I%, %G%
*/
public class LaserReading extends TopographicalMapping{
/**
* The recorded angle, in degrees.
*/
double angle;
/**
* The distance between the camera and the laser, in meters.
*/
double distance;
/**
* Constructor. Is the only way to set the values of the reading, and the
* distance.
*
* @param angleIn The recorded angle, in degrees.
*
* @param distanceIn The distance between the camera and the laser, in
* meters.
*/
public LaserReading(double angleIn, double distanceIn) {
angle = angleIn;
distance = distanceIn;
calculateDepth();
System.out.println("Laser camera depth reading stored successfully.\n");
}
@Override
void calculateDepth() {
depth = distance / Math.tan(angle / (180/Math.PI));
}
/**
* Returns the angle, of the same data type it is stored as (double).
*/
public double getAngle() {
return angle;
}
/**
* Returns the distance, of the same data type it is stored as (double).
*/
public double getDistance() {
return distance;
}
@Override
public String toString() {
return "Laser camera reading:\n"
+ " Recorded angle: " + angle + "°\n"
+ " Determined depth: " + depth + "m\n";
}
}