Package primitives

Class Factors

java.lang.Object
primitives.Factors

public class Factors
extends java.lang.Object
This class represents attenuation factors for the red, green, and blue channels. These are to be used to scale colours. Using these, geometries can look a certain colour.
  • Field Summary

    Fields
    Modifier and Type Field Description
    static Factors ONE
    The maximum value of Factors.
    static Factors ZERO
    The minimum value of Factors.
  • Constructor Summary

    Constructors
    Constructor Description
    Factors​(double value)
    Construct a factors object with the same value for all channels.
    Factors​(double red, double green, double blue)
    Construct a factors object.
  • Method Summary

    Modifier and Type Method Description
    boolean lt​(double threshold)
    Returns whether or not the values of the factors are all less than some threshold.
    Factors scale​(Factors factors)
    Scale each factor by the corresponding given factor.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • ONE

      public static final Factors ONE
      The maximum value of Factors. That is (1, 1, 1).
    • ZERO

      public static final Factors ZERO
      The minimum value of Factors. That is (0, 0, 0).
  • Constructor Details

    • Factors

      public Factors​(double red, double green, double blue)
      Construct a factors object.
      Parameters:
      red - The red factor.
      green - The green factor.
      blue - The blue factor.
    • Factors

      public Factors​(double value)
      Construct a factors object with the same value for all channels.
      Parameters:
      value - The value for all channels.
  • Method Details

    • lt

      public boolean lt​(double threshold)
      Returns whether or not the values of the factors are all less than some threshold.
      Parameters:
      threshold - The lower bound of the factors.
      Returns:
      true if all values are less than the threshold, otherwise false.
    • scale

      public Factors scale​(Factors factors)
      Scale each factor by the corresponding given factor.
      Parameters:
      factors - The given factors to scale these factors by.
      Returns:
      A new Factors object where each factor is the product of the two corresponding factors.