antiprism-0.23
Up Next

# off_color - add colours to an OFF file

Usage | Examples | Notes

## Usage

    Usage: off_color [options] [input_file]

    Read a file in OFF format and add colours to it. If input_file is
    not given the program reads from standard input.

    A colour value can be a single integer (a colour index), a value in
    form 'R,G,B,A' (3 or 4 values 0.0-1.0, or 0-255) or hex 'xFFFFFF', a
    colour name from the X11 colour map, 'invisible' or 'none' (which sets
    without any colour information)

    Lowercase letters (except l) colour using index numbers and uppercase
    letters colour using colour values. Symmetric colourings are optionally
    followed, separated by commas, by a subsymmetry (Schoenflies notation)
    and a conjugation type (integer)

    Options
      -h,--help this help message (run 'off_util -H help' for general help)
      --version version information
      -f <col>  colour the faces according to:
                   a colour value - apply to all faces
                   u,U - unique colour
                   p,P - minimal proper colouring
                   s,S - symmetric colouring [,sub_group,conj_type] (see above)
                   n,N - colour by number of sides
                   a,A - colour by average internal angle (to nearest degree)
                   k,K - sets of faces connected by face edges
                   g,G - gradient on z-coordinate of normal
                   c,C - gradient on z-coordinate of centroid
                   L   - lighting effect by normal (see option -l)
                   l   - lighting effect by centroid (see option -l)
                   M   - use colour map to convert existing colour index numbers
                         into to values
      -E <type> colour by edge type, e - explicit edges, i - implicit edges
                I - implicit edges which are not explicit edges (default: if -e
                explicit and implicit, else explicit for mapping only)
      -e <col>  colour the edges according to:
                   a colour value - apply to all edges
                   u,U - unique colour
                   p,P - minimal proper colouring
                   s,S - symmetric colouring [,sub_group,conj_type] (see above)
                   k,K - sets of edges connected by edges
                   F   - colour with average adjoining face colour
                   g,G - gradient on z-coordinate of edge direction
                   c,C - gradient on z-coordinate of centroid
                   L   - lighting effect (see option -l)
                   M   - use colour map to convert existing colour index numbers
                         into to values
      -v <col>  colour the vertices according to:
                   a colour value - apply to all vertices
                   u,U - unique colour
                   p,P - minimal proper colouring
                   s,S - symmetric colouring [,sub_group,conj_type] (see above)
                   n,N - colour by order of vertex
                   a,A - colour by avg internal ang of vert-fig (to nearest deg)
                   F   - colour with average adjoining face colour
                   E   - colour with average adjoining edge colour
                   c,C - gradient on z-coordinate
                   L   - lighting effect (see option -l)
                   M   - use colour map to convert existing colour index numbers
                         into to values
      -l <file> lights for colouring type L in a file in OFF format, each
                vertex and its colour gives a light direction and colour
                (default: a set of six lights giving a rainbow colouring
      -m <maps> a comma separated list of colour maps used to transform colour
                indexes (default: rand), a part consisting of letters from
                v, e, f, selects the element types to apply the map list to
                (default 'vef').
      -r <rnge> Map HSVA values onto the specified HSVA ranges after other
                processing (but before -I), component letters are followed by
                one or two values separated by a colon e.g H0.5:0.8 followed by
                elements to map from v, e and f (H0:1,S0:1,V0:1,A0:1,vef)
      -I <elms> map color values to index numbers (after other procesing)
                elements to map are from v, e and f (default none)
      -w <wdth> width of sphere containing points (default: calculated)
      -U <typs> colour only elements with particular current colour types:
                u - unset, i - indexed, v - visible colour value, x - invisible.
                ~ before the letter will select the opposite.
      -o <file> write output to file (default: write to standard output)

## Examples

Make a cuboctahedron with the triangle faces a different colour to the square faces

    off_color -f N -o cubo.off cuboctahedron

Same again, but make the colours black and white. Create a file called my_colormap.txt with these two lines which convert index numbers into colour values (with the -f n option faces have an index number the same as their number of sides).

       3 = 0.0 0.0 0.0
       4 = 1.0 1.0 1.0

Now the command is

    off_color -f n -m my_colormap.txt -o cubo.off cuboctahedron

Colour faces with unique colours

    off_color -f U geo_2 | antiview -x ve

Make dark colours for U by decreasing the value of the default map

    off_color -f U -r V0.4 geo_2 | antiview -x ve

Rather than changing a map with -r an map with the desired colours could be chosen e.g. a map with blue-green range and a pastel range

    off_color -f U -m rnd_H0.4:0.7 geo_2 | antiview -x ve
    off_color -f U -m rand_S0.3 geo_2 | antiview -x ve

Colour different elements with different maps

    off_color -f U -m f,rnd_H0.4:0.7 -e U -m e,rnd_H0.9:1.2 geo_2 | antiview -v 0.05

Colour edges and vertices with a rainbow effect

    off_color -f 1.0,1.0,1.0 -e L -v L geo_5 | antiview -v 0.05

Make a lights file placing a red, green, blue and white light tetrahedrally, call it lts.off

    OFF
    4 4 0
    1 1 1
    1 -1 -1
    -1 -1 1
    -1 1 -1
    1 0 255 0 0
    1 1 0 255 0
    1 2 0 0 255
    1 3 255 255 255

Colour faces with a lighting effect using these lights

    off_color -l lts.off -f L geo_5 | antiview -x ve

## Notes

A selection of lights files and colour map files are included with the Antiprism resources. More colour maps are available from Colorzilla Palettes.

Proper colourings are not always optimal.

Face colourings G and L which use normals are affected by the orientation of the faces. If the colouring is patchy then orient the faces with off_util -O pos

Up: Programs and Documentation
Next: off_trans - transformations (rotations etc) of OFF files