fr.cnes.sirius.patrius.fieldsofview
Class BooleanField

java.lang.Object
  extended by fr.cnes.sirius.patrius.fieldsofview.BooleanField
All Implemented Interfaces:
IFieldOfView

public final class BooleanField
extends Object
implements IFieldOfView

This class describes a boolean field of view that combines two existing fields with a "AND" or "OR" boolean combination.

Since:
1.2
Version:
$Id: BooleanField.java 17586 2017-05-10 13:29:16Z bignon $
Author:
Thomas Trapier
See Also:
IFieldOfView
Concurrency :
conditionally thread-safe
Concurrency comment :
the used fields must be thread-safe themselves. All available fields are immutable.

Nested Class Summary
static class BooleanField.BooleanCombination
          The boolean combination to be applied
 
Constructor Summary
BooleanField(String name, IFieldOfView firstField, IFieldOfView secondField, BooleanField.BooleanCombination booleanCombination)
          Constructor for the "AND" or "OR" combined field of view
 
Method Summary
 double getAngularDistance(Vector3D direction)
          Computes the angular distance between a vector and the border of the field.
 String getName()
          
 boolean isInTheField(Vector3D direction)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BooleanField

public BooleanField(String name,
                    IFieldOfView firstField,
                    IFieldOfView secondField,
                    BooleanField.BooleanCombination booleanCombination)
Constructor for the "AND" or "OR" combined field of view

Parameters:
name - the name of this field
firstField - the first field to be combined
secondField - the second field to be combined
booleanCombination - combination to be applied : "AND" or "OR"
Method Detail

getAngularDistance

public double getAngularDistance(Vector3D direction)
Computes the angular distance between a vector and the border of the field. The result is positive if the direction is in the field, negative otherwise. In some cases, this value can be approximative : in the "OR" case, inside of the field, and in the "AND" case ouside of it.

Specified by:
getAngularDistance in interface IFieldOfView
Parameters:
direction - the direction vector
Returns:
the angular distance

isInTheField

public boolean isInTheField(Vector3D direction)

Specified by:
isInTheField in interface IFieldOfView
Parameters:
direction - a direction vector
Returns:
true if the direction is in the field

getName

public String getName()

Specified by:
getName in interface IFieldOfView
Returns:
the name of the field


Copyright © 2017 CNES. All Rights Reserved.