Antiprism 0.23
|
Class for colouring the elements of a geometry. More...
#include <coloring.h>
Public Member Functions | |
coloring (col_geom_v *geo=0) | |
Constructor. | |
coloring (const coloring &clrng) | |
Copy Constructor. | |
coloring & | operator= (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 <s) |
Set up the lights. | |
col_val | light (vec3d vec, col_geom_v <s) |
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_v * | get_geom () |
Get the geometry that is being coloured. |
Class for colouring the elements of a geometry.
coloring::coloring | ( | col_geom_v * | geo = 0 | ) |
Constructor.
geo | the geometry to be coloured. |
coloring::coloring | ( | const coloring & | clrng | ) |
Copy Constructor.
clrng | the coloring to copy from. |
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.*/.
apply_map | if 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.
lts | a 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.
apply_map | if 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.
col | colour 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.
apply_map | if 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.
apply_map | if 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.
equivs | the indexes in each set are given the same colour. |
apply_map | if 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.
apply_map | if 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.)
apply_map | if 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.
apply_map | if 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.
lts | a 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.
lts | a 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.
apply_map | if 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.
col | colour 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.
apply_map | if 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.
apply_map | if 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.
equivs | the indexes in each set are given the same colour. |
apply_map | if 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.
apply_map | if 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.
apply_map | if 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.
col_geom_v* coloring::get_geom | ( | ) | [inline, protected] |
Get the geometry that is being coloured.
col_val coloring::light | ( | vec3d | vec, |
col_geom_v & | lts | ||
) | [protected] |
Colour for a position vector from a set of lights.
vec | the position vector. |
lts | the lights (prepared for use by setup_lights().) |
Copy Assignment.
clrng | the 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.
cols | the 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.
interval | the number of milliseconds between colour map cycles. |
void coloring::set_geom | ( | col_geom_v * | geo | ) | [inline] |
Set the geometry to colour.
geo | the geometry to colour. |
void coloring::setup_lights | ( | col_geom_v & | lts | ) | [protected] |
Set up the lights.
lts | the 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".
apply_map | if 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.
lts | a geometry holding coloured vertices to use as lights. |
void coloring::v_one_col | ( | col_val | col | ) |
Colour vertices with a single colour.
col | colour for the vertices. |
void coloring::v_order | ( | bool | apply_map = true | ) |
Colour each vertex by the number of faces it lies on.
apply_map | if 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.
apply_map | if 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.
apply_map | if 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.
equivs | the indexes in each set are given the same colour. |
apply_map | if 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.
apply_map | if 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.
vec | the unit vector |
cent | the centre of the geometry. |
height | the height of the geometry along the z-axis. |
def_sz | allocate index numbers upto def_sz if no map has been set. size of the first map if one is set. |