Introduction

Getting Started

Programming Guides

API Reference

Additional Resources

Set_Color_By_FIndex

Functions

void Set_Color_By_FIndex (const char *types, double findex)
 This is a specialized version of Set_Color_By_Index for use with false-colored pictures. More...
 

Detailed Description

Function Documentation

void Set_Color_By_FIndex ( const char *  types,
double  findex 
)

This is a specialized version of Set_Color_By_Index for use with false-colored pictures.

Parameters
types- A list of which types of geometry are to be affected by this color specification.
findex- The offset in the applicable color map at which the desired color will be found. The very first map entry is at offset zero; an findex value should normally round off to be within the map. Findex values greater than the colormap size will automatically "wraparound".

DETAILS

The following explanation explains the purpose of Set_Color_By_FIndex() :

"False coloring" refers to using the color variations of the surface of an object to indicate some property of the surface. For example, a blue-green-yellow-red scale might be a natural choice to indicate the temperature along a surface. You would usually set up for false-coloring by setting a color at each vertex of an object ( Open_Vertex() followed by Set_Color() , Set_Color_By_Value() , or Set_Color_By_Index() ). You would then allow smooth-coloring ("color interpolation=on") in Set_Rendering_Options() . The object as rendered on the screen would have colors that varied continuously from one pixel to the next.

A "fringe plot" (or "data mapping") is a specialized method of false-coloring in which the colors do not vary continuously—they come out looking like contour bands instead. Suppose you want to make a French flag. You create a rectangle (polygon) and you first try setting the two corners on the left to "red" and the two on the right to "blue". Then you turn on color-interpolation and draw it. You get a smooth blur, and the colors go from red to red-blue (a dark magenta) to blue. The white has been left out.

For a second try, you load red, white, and blue into a color map attribute (at offsets 0, 1, and 2) and set the left corners to index zero and the right corners to index two via Set_Color_By_Index() . For the sake of the argument, if you set "color index, interpolation=off" and draw it, you still get a smooth blur from red to red-blue to blue—the method of finding the vertex color is different; the net result is the same.

Then you set "color index interpolation=on" and "color interpolation=off" and redraw it. Presto, you get a flag: a red band, a white band, and a blue band as HOOPS interpolates the color indices across the rectangle and looks up each resulting pixel separately in the color map.

However there is still a problem. The bands do not occupy equal thirds of the rectangle—instead, the red band fills one quarter, the white fills two quarters, and the blue fills the last quarter. This is because the transitions in the interpolated index occurred at the quarter points. If the nominal color index was exactly 0.0 at the left edge and 2.0 at the right edge, then the nominal index went from 0.499 to 0.501 and the actual color index (rounded off) from 0 to 1 at the 25 percent point—not at 33 percent.

Set_Color_By_FIndex() fixes problems like this—it lets you declare a fractional values for the color index. In the French flag, you would call Set_Color_By_FIndex() to set the left edge to index "-0.4999" and the right edge to index "2.4999." The transition from 0.499 to 0.501 then happens at the one-third point and you've got your flag.

As an amenity, color-by-findex values always wrap around in the color map: the index used is the index you specify modulo ( colormaplength + 1). Negative values below -0.5 are not legal; positive values can go as high as 65,535. As many wrap-arounds as necessary will be drawn in between.

Finally, you can set "color index interpolation=on" and "color interpolation=on" at the same time. You get a smoothly-blurred false-color plot from red through white (this time) to blue. Thus color-by-findex can be used to make even the smooth plots more accurate.

MSet_Vertex_Colors_By_FIndex() ("Multi-Set") is offered as a convenience function to rapidly set a large number of vertex color floating-indices.

NOTES

Types should probably always be set to "faces". Other values turn into plain calls to Set_Color_By_Index() for display purposes (i.e., only shell and mesh faces know what to do with fractional index values at present).

There is no " Show_Color_By_FIndex() ". If you need to retrieve findex values the only way to do it is to call the general routine Show_Color() (or Show_One_Color() ) and then decipher the string value returned.

"FIndex" stands for "Fractional-Index", which unfortunately makes the subroutine names too long.

Use UnSet_Color() or UnSet_One_Color() (see Set_Color() ) to remove a color-by-findex.

RESTRICTIONS

See also
Set_Color_Map, Modify_Color_Map, Set_Color, Set_Color_By_Value, Set_Color_By_Index, Set_Rendering_Options, Open_Vertex, MSet_Vertex_Colors_By_FIndex.