Package boofcv.struct

Class ConfigLength

All Implemented Interfaces:
Configuration, Serializable

public class ConfigLength extends Object implements Configuration
Specifies a length as a fixed length or relative to the total size of some other object.
See Also:
  • Field Details

    • length

      public double length
      If in fixed mode this is the length, or it's the minimum length of a relative length is being specified
    • fraction

      public double fraction
      If ≥ 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

      public static ConfigLength fixed(double length)
    • relative

      public static ConfigLength relative(double fraction, double minimum)
    • 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.
      totalLength - What a relative value is relative to
      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 return Integer.MAX_VALUE
    • getLengthI

      public int getLengthI()
      Returns the length as a rounded integer.
    • isIdentical

      public boolean isIdentical(ConfigLength a)
    • 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 interface Configuration
    • setTo

      public ConfigLength setTo(ConfigLength src)
    • copy

      public ConfigLength copy()
    • toString

      public String toString()
      toString in class Object