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
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidChecks to see if the configuration is valid.doublecompute(double totalLength) Computes the length.intcomputeI(double totalLength) Computes an integer threshold.intcomputeNegMaxI(double totalLength) Computes an integer threshold.copy()static ConfigLengthfixed(double length) intReturns the length as a rounded integer.booleanisFixed()True if a fixed length is specifiedbooleanbooleanTrue if a relative length is specifiedstatic ConfigLengthrelative(double fraction, double minimum) voidsetFixed(double length) voidsetRelative(double fraction, double minimum) setTo(ConfigLength src) toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods 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:ConfigurationChecks to see if the configuration is valid. If it is invalid, throw an exception explaining what is incorrect.- Specified by:
checkValidityin interfaceConfiguration
-
setTo
-
copy
-
toString
-