Class BooleanBasedFOVBase
Base class which is convenient for defining FOV algorithms which produce an array of booleans as output, and thus they derive their DoubleResultView values from the boolean values, by making the double value returned a function of distance from the origin relative to radius.
Inherited Members
Namespace: GoRogue.FOV
Assembly: GoRogue.dll
Syntax
public abstract class BooleanBasedFOVBase : FOVBase, IFOV, IReadOnlyFOV
Remarks
This class inherits from FOVBase, and all the caveats mentioned in its remarks section should apply. If you instead want to define an FOV algorithm as returning double values, and deriving boolean from that, you can use DoubleBasedFOVBase instead. If neither of those use cases fits your situation, feel free to use FOVBase or IFOV directly.
Although it can vary by implementation, if all other things are equal, classes that use this implementation as opposed to DoubleBasedFOVBase generally tend to take up less memory, however they may take more time to retrieve values from DoubleResultView. Retrieving values from BooleanResultView is generally faster than from DoubleResultView, since the double values are derived from the boolean values.
Although using DoubleBasedFOVBase is usually a better default, the tradeoffs of this method can be good for extremely large maps, especially when CalculateAppend isn't used much and/or only BooleanResultView is primarily used.
Library implementations typically provide versions of any given algorithm defined via both this class and DoubleBasedFOVBase where possible.
Constructors
View SourceBooleanBasedFOVBase(IGridView<bool>, ISettableGridView<bool>)
Constructor.
Declaration
protected BooleanBasedFOVBase(IGridView<bool> transparencyView, ISettableGridView<bool> resultView)
Parameters
Type | Name | Description |
---|---|---|
IGridView<bool> | transparencyView | The values used to calculate field of view. Values of true are considered non-blocking (transparent) to line of sight, while false values are considered to be blocking. |
ISettableGridView<bool> | resultView | The view in which FOV calculations are stored. |
Fields
View SourceResultView
View in which the results of LOS calculations are stored. The values in this view are used to derive the public result views.
Declaration
protected ISettableGridView<bool> ResultView
Field Value
Type | Description |
---|---|
ISettableGridView<bool> |
Remarks
The requirements for these values are identical to BooleanResultView. BooleanResultView simply exposes these values directly; DoubleResultView returns 0 for any location where BooleanResultView returns false, and otherwise returns a non-0 double that is a function of distance/falloff from the source (a value in range (0, 1]).
Properties
View SourceBooleanResultView
A view of the calculation results in boolean form, where true indicates a location is in field of view, and false indicates it is not.
Declaration
public override IGridView<bool> BooleanResultView { get; }
Property Value
Type | Description |
---|---|
IGridView<bool> |
Overrides
View SourceDoubleResultView
A view of the calculation results in double form, where a value greater than 0.0 indicates that the value is inside of FOV, and a value of 1.0 indicates the center point. All other values vary between 0.0 and 1.0, decreasing as positions get farther away from the center point.
Declaration
public override IGridView<double> DoubleResultView { get; }
Property Value
Type | Description |
---|---|
IGridView<double> |