Antiprism 0.23
Public Member Functions | Protected Member Functions

coloring Class Reference

Class for colouring the elements of a geometry. More...

#include <coloring.h>

Inheritance diagram for coloring:
Inheritance graph
[legend]
Collaboration diagram for coloring:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 coloring (col_geom_v *geo=0)
 Constructor.
 coloring (const coloring &clrng)
 Copy Constructor.
coloringoperator= (const coloring &clrng)
 Copy Assignment.
 ~coloring ()
 Destructor.
void set_geom (col_geom_v *geo)
 Set the geometry to colour.
void cycle_map_cols ()
 Cycle the map colours.
void set_cycle_msecs (unsigned int interval)
 Set the time between colour map cycles.
unsigned int get_cycle_msecs () const
 Get the time between colour map cycles.
void v_one_col (col_val col)
 Colour vertices with a single colour.
void v_sets (const vector< set< int > > &equivs, bool apply_map=true)
 Colour each vertex set with a single colour.
void v_unique (bool apply_map=true)
 Colour each vertex with a different colour.
void v_proper (bool apply_map=true)
 Colour vertices with a proper colouring.
void v_face_color ()
 Colour vertices by face colour.
void v_edge_color ()
 Colour vertices by edge colour.
void v_order (bool apply_map=true)
 Colour each vertex by the number of faces it lies on.
void v_position (bool apply_map=true)
 Colour each vertex by its y-coordinate.
void v_avg_angle (bool apply_map=true)
 Colour each vertex by the average internal angle of a "vertex figure".
void v_lights (col_geom_v lts)
 Colour each vertex using a set of lights.
void v_apply_cmap ()
 Apply the colour map to turn vertex index numbers into colour values.
void f_one_col (col_val col)
 Colour faces with a single colour.
void f_sets (const vector< set< int > > &equivs, bool apply_map=true)
 Colour each face set with a single colour.
void f_unique (bool apply_map=true)
 Colour each face with a different colour.
void f_proper (bool apply_map=true)
 Colour faces with a proper colouring.
void f_sides (bool apply_map=true)
 Colour each face by the number of sides it has.
void f_avg_angle (bool apply_map=true)
 Colour each face by the average internal angle (to nearest degree.)
void f_parts (bool apply_map=true)
 Colour each face by the set of connected faces it is part of.
void f_normal (bool apply_map=true)
 Colour each face by the y-component of the normal.
void f_centroid (bool apply_map=true)
 Colour each face by the y-coordinate of the centroid.
void f_lights (col_geom_v lts)
 Colour each face by normal using a set of lights.
void f_lights2 (col_geom_v lts)
 Colour each face by centroid using a set of lights.
void f_apply_cmap ()
 Apply the colour map to turn face index numbers into colour values.
void e_one_col (col_val col)
 Colour edges with a single colour.
void e_sets (const vector< set< int > > &equivs, bool apply_map=true)
 Colour each edge set with a single colour.
void e_unique (bool apply_map=true)
 Colour each edge with a different colour.
void e_proper (bool apply_map=true)
 Proper edge colouring.
void e_face_color ()
 Colour by face colour.
void e_parts (bool apply_map=true)
 Colour each edge by the set of connected edges it is part of.
void e_direction (bool apply_map=true)
 Colour each edge by the y-component of its direction.*/.
void e_mid_point (bool apply_map=true)
 Colour each edge by the y-coordinate of its mid-point.
void e_lights (col_geom_v lts)
 Colour each edge using a set of lights.
void e_apply_cmap ()
 Apply the colour map to turn edge index numbers into colour values.

Protected Member Functions

int z_gradient (vec3d vec, vec3d cent=vec3d(0, 0, 0), double height=2, int def_sz=256)
 Colour index for a unit vector by its z-value.
void setup_lights (col_geom_v &lts)
 Set up the lights.
col_val light (vec3d vec, col_geom_v &lts)
 Colour for a position vector from a set of lights.
void set_all_idx_to_val (map< int, col_val > &cols)
 Convert all colour index numbers into colour values.
col_geom_vget_geom ()
 Get the geometry that is being coloured.

Detailed Description

Class for colouring the elements of a geometry.


Constructor & Destructor Documentation

coloring::coloring ( col_geom_v geo = 0)

Constructor.

Parameters:
geothe geometry to be coloured.
coloring::coloring ( const coloring clrng)

Copy Constructor.

Parameters:
clrngthe coloring to copy from.

Member Function Documentation

void coloring::cycle_map_cols ( )

Cycle the map colours.

Each colour index number is mapped to the previous colour value in the colour map.

void coloring::e_apply_cmap ( )

Apply the colour map to turn edge index numbers into colour values.

Uses the value set by handle_no_map() for converting index numbers not in the map . The HSVA ranges are respected if a random colour is allocated.

void coloring::e_direction ( bool  apply_map = true)

Colour each edge by the y-component of its direction.*/.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::e_face_color ( )

Colour by face colour.

Colour the edges with the colour of a face they are part of.

void coloring::e_lights ( col_geom_v  lts)

Colour each edge using a set of lights.

Parameters:
ltsa geometry holding coloured vertices to use as lights.
void coloring::e_mid_point ( bool  apply_map = true)

Colour each edge by the y-coordinate of its mid-point.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::e_one_col ( col_val  col)

Colour edges with a single colour.

Parameters:
colcolour for the edges.
void coloring::e_parts ( bool  apply_map = true)

Colour each edge by the set of connected edges it is part of.

To be connected two edges must share a vertex.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::e_proper ( bool  apply_map = true)

Proper edge colouring.

Colour so that no two adjacent edges on a face have the same colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::e_sets ( const vector< set< int > > &  equivs,
bool  apply_map = true 
)

Colour each edge set with a single colour.

Parameters:
equivsthe indexes in each set are given the same colour.
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::e_unique ( bool  apply_map = true)

Colour each edge with a different colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_apply_cmap ( )

Apply the colour map to turn face index numbers into colour values.

Uses the value set by handle_no_map() for converting index numbers not in the map . The HSVA ranges are respected if a random colour is allocated.

void coloring::f_avg_angle ( bool  apply_map = true)

Colour each face by the average internal angle (to nearest degree.)

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_centroid ( bool  apply_map = true)

Colour each face by the y-coordinate of the centroid.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_lights ( col_geom_v  lts)

Colour each face by normal using a set of lights.

Parameters:
ltsa geometry holding coloured vertices to use as lights.
void coloring::f_lights2 ( col_geom_v  lts)

Colour each face by centroid using a set of lights.

Parameters:
ltsa geometry holding coloured vertices to use as lights.
void coloring::f_normal ( bool  apply_map = true)

Colour each face by the y-component of the normal.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_one_col ( col_val  col)

Colour faces with a single colour.

Parameters:
colcolour for the faces.
void coloring::f_parts ( bool  apply_map = true)

Colour each face by the set of connected faces it is part of.

To be connected two faces must share an edge.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_proper ( bool  apply_map = true)

Colour faces with a proper colouring.

Colour so that no two adjoining faces have the same colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_sets ( const vector< set< int > > &  equivs,
bool  apply_map = true 
)

Colour each face set with a single colour.

Parameters:
equivsthe indexes in each set are given the same colour.
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_sides ( bool  apply_map = true)

Colour each face by the number of sides it has.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::f_unique ( bool  apply_map = true)

Colour each face with a different colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
unsigned int coloring::get_cycle_msecs ( ) const [inline]

Get the time between colour map cycles.

An interval of 0 indicates no cycling.

Returns:
The number of milliseconds between colour map cycles.
col_geom_v* coloring::get_geom ( ) [inline, protected]

Get the geometry that is being coloured.

Returns:
A pointer to the geometry.
col_val coloring::light ( vec3d  vec,
col_geom_v lts 
) [protected]

Colour for a position vector from a set of lights.

Parameters:
vecthe position vector.
ltsthe lights (prepared for use by setup_lights().)
Returns:
The final RGBA colour.
coloring & coloring::operator= ( const coloring clrng)

Copy Assignment.

Parameters:
clrngthe coloring to copy from.
void coloring::set_all_idx_to_val ( map< int, col_val > &  cols) [protected]

Convert all colour index numbers into colour values.

Parameters:
colsthe colours of the elements, by element index.
void coloring::set_cycle_msecs ( unsigned int  interval) [inline]

Set the time between colour map cycles.

An interval of 0 indicates no cycling.

Parameters:
intervalthe number of milliseconds between colour map cycles.
void coloring::set_geom ( col_geom_v geo) [inline]

Set the geometry to colour.

Parameters:
geothe geometry to colour.
void coloring::setup_lights ( col_geom_v lts) [protected]

Set up the lights.

Parameters:
ltsthe lights to prepare for use, or if there are no lights then a default set is provided.
void coloring::v_apply_cmap ( )

Apply the colour map to turn vertex index numbers into colour values.

Uses the value set by handle_no_map() for converting index numbers not in the map . The HSVA ranges are respected if a random colour is allocated.

void coloring::v_avg_angle ( bool  apply_map = true)

Colour each vertex by the average internal angle of a "vertex figure".

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::v_edge_color ( )

Colour vertices by edge colour.

Colour the vertices with the colour of an edge they are on.

void coloring::v_face_color ( )

Colour vertices by face colour.

Colour the vertices with the colour of a face they are on.

void coloring::v_lights ( col_geom_v  lts)

Colour each vertex using a set of lights.

Parameters:
ltsa geometry holding coloured vertices to use as lights.
void coloring::v_one_col ( col_val  col)

Colour vertices with a single colour.

Parameters:
colcolour for the vertices.
void coloring::v_order ( bool  apply_map = true)

Colour each vertex by the number of faces it lies on.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::v_position ( bool  apply_map = true)

Colour each vertex by its y-coordinate.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::v_proper ( bool  apply_map = true)

Colour vertices with a proper colouring.

Colour so that no two adjacent vertices on a face have the same colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::v_sets ( const vector< set< int > > &  equivs,
bool  apply_map = true 
)

Colour each vertex set with a single colour.

Parameters:
equivsthe indexes in each set are given the same colour.
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
void coloring::v_unique ( bool  apply_map = true)

Colour each vertex with a different colour.

Parameters:
apply_mapif false, colour with index numbers, if true, convert these index numbers using the colour maps
int coloring::z_gradient ( vec3d  vec,
vec3d  cent = vec3d(0,0,0),
double  height = 2,
int  def_sz = 256 
) [protected]

Colour index for a unit vector by its z-value.

Index numbers are assigned in the range of 0 up to the last entry in the first colour map.

Parameters:
vecthe unit vector
centthe centre of the geometry.
heightthe height of the geometry along the z-axis.
def_szallocate index numbers upto def_sz if no map has been set. size of the first map if one is set.
Returns:
The index.

The documentation for this class was generated from the following files: