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.Serializable
ColorRGB. 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 float
B
Blue component [0,1]static ColorRGB
BLACK
Constant ColorRGB: Black (0,0,0)float
G
Green component [0,1]static ColorRGB
INVALID
Constant ColorRGB: Invalid color (-1,-1,-1)float
R
Red component [0,1]private static long
serialVersionUID
static ColorRGB
WHITE
Constant ColorRGB: White (1,1,1)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
Clamp()
Transform the color channels to [0,1].void
Copy(ColorRGB rkC)
Copy.boolean
equals(java.lang.Object kObject)
int
hashCode()
void
Max(ColorRGB kC)
Maximum function.void
Min(ColorRGB kC)
Minimum function.void
ScaleByMax()
Transform the color channels to [0,1].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].java.lang.String
toString()
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()
Returns a string representation of the vector values.- Overrides:
toString
in 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
-
-