Bsoft  1.9
Bernard's software package
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
img_colour.cpp
Go to the documentation of this file.
1 
9 #include "img_colour.h"
10 #include "trigonometry.h"
11 #include "utilities.h"
12 
13 // Declaration of global variables
14 extern int verbose; // Level of output to the screen
15 
16 
30 {
31  unsigned long i, x, y;
32  double rx, ry, a, r, rmax(256);
33  Bimage* p = new Bimage(UCharacter, TRGB, 512, 512, 1, 1);
34  p->image->origin(p->size()/2);
36 
37  for ( i=y=0; y<p->sizeY(); y++ ) {
38  ry = y - p->image->origin().y();
39  for ( x=0; x<p->sizeX(); x++, i++ ) {
40  rx = x - p->image->origin().x();
41  a = batan2(ry, rx);
42  r = sqrt(rx*rx + ry*ry);
43  if ( r < rmax ) {
44  rgb.phase(a, r);
45  p->set(i, rgb);
46  }
47  }
48  }
49 
50  return p;
51 }
52 
int verbose
Header file for general utilities.
Functions to handle RGB images.
General image parameter class.
Definition: Bimage.h:152
Bimage * img_phase_colour_wheel()
Generates a phase color wheel.
Definition: img_colour.cpp:29
Definition: Color.h:30
double batan2(double y, double x)
Sets small values to zero before calling atan2.
Header file for trigonometry functions.
Vector3< size_t > size()
Definition: Bimage.h:315
void origin(double x, double y, double z)
Definition: Bimage.h:132
void set(size_t j, double v)
Sets a single value at the given index.
Definition: Bimage.cpp:884
Definition: Bimage.h:74
void sizeX(size_t nx)
Definition: Bimage.h:318
void sizeY(size_t ny)
Definition: Bimage.h:319
void phase(double phi, double amp_ratio)
Definition: Color.h:115
Bsub_image * image
Definition: Bimage.h:183