Class ColorRGB
- java.lang.Object
-
- WildMagic.LibFoundation.Mathematics.ColorRGB
-
- All Implemented Interfaces:
java.io.Serializable
public class ColorRGB extends java.lang.Object implements java.io.SerializableColorRGB. Red, Green, Blue. The components are intended to be in the interval [0,1]- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description floatBBlue component [0,1]static ColorRGBBLACKConstant ColorRGB: Black (0,0,0)floatGGreen component [0,1]static ColorRGBINVALIDConstant ColorRGB: Invalid color (-1,-1,-1)floatRRed component [0,1]private static longserialVersionUIDstatic ColorRGBWHITEConstant ColorRGB: White (1,1,1)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidClamp()Transform the color channels to [0,1].voidCopy(ColorRGB rkC)Copy.booleanequals(java.lang.Object kObject)inthashCode()voidMax(ColorRGB kC)Maximum function.voidMin(ColorRGB kC)Minimum function.voidScaleByMax()Transform the color channels to [0,1].voidSet(float fR, float fG, float fB)Sets the R,G,B values of this ColorRGB The components are intended to be in the interval [0,1].java.lang.StringtoString()Returns a string representation of the vector values.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
-
BLACK
public static final ColorRGB BLACK
Constant ColorRGB: Black (0,0,0)
-
WHITE
public static final ColorRGB WHITE
Constant ColorRGB: White (1,1,1)
-
INVALID
public static final ColorRGB INVALID
Constant ColorRGB: Invalid color (-1,-1,-1)
-
R
public float R
Red component [0,1]
-
G
public float G
Green component [0,1]
-
B
public float B
Blue component [0,1]
-
-
Constructor Detail
-
ColorRGB
public ColorRGB()
Construction. The components are intended to be in the interval [0,1]. Default construction initial values (0,0,0)
-
ColorRGB
public ColorRGB(ColorRGB rkC)
Construction. The components are intended to be in the interval [0,1].- Parameters:
rkC- value from rkC are copied into this.
-
ColorRGB
public ColorRGB(float fR, float fG, float fB)Construction. The components are intended to be in the interval [0,1].- Parameters:
fR- red valuefG- green valuefB- blue value
-
-
Method Detail
-
Clamp
public void Clamp()
Transform the color channels to [0,1]. Clamp sets negative values to zero and values larger than one to one. ScaleByMax assumes the color channels are nonnegative, finds the maximum color channel, and divides all channels by that value.
-
Copy
public void Copy(ColorRGB rkC)
Copy. The components are intended to be in the interval [0,1].- Parameters:
rkC- value from rkC are copied into this.
-
equals
public boolean equals(java.lang.Object kObject)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the vector values.- Overrides:
toStringin classjava.lang.Object- Returns:
- string representation of the vector values.
-
Max
public void Max(ColorRGB kC)
Maximum function. Sets this to be the maximum of this and the input vector: this = max( this, kV ).- Parameters:
kV- input vector.
-
Min
public void Min(ColorRGB kC)
Minimum function. Sets this to be the minimum of this and the input vector: this = min( this, kV ).- Parameters:
kV- input vector.
-
ScaleByMax
public void ScaleByMax()
Transform the color channels to [0,1]. Clamp sets negative values to zero and values larger than one to one. ScaleByMax assumes the color channels are nonnegative, finds the maximum color channel, and divides all channels by that value.
-
Set
public void Set(float fR, float fG, float fB)Sets the R,G,B values of this ColorRGB The components are intended to be in the interval [0,1].- Parameters:
fR- red valuefG- green valuefB- blue value
-
-