Package boofcv.struct
Class ConfigLength
java.lang.Object
boofcv.struct.ConfigLength
- All Implemented Interfaces:
Configuration
,Serializable
Specifies a length as a fixed length or relative to the total size of some other object.
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Checks to see if the configuration is valid.double
compute
(double totalLength) Computes the length.int
computeI
(double totalLength) Computes an integer threshold.int
computeNegMaxI
(double totalLength) Computes an integer threshold.copy()
static ConfigLength
fixed
(double length) int
Returns the length as a rounded integer.boolean
isFixed()
True if a fixed length is specifiedboolean
boolean
True if a relative length is specifiedstatic ConfigLength
relative
(double fraction, double minimum) void
setFixed
(double length) void
setRelative
(double fraction, double minimum) setTo
(ConfigLength src) toString()
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface boofcv.struct.Configuration
serializeActiveFields, serializeInitialize
-
Field Details
-
length
public double lengthIf in fixed mode this is the length, or it's the minimum length of a relative length is being specified -
fraction
public double fractionIf ≥ 0 the length is relative to the total size and the 'fixed' number is treated as a minimum size.
-
-
Constructor Details
-
ConfigLength
public ConfigLength(double length, double fraction) -
ConfigLength
public ConfigLength()
-
-
Method Details
-
fixed
-
relative
-
setFixed
public void setFixed(double length) -
setRelative
public void setRelative(double fraction, double minimum) -
compute
public double compute(double totalLength) Computes the length. If a relative length is used then it will be relative to the input.- Parameters:
totalLength
- What a relative value is relative to- Returns:
- The length
-
isRelative
public boolean isRelative()True if a relative length is specified -
isFixed
public boolean isFixed()True if a fixed length is specified -
computeI
public int computeI(double totalLength) Computes an integer threshold. If threshold value is < 0 then an exception is thrown. -
computeNegMaxI
public int computeNegMaxI(double totalLength) Computes an integer threshold. If threshold value is < 0 will returnInteger.MAX_VALUE
-
getLengthI
public int getLengthI()Returns the length as a rounded integer. -
isIdentical
-
checkValidity
public void checkValidity()Description copied from interface:Configuration
Checks to see if the configuration is valid. If it is invalid, throw an exception explaining what is incorrect.- Specified by:
checkValidity
in interfaceConfiguration
-
setTo
-
copy
-
toString
-