Implementation of the functions working on colors as red/green/blue components.
- See Also
- Tcolor, color.h.
Definition in file color.c.
|
void | NewColor (double r, double g, double b, Tcolor *c) |
| Constructor. More...
|
|
void | NewColorWithID (unsigned int id, Tcolor *c) |
| Constructor. More...
|
|
void | CopyColor (Tcolor *c_dst, Tcolor *c_src) |
| Copy constructor. More...
|
|
boolean | NullColor (Tcolor *c) |
| Identifies a non-valid color. More...
|
|
void | Add2Color (double s, Tcolor *c) |
| Adds to a color. More...
|
|
void | ScaleColor (double s, Tcolor *c) |
| Scales a color. More...
|
|
void | AccumulateColor (Tcolor *c1, Tcolor *c) |
| Adds a color. More...
|
|
void | CostColor (double cost, double minCost, Tcolor *c) |
| Definees a color in function of a cost. More...
|
|
void | SetRed (double r, Tcolor *c) |
| Changes the red component of a color. More...
|
|
void | SetGreen (double g, Tcolor *c) |
| Changes the green component of a color. More...
|
|
void | SetBlue (double b, Tcolor *c) |
| Changes the blue component of a color. More...
|
|
double | GetRed (Tcolor *c) |
| Gets the red component of a color. More...
|
|
double | GetGreen (Tcolor *c) |
| Gets the green component of a color. More...
|
|
double | GetBlue (Tcolor *c) |
| Gets the blue component of a color. More...
|
|
void | PrintColor (FILE *f, Tcolor *c) |
| Prints the color. More...
|
|
void | DeleteColor (Tcolor *c) |
| Destructor. More...
|
|
void NewColor |
( |
double |
r, |
|
|
double |
g, |
|
|
double |
b, |
|
|
Tcolor * |
c |
|
) |
| |
Creates new color.
- Parameters
-
r | The red component for the new color. |
g | The green component for the new color. |
b | The blue component for the new color. |
c | The color to intialize. |
Definition at line 14 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Referenced by InitPlot3d(), InitPolyhedronFromFile(), InitWorldFromMolecule(), main(), NewColorWithID(), Plot3dObjectWithColors(), PlotAtlas(), PlotAtlasRRT(), PlotBifurcations(), PlotConnection(), PlotEnvironment(), PlotForceField(), PlotLink(), PlotQrand(), PlotRRT(), PlotSamples(), and TriangulateAtlas().
void NewColorWithID |
( |
unsigned int |
id, |
|
|
Tcolor * |
c |
|
) |
| |
Creates new color.
- Parameters
-
id | Identifier of the color (0 for red, etc). |
c | The color to intialize. |
Definition at line 21 of file color.c.
References BLACK, BLUE, CYAN, Error(), GREEN, GREY, NewColor(), PURPLE, RED, WHITE, and YELLOW.
Creates new color from another color.
- Parameters
-
c_dst | The color to create. |
c_src | The color from where to copy. |
Definition at line 57 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Referenced by AddLeg2World(), CopyPolyhedron(), GetPolyhedronColor(), InitPolyhedronFromFile(), InitPolyhedronFromTriangles(), NewBox(), NewCylinder(), NewLine(), NewSegments(), NewSphere(), NewSpring(), NewTriangularPrism(), SetPolyhedronColor(), and StartNew3dObject().
Identifies colors with negative values of red, green or blue.
Null-color is used to define a 3d object whose color does not need to be set globally since the elements of in the 3d objec already define its color.
- Parameters
-
- Returns
- TRUE if the color is null.
Definition at line 64 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Referenced by SetColor3dObject().
void Add2Color |
( |
double |
s, |
|
|
Tcolor * |
c |
|
) |
| |
void ScaleColor |
( |
double |
s, |
|
|
Tcolor * |
c |
|
) |
| |
Creates new color by scaling a existing color. Scale factors larger than one create lighter colors and scale factors below one create darker colors.
- Parameters
-
s | The scale factor. |
c | The color to scale. |
Definition at line 76 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Creates new color by adding two colors.
- Parameters
-
c1 | The color to add. |
c | The color where to accumulate c1. |
Definition at line 83 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
void CostColor |
( |
double |
cost, |
|
|
double |
minCost, |
|
|
Tcolor * |
c |
|
) |
| |
Defines a color in function of a cost. The lowest cost is plot in black and the rest in a gradient from red to green.
This is basically used to color atlas (and atlases triangulations) with associated cost functions.
- Parameters
-
cost | The cost. Must be scaled in [0,1]. |
minCost | Threshold from below which the cost is considered zero. Color below this cost is black. |
c | The color to define. |
Definition at line 90 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Referenced by PlotChartAsPolygon(), and TriangulateAtlas().
void SetRed |
( |
double |
r, |
|
|
Tcolor * |
c |
|
) |
| |
Changes the red component of a color.
- Parameters
-
r | The new red component. |
c | The color to update. |
Definition at line 108 of file color.c.
References Tcolor::r.
void SetGreen |
( |
double |
g, |
|
|
Tcolor * |
c |
|
) |
| |
Changes the green component of a color.
- Parameters
-
g | The new green component. |
c | The color to update. |
Definition at line 113 of file color.c.
References Tcolor::g.
void SetBlue |
( |
double |
b, |
|
|
Tcolor * |
c |
|
) |
| |
Changes the blue component of a color.
- Parameters
-
b | The new blue component. |
c | The color to update. |
Definition at line 118 of file color.c.
References Tcolor::b.
Gets the green component of a color.
- Parameters
-
- Returns
- The green component of the color.
Definition at line 128 of file color.c.
References Tcolor::g.
Referenced by PrintPolyhedron().
Gets the blue component of a color.
- Parameters
-
- Returns
- The blue component of the color.
Definition at line 133 of file color.c.
References Tcolor::b.
Referenced by PrintPolyhedron().
void PrintColor |
( |
FILE * |
f, |
|
|
Tcolor * |
c |
|
) |
| |
Prints the three components of a color in a file.
The componts (red, blue, and green) are printed as doubles, without any separation mark. This is the way in which Geomview uses colors.
- See Also
- plot3d.h, Tplot3d.
- Parameters
-
f | The file where to write the color |
c | The color to print. |
Definition at line 138 of file color.c.
References Tcolor::b, Tcolor::g, and Tcolor::r.
Referenced by Plot3dObjectWithColor(), Plot3dObjectWithColors(), PlotLine(), PlotSegments(), PlotVect3d(), PrintMechanism(), and SetColor3dObject().
void DeleteColor |
( |
Tcolor * |
c | ) |
|
Deletes the information stored in a Tcolor and frees the allocated memory, if any.
- Parameters
-
Definition at line 143 of file color.c.
Referenced by AddLeg2World(), InitWorldFromMolecule(), main(), PlotAtlas(), PlotAtlasRRT(), PlotBifurcations(), PlotConnection(), PlotEnvironment(), PlotForceField(), PlotLink(), PlotQrand(), PlotRRT(), PlotSamples(), and PrintMechanism().
|
Follow us!