robocode.naval
Class BlindSpot

java.lang.Object
  extended by robocode.naval.BlindSpot
All Implemented Interfaces:
Serializable

public class BlindSpot
extends Object
implements Serializable

A blind spot is used to prevent something from moving to a specified angle.

Since:
1.8.3.0 Alpha 1
Version:
0.1
Author:
Thales B.V. / Jiri Waning
See Also:
Serialized Form

Constructor Summary
BlindSpot(BlindSpot blindSpot)
          Copy constructor for BlindSpot.
BlindSpot(double start, double extent)
          Create a new blind spot.
 
Method Summary
 double getBestAngle(double angle)
          Deprecated. 
 boolean getCrossZero()
          This function is mostly used internally to draw the BlindSpots.
 double getEnd()
          Returns the end of the BlindSpot in RADIANS
 double getExtent(double curAngle, double destAngle)
          Get the extent between two different angles.
 double getFarLeft()
          Returns the far Left point of the BlindSpot.
 double getFarRight()
          Returns the far Right point of the BlindSpot.
 double getOnlyAngle(double curAngle, double destAngle)
          Deprecated. 
 double getRotateDirection(double curAngle, double destAngle)
          Deprecated. 
 double getStart()
          Returns the start of the BlindSpot in RADIANS
 boolean hasBlindSpot()
          Determines whether or not there is a blind spot set.
 boolean inBlindSpot(double angle)
          Determines if the given angle is within the blind spot.
 boolean isCrossingArch(double angle, double extent)
          Deprecated. 
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BlindSpot

public BlindSpot(double start,
                 double extent)
Create a new blind spot.

Parameters:
start - The angle at which to start.
extent - The angular extent of the blind arch. (Negative means left!)

BlindSpot

public BlindSpot(BlindSpot blindSpot)
Copy constructor for BlindSpot. (Wasn't even needed really, because there's no setters in this class. But I guess it could be useful in the future)

Parameters:
blindSpot - The BlindSpot you want to copy
Method Detail

getStart

public double getStart()
Returns the start of the BlindSpot in RADIANS

Returns:
the start of the BlindSpot in RADIANS

getEnd

public double getEnd()
Returns the end of the BlindSpot in RADIANS

Returns:
the end of the BlindSpot in RADIANS

getCrossZero

public boolean getCrossZero()
This function is mostly used internally to draw the BlindSpots. Java gets annoyed when you try to draw an arc over the 0-point, unless you make sure the extend is negative.

Returns:
Whether the Arc cross 0 or not.
See Also:
#BattleView.drawNavalBlindSpots(Graphics2D, IRobotSnapshot)

getFarRight

public double getFarRight()
Returns the far Right point of the BlindSpot. Mostly used by the system. Returns the furthest you can move to the right (which can either be the end or the start, depending on whether it's crossing zero and whether start is higher than end)

Returns:
the far Right pint of the BlindSpot.

getFarLeft

public double getFarLeft()
Returns the far Left point of the BlindSpot. Mostly used by the system. Returns the furthest you can move to the left (which can either be the end or the start, depending on whether it's crossing zero and whether start is higher than end)

Returns:
the far Left pint of the BlindSpot.

hasBlindSpot

public boolean hasBlindSpot()
Determines whether or not there is a blind spot set.

Returns:
true if there is a blind arch; false otherwise.

inBlindSpot

public boolean inBlindSpot(double angle)
Determines if the given angle is within the blind spot.

Parameters:
angle - The angle, in radians, to determine from if it is inside the blind spot.
Returns:
true if the angle is within the blind spot; false otherwise.

getExtent

public double getExtent(double curAngle,
                        double destAngle)
Get the extent between two different angles. This is being measured from the curAngle to the destAngle.

Parameters:
curAngle - The current angle of the component.
destAngle - The destination angle of the component.
Returns:
The extent between the two angles.

getBestAngle

@Deprecated
public double getBestAngle(double angle)
Deprecated. 

Get the best angle we can use with regard to the blind arch.

If it is inside the blind arch, it will return the closest edge of the blind arch.

When the angle is not in the blind arch it will return the angle.

Parameters:
angle - The angle, in radians, we want to rotate to.
Returns:
The best angle, in radians, to rotate to.
See Also:
#getRotateDirection(double)

isCrossingArch

@Deprecated
public boolean isCrossingArch(double angle,
                                         double extent)
Deprecated. 

Determine if it crossed the blind arch or not.

Parameters:
angle - The starting angle.
extent - The amount we have to move.
Returns:
true if it crosses the arch; false otherwise.

getRotateDirection

@Deprecated
public double getRotateDirection(double curAngle,
                                            double destAngle)
Deprecated. 

Get the best direction to rotate to.

Parameters:
curAngle - The current angle, in radians, of the component.
destAngle - The angle, in radians, that has to be rotated to.
Returns:
-1 (left), 0 (unknown) or 1 (right)
See Also:
getBestAngle(double)

getOnlyAngle

@Deprecated
public double getOnlyAngle(double curAngle,
                                      double destAngle)
Deprecated. 

This gets the only possible angle when going into the blind arch. It ensures the angle is set on the appropriate side of the blind arch. When not inside the blind arch it simple returns the input.

Parameters:
angle - The angle, in radians, we want to rotate to.
Returns:


Copyright © 2015 Robocode. All Rights Reserved.