| Bsoft 1.9 Bernard's software package

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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
29 Bimage* img_phase_colour_wheel()
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);
35 RGB<unsigned char> rgb;
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
verbose
int verbose
utilities.h
Header file for general utilities.
img_colour.h
Functions to handle RGB images.
Bimage
General image parameter class.
Definition: Bimage.h:152
UCharacter
Definition: Bimage.h:51
img_phase_colour_wheel
Bimage * img_phase_colour_wheel()
Generates a phase color wheel.
Definition: img_colour.cpp:29
RGB
Definition: Color.h:30
batan2
double batan2(double y, double x)
Sets small values to zero before calling atan2.
Definition: trigonometry.cpp:122
trigonometry.h
Header file for trigonometry functions.
Bimage::size
Vector3< size_t > size()
Definition: Bimage.h:315
Bsub_image::origin
void origin(double x, double y, double z)
Definition: Bimage.h:132
Bimage::set
void set(size_t j, double v)
Sets a single value at the given index.
Definition: Bimage.cpp:884
TRGB
Definition: Bimage.h:74
Bimage::sizeX
void sizeX(size_t nx)
Definition: Bimage.h:318
Bimage::sizeY
void sizeY(size_t ny)
Definition: Bimage.h:319
RGB::phase
void phase(double phi, double amp_ratio)
Definition: Color.h:115
Bimage::image
Bsub_image * image
Definition: Bimage.h:183