## jrobots.utils
Class Scan

    java.lang.Object
      jrobots.utils.Scan

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

    public class Scan

extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

This class represents a single Scan result. It holds:

- Direction of the scanner at the time of scan.
- Aperture of the scan at the time of scan.
- Scanned distance at the time of scan.
- Time of scan.

See Also:
  `isTargetLocated()`, `isTargetLocated()`, `getArcLength()`, `Scan(Angle, Angle, double, Vector, double)`, `timeOfScan`, `scanAperture`, `scanDirection`, `scannerPosition`, Serialized Form

Field Summary
`double` | `distanceToTarget` Scanned distance at the time of scan.
`Angle` | `scanAperture` Aperture of the scan at the time of scan.
`Angle` | `scanDirection` Direction of the scanner at the time of scan.
`Vector` | `scannerPosition` Position of the scanner at scan time.
`double` | `timeOfScan` time of scan [s].

Constructor Summary
`Scan(Angle scanDirection, Angle scanAperture, double distanceToTarget, Vector scannerPosition, double timeOfScan)` Initializes all final fields.

Method Summary
`Vector` | `estimatedTargetPosition()` Estimates the target's position accoring to the scanned values.
`double` | `getArcLength()` This method retrieves the length of the arc at which the scanned target is located.
`boolean` | `isTargetLocated()` Gives the information whether this scan has detected an enemy or not.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### distanceToTarget

    public final double distanceToTarget

  Scanned distance at the time of scan.

  If no target was found inside the scanned cone the distance is 0.

  Note: The distance to target may be outdated at a later time. If you need the distance to the given direction use
  `getPosition().distanceTo(estimatedTargetPosition())`

### scanAperture

    public final Angle scanAperture

  Aperture of the scan at the time of scan.

### scanDirection

    public final Angle scanDirection

  Direction of the scanner at the time of scan.

### scannerPosition

    public final Vector scannerPosition

  Position of the scanner at scan time. This is where the scan flash originated from.

### timeOfScan

    public final double timeOfScan

  time of scan [s]. The time is measured sind the begin of the match

Constructor Detail

### Scan

    public Scan(Angle scanDirection,
                Angle scanAperture,
                double distanceToTarget,
                Vector scannerPosition,
                double timeOfScan)

  Initializes all final fields. Does nothing else.

  Parameters:
    `scanDirection` -
    `scanAperture` -
    `distanceToTarget` -
    `scannerPosition` -
    `timeOfScan` -

Method Detail

### estimatedTargetPosition

    public Vector estimatedTargetPosition()

  Estimates the target's position accoring to the scanned values. It is assumed that the target was in the middle of the scanned arc.

  Note: The vector is given in global coordinates and is not relative to the own position.

  Returns:
    `scannerPosition.add(new Vector(scanDirection, distanceToTarget))`

### getArcLength

    public double getArcLength()

  This method retrieves the length of the arc at which the scanned target is located. The value is proportional to the aperture and to the scanned distance.

  One can say that the longer the arc the more miserable is the scan.

  Returns:
    `scanAperture.getValueAsRadians() * distanceToTarget`

### isTargetLocated

    public boolean isTargetLocated()

  Gives the information whether this scan has detected an enemy or not. This is also represented by a zero distance.

  Returns:
    `true` - a target was scanned
    `false` - no target was scanned.