cartobase  5.0.5
voxelhsv.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTOBASE_TYPE_HSV_H
35 #define CARTOBASE_TYPE_HSV_H
36 //--- cartobase --------------------------------------------------------------
37 #include <cartobase/type/types.h>
40 //--- system -----------------------------------------------------------------
41 //#define CARTO_DEBUG_RGB
42 #ifdef CARTO_DEBUG_RGB
43  #include <iostream>
44 #endif
45 //----------------------------------------------------------------------------
46 
47 namespace carto {
48 
49  class VoxelHSV;
50 
51  template<> inline std::string DataTypeCode<VoxelHSV>::dataType()
52  {
53  return "HSV";
54  }
55 
56  //==========================================================================
57  // D E C L A R A T I O N
58  //==========================================================================
59 
67  class VoxelHSV : public VoxelValue<uint8_t,3>
68  {
69  public:
70  //=== CONSTRUCTORS =====================================================
71  VoxelHSV( const VoxelHSV &other );
72  VoxelHSV( const VoxelValue<uint8_t,3> &other );
73  VoxelHSV( const uint8_t &h = 0,
74  const uint8_t &s = 0,
75  const uint8_t &v = 0 );
76  ~VoxelHSV();
77 
78  //=== AFFECTATION ======================================================
79  VoxelHSV & operator = ( const VoxelHSV & other );
80  VoxelHSV & operator = ( const uint8_t & val );
81 
82  //=== OPERATORS ========================================================
83  VoxelHSV & operator += ( const VoxelHSV & other );
84  VoxelHSV & operator -= ( const VoxelHSV & other );
85  VoxelHSV & operator += ( const uint8_t & val );
86  VoxelHSV & operator -= ( const uint8_t & val );
87  VoxelHSV & operator *= ( const uint8_t & val );
88  VoxelHSV & operator *= ( const uint16_t & val );
89  VoxelHSV & operator *= ( const uint32_t & val );
90  VoxelHSV & operator *= ( const uint64_t & val );
91  VoxelHSV & operator *= ( const float & val );
92  VoxelHSV & operator *= ( const double & val );
93  VoxelHSV & operator /= ( const uint8_t & val );
94  VoxelHSV & operator /= ( const uint16_t & val );
95  VoxelHSV & operator /= ( const uint32_t & val );
96  VoxelHSV & operator /= ( const uint64_t & val );
97  VoxelHSV & operator /= ( const float & val );
98  VoxelHSV & operator /= ( const double & val );
99  // long int are still used in volumes
100  VoxelHSV & operator *= ( const long & val );
101  VoxelHSV & operator /= ( const long & val );
102 
103  //=== ACCESSORS ========================================================
104  inline const uint8_t& hue () const { return (*this)[0]; }
105  inline const uint8_t& saturation () const { return (*this)[1]; }
106  inline const uint8_t& value () const { return (*this)[2]; }
107  inline uint8_t& hue () { return (*this)[0]; }
108  inline uint8_t& saturation () { return (*this)[1]; }
109  inline uint8_t& value () { return (*this)[2]; }
110  };
111 
112  VoxelHSV operator + (const VoxelHSV &aa, const VoxelHSV &bb);
113  VoxelHSV operator + (const VoxelHSV &aa, const uint8_t &bb);
114  VoxelHSV operator + (const uint8_t &aa, const VoxelHSV &bb);
115  VoxelHSV operator - (const VoxelHSV &aa, const VoxelHSV &bb);
116  VoxelHSV operator - (const VoxelHSV &aa, const uint8_t &bb);
117  VoxelHSV operator - (const uint8_t &aa, const VoxelHSV &bb);
118  VoxelHSV operator * (const VoxelHSV &aa, const uint8_t &bb);
119  VoxelHSV operator * (const VoxelHSV &aa, const uint16_t &bb);
120  VoxelHSV operator * (const VoxelHSV &aa, const uint32_t &bb);
121  VoxelHSV operator * (const VoxelHSV &aa, const uint64_t &bb);
122  VoxelHSV operator * (const VoxelHSV &aa, const float &bb);
123  VoxelHSV operator * (const VoxelHSV &aa, const double &bb);
124  VoxelHSV operator * (const uint8_t &aa, const VoxelHSV &bb);
125  VoxelHSV operator * (const uint16_t &aa, const VoxelHSV &bb);
126  VoxelHSV operator * (const uint32_t &aa, const VoxelHSV &bb);
127  VoxelHSV operator * (const uint64_t &aa, const VoxelHSV &bb);
128  VoxelHSV operator * (const float &aa, const VoxelHSV &bb);
129  VoxelHSV operator * (const double &aa, const VoxelHSV &bb);
130  VoxelHSV operator / (const VoxelHSV &aa, const uint8_t &bb);
131  VoxelHSV operator / (const VoxelHSV &aa, const uint16_t &bb);
132  VoxelHSV operator / (const VoxelHSV &aa, const uint32_t &bb);
133  VoxelHSV operator / (const VoxelHSV &aa, const uint64_t &bb);
134  VoxelHSV operator / (const VoxelHSV &aa, const float &bb);
135  VoxelHSV operator / (const VoxelHSV &aa, const double &bb);
136  // long int are still used in volumes
137  VoxelHSV operator * (const VoxelHSV &aa, const long &bb);
138  VoxelHSV operator * (const long &aa, const VoxelHSV &bb);
139  VoxelHSV operator / (const VoxelHSV &aa, const long &bb);
140 
141  //==========================================================================
142  // D E F I N I T I O N
143  //==========================================================================
144 
145  //=== CONSTRUCTORS =========================================================
146 
147  inline
148  VoxelHSV::VoxelHSV( const VoxelHSV &other )
149  : VoxelValue<uint8_t,3>( other )
150  {
151  #ifdef CARTO_DEBUG_RGB
152  std::cout << "HSV:: Constructor( HSV )" << std::endl;
153  #endif
154  }
155 
156  inline
158  : VoxelValue<uint8_t,3>( other )
159  {
160  #ifdef CARTO_DEBUG_RGB
161  std::cout << "HSV:: Constructor( VV<3> )" << std::endl;
162  #endif
163  }
164 
165  inline
166  VoxelHSV::VoxelHSV( const uint8_t &h, const uint8_t &s, const uint8_t &v )
167  {
168  #ifdef CARTO_DEBUG_RGB
169  std::cout << "HSV:: Constructor( h,s,v )" << std::endl;
170  #endif
171  hue() = h;
172  saturation() = s;
173  value() = v;
174  }
175 
176  inline
178  {
179  #ifdef CARTO_DEBUG_RGB
180  std::cout << "HSV:: Destructor" << std::endl;
181  #endif
182  }
183 
184  //=== AFFECTATION ==========================================================
185 
186  inline
188  {
189  #ifdef CARTO_DEBUG_RGB
190  std::cout << "HSV:: operator = ( HSV )" << std::endl;
191  #endif
192  hue() = other.hue();
193  saturation() = other.saturation();
194  value() = other.value();
195  return *this;
196  }
197 
198  inline
199  VoxelHSV & VoxelHSV::operator = ( const uint8_t & val )
200  {
201  #ifdef CARTO_DEBUG_RGB
202  std::cout << "HSV:: operator = ( uint8_t )" << std::endl;
203  #endif
204  hue() = val;
205  saturation() = val;
206  value() = val;
207  return *this;
208  }
209 
210  //=== OPERATORS ============================================================
211 
212  inline
214  {
215  #ifdef CARTO_DEBUG_RGB
216  std::cout << "HSV:: operator += ( HSV )" << std::endl;
217  #endif
218  hue() += other.hue();
219  saturation() += other.saturation();
220  value() += other.value();
221  return *this;
222  }
223 
224  inline
226  {
227  #ifdef CARTO_DEBUG_RGB
228  std::cout << "HSV:: operator -= ( HSV )" << std::endl;
229  #endif
230  hue() -= other.hue();
231  saturation() -= other.saturation();
232  value() -= other.value();
233  return *this;
234  }
235 
236  inline
237  VoxelHSV & VoxelHSV::operator += ( const uint8_t & val )
238  {
239  #ifdef CARTO_DEBUG_RGB
240  std::cout << "HSV:: operator += ( uint8_t )" << std::endl;
241  #endif
242  hue() += val;
243  saturation() += val;
244  value() += val;
245  return *this;
246  }
247 
248  inline
249  VoxelHSV & VoxelHSV::operator -= ( const uint8_t & val )
250  {
251  #ifdef CARTO_DEBUG_RGB
252  std::cout << "HSV:: operator -= ( uint8_t )" << std::endl;
253  #endif
254  hue() -= val;
255  saturation() -= val;
256  value() -= val;
257  return *this;
258  }
259 
260  inline
261  VoxelHSV & VoxelHSV::operator *= ( const uint8_t & val )
262  {
263  #ifdef CARTO_DEBUG_RGB
264  std::cout << "HSV:: operator *= ( uint8_t )" << std::endl;
265  #endif
266  hue() *= static_cast<uint8_t>( val );
267  saturation() *= static_cast<uint8_t>( val );
268  value() *= static_cast<uint8_t>( val );
269  return *this;
270  }
271 
272  inline
273  VoxelHSV & VoxelHSV::operator *= ( const uint16_t & val )
274  {
275  #ifdef CARTO_DEBUG_RGB
276  std::cout << "HSV:: operator *= ( uint16_t )" << std::endl;
277  #endif
278  hue() *= static_cast<uint8_t>( val );
279  saturation() *= static_cast<uint8_t>( val );
280  value() *= static_cast<uint8_t>( val );
281  return *this;
282  }
283 
284  inline
285  VoxelHSV & VoxelHSV::operator *= ( const uint32_t & val )
286  {
287  #ifdef CARTO_DEBUG_RGB
288  std::cout << "HSV:: operator *= ( uint32_t )" << std::endl;
289  #endif
290  hue() *= static_cast<uint8_t>( val );
291  saturation() *= static_cast<uint8_t>( val );
292  value() *= static_cast<uint8_t>( val );
293  return *this;
294  }
295 
296  inline
297  VoxelHSV & VoxelHSV::operator *= ( const uint64_t & val )
298  {
299  #ifdef CARTO_DEBUG_RGB
300  std::cout << "HSV:: operator *= ( uint64_t )" << std::endl;
301  #endif
302  hue() *= static_cast<uint8_t>( val );
303  saturation() *= static_cast<uint8_t>( val );
304  value() *= static_cast<uint8_t>( val );
305  return *this;
306  }
307 
308  inline
309  VoxelHSV & VoxelHSV::operator *= ( const float & val )
310  {
311  #ifdef CARTO_DEBUG_RGB
312  std::cout << "HSV:: operator *= ( float )" << std::endl;
313  #endif
314  hue() *= static_cast<uint8_t>( val );
315  saturation() *= static_cast<uint8_t>( val );
316  value() *= static_cast<uint8_t>( val );
317  return *this;
318  }
319 
320  inline
321  VoxelHSV & VoxelHSV::operator *= ( const double & val )
322  {
323  #ifdef CARTO_DEBUG_RGB
324  std::cout << "HSV:: operator *= ( double )" << std::endl;
325  #endif
326  hue() *= static_cast<uint8_t>( val );
327  saturation() *= static_cast<uint8_t>( val );
328  value() *= static_cast<uint8_t>( val );
329  return *this;
330  }
331 
332  inline
333  VoxelHSV & VoxelHSV::operator /= ( const uint8_t & val )
334  {
335  #ifdef CARTO_DEBUG_RGB
336  std::cout << "HSV:: operator /= ( uint8_t )" << std::endl;
337  #endif
338  ASSERT( val != 0 );
339  hue() /= static_cast<uint8_t>( val );
340  saturation() /= static_cast<uint8_t>( val );
341  value() /= static_cast<uint8_t>( val );
342  return *this;
343  }
344 
345  inline
346  VoxelHSV & VoxelHSV::operator /= ( const uint16_t & val )
347  {
348  #ifdef CARTO_DEBUG_RGB
349  std::cout << "HSV:: operator /= ( uint16_t )" << std::endl;
350  #endif
351  ASSERT( val != 0 );
352  hue() /= static_cast<uint8_t>( val );
353  saturation() /= static_cast<uint8_t>( val );
354  value() /= static_cast<uint8_t>( val );
355  return *this;
356  }
357 
358  inline
359  VoxelHSV & VoxelHSV::operator /= ( const uint32_t & val )
360  {
361  #ifdef CARTO_DEBUG_RGB
362  std::cout << "HSV:: operator /= ( uint32_t )" << std::endl;
363  #endif
364  ASSERT( val != 0 );
365  hue() /= static_cast<uint8_t>( val );
366  saturation() /= static_cast<uint8_t>( val );
367  value() /= static_cast<uint8_t>( val );
368  return *this;
369  }
370 
371  inline
372  VoxelHSV & VoxelHSV::operator /= ( const uint64_t & val )
373  {
374  #ifdef CARTO_DEBUG_RGB
375  std::cout << "HSV:: operator /= ( uint64_t )" << std::endl;
376  #endif
377  ASSERT( val != 0 );
378  hue() /= static_cast<uint8_t>( val );
379  saturation() /= static_cast<uint8_t>( val );
380  value() /= static_cast<uint8_t>( val );
381  return *this;
382  }
383 
384  inline
385  VoxelHSV & VoxelHSV::operator /= ( const float & val )
386  {
387  #ifdef CARTO_DEBUG_RGB
388  std::cout << "HSV:: operator /= ( float )" << std::endl;
389  #endif
390  ASSERT( val != 0 );
391  hue() /= static_cast<uint8_t>( val );
392  saturation() /= static_cast<uint8_t>( val );
393  value() /= static_cast<uint8_t>( val );
394  return *this;
395  }
396 
397  inline
398  VoxelHSV & VoxelHSV::operator /= ( const double & val )
399  {
400  #ifdef CARTO_DEBUG_RGB
401  std::cout << "HSV:: operator /= ( double )" << std::endl;
402  #endif
403  ASSERT( val != 0 );
404  hue() /= static_cast<uint8_t>( val );
405  saturation() /= static_cast<uint8_t>( val );
406  value() /= static_cast<uint8_t>( val );
407  return *this;
408  }
409 
410  //=== EXTERN OPERATORS =====================================================
411 
412  inline
413  VoxelHSV operator + (const VoxelHSV &aa, const VoxelHSV &bb)
414  {
415  #ifdef CARTO_DEBUG_RGB
416  std::cout << "HSV:: HSV + HSV" << std::endl;
417  #endif
418  VoxelHSV result( aa );
419  return result += bb;
420  }
421 
422  inline
423  VoxelHSV operator + (const VoxelHSV &aa, const uint8_t &bb)
424  {
425  #ifdef CARTO_DEBUG_RGB
426  std::cout << "HSV:: HSV + uint8_t" << std::endl;
427  #endif
428  VoxelHSV result( aa );
429  return result += bb;
430  }
431 
432  inline
433  VoxelHSV operator + (const VoxelHSV &aa, const uint16_t &bb)
434  {
435  #ifdef CARTO_DEBUG_RGB
436  std::cout << "HSV:: HSV + uint16_t" << std::endl;
437  #endif
438  VoxelHSV result( aa );
439  return result += bb;
440  }
441 
442  inline
443  VoxelHSV operator + (const VoxelHSV &aa, const uint32_t &bb)
444  {
445  #ifdef CARTO_DEBUG_RGB
446  std::cout << "HSV:: HSV + uint32_t" << std::endl;
447  #endif
448  VoxelHSV result( aa );
449  return result += bb;
450  }
451 
452  inline
453  VoxelHSV operator + (const VoxelHSV &aa, const uint64_t &bb)
454  {
455  #ifdef CARTO_DEBUG_RGB
456  std::cout << "HSV:: HSV + uint64_t" << std::endl;
457  #endif
458  VoxelHSV result( aa );
459  return result += bb;
460  }
461 
462  inline
463  VoxelHSV operator + (const VoxelHSV &aa, const float &bb)
464  {
465  #ifdef CARTO_DEBUG_RGB
466  std::cout << "HSV:: HSV + float" << std::endl;
467  #endif
468  VoxelHSV result( aa );
469  return result += static_cast<uint8_t>(bb);
470  }
471 
472  inline
473  VoxelHSV operator + (const VoxelHSV &aa, const double &bb)
474  {
475  #ifdef CARTO_DEBUG_RGB
476  std::cout << "HSV:: HSV + double" << std::endl;
477  #endif
478  VoxelHSV result( aa );
479  return result += static_cast<uint8_t>(bb);
480  }
481 
482  inline
483  VoxelHSV operator + (const uint8_t &aa, const VoxelHSV &bb)
484  {
485  #ifdef CARTO_DEBUG_RGB
486  std::cout << "HSV:: uint8_t + HSV" << std::endl;
487  #endif
488  VoxelHSV result( aa );
489  return result += bb;
490  }
491 
492  inline
493  VoxelHSV operator + (const uint16_t &aa, const VoxelHSV &bb)
494  {
495  #ifdef CARTO_DEBUG_RGB
496  std::cout << "HSV:: uint16_t + HSV" << std::endl;
497  #endif
498  VoxelHSV result( aa );
499  return result += bb;
500  }
501 
502  inline
503  VoxelHSV operator + (const uint32_t &aa, const VoxelHSV &bb)
504  {
505  #ifdef CARTO_DEBUG_RGB
506  std::cout << "HSV:: uint32_t + HSV" << std::endl;
507  #endif
508  VoxelHSV result( aa );
509  return result += bb;
510  }
511 
512  inline
513  VoxelHSV operator + (const uint64_t &aa, const VoxelHSV &bb)
514  {
515  #ifdef CARTO_DEBUG_RGB
516  std::cout << "HSV:: uint64_t + HSV" << std::endl;
517  #endif
518  VoxelHSV result( aa );
519  return result += bb;
520  }
521 
522  inline
523  VoxelHSV operator + (const float &aa, const VoxelHSV &bb)
524  {
525  #ifdef CARTO_DEBUG_RGB
526  std::cout << "HSV:: float + HSV" << std::endl;
527  #endif
528  VoxelHSV result( static_cast<uint8_t>(aa) );
529  return result += bb;
530  }
531 
532  inline
533  VoxelHSV operator + (const double &aa, const VoxelHSV &bb)
534  {
535  #ifdef CARTO_DEBUG_RGB
536  std::cout << "HSV:: double + HSV" << std::endl;
537  #endif
538  VoxelHSV result( static_cast<uint8_t>(aa) );
539  return result += bb;
540  }
541 
542  inline
543  VoxelHSV operator - (const VoxelHSV &aa, const VoxelHSV &bb)
544  {
545  #ifdef CARTO_DEBUG_RGB
546  std::cout << "HSV:: HSV - HSV" << std::endl;
547  #endif
548  VoxelHSV result( aa );
549  return result -= bb;
550  }
551 
552  inline
553  VoxelHSV operator - (const VoxelHSV &aa, const uint8_t &bb)
554  {
555  #ifdef CARTO_DEBUG_RGB
556  std::cout << "HSV:: HSV - uint8_t" << std::endl;
557  #endif
558  VoxelHSV result( aa );
559  return result -= bb;
560  }
561 
562  inline
563  VoxelHSV operator - (const VoxelHSV &aa, const uint16_t &bb)
564  {
565  #ifdef CARTO_DEBUG_RGB
566  std::cout << "HSV:: HSV - uint16_t" << std::endl;
567  #endif
568  VoxelHSV result( aa );
569  return result -= bb;
570  }
571 
572  inline
573  VoxelHSV operator - (const VoxelHSV &aa, const uint32_t &bb)
574  {
575  #ifdef CARTO_DEBUG_RGB
576  std::cout << "HSV:: HSV - uint32_t" << std::endl;
577  #endif
578  VoxelHSV result( aa );
579  return result -= bb;
580  }
581 
582  inline
583  VoxelHSV operator - (const VoxelHSV &aa, const uint64_t &bb)
584  {
585  #ifdef CARTO_DEBUG_RGB
586  std::cout << "HSV:: HSV - uint64_t" << std::endl;
587  #endif
588  VoxelHSV result( aa );
589  return result -= bb;
590  }
591 
592  inline
593  VoxelHSV operator - (const VoxelHSV &aa, const float &bb)
594  {
595  #ifdef CARTO_DEBUG_RGB
596  std::cout << "HSV:: HSV - float" << std::endl;
597  #endif
598  VoxelHSV result( aa );
599  return result -= static_cast<uint8_t>(bb);
600  }
601 
602  inline
603  VoxelHSV operator - (const VoxelHSV &aa, const double &bb)
604  {
605  #ifdef CARTO_DEBUG_RGB
606  std::cout << "HSV:: HSV - double" << std::endl;
607  #endif
608  VoxelHSV result( aa );
609  return result -= static_cast<uint8_t>(bb);
610  }
611 
612  inline
613  VoxelHSV operator - (const uint8_t &aa, const VoxelHSV &bb)
614  {
615  #ifdef CARTO_DEBUG_RGB
616  std::cout << "HSV:: uint8_t - HSV" << std::endl;
617  #endif
618  VoxelHSV result( aa );
619  return result -= bb;
620  }
621 
622  inline
623  VoxelHSV operator - (const uint16_t &aa, const VoxelHSV &bb)
624  {
625  #ifdef CARTO_DEBUG_RGB
626  std::cout << "HSV:: uint16_t - HSV" << std::endl;
627  #endif
628  VoxelHSV result( aa );
629  return result -= bb;
630  }
631 
632  inline
633  VoxelHSV operator - (const uint32_t &aa, const VoxelHSV &bb)
634  {
635  #ifdef CARTO_DEBUG_RGB
636  std::cout << "HSV:: uint32_t - HSV" << std::endl;
637  #endif
638  VoxelHSV result( aa );
639  return result -= bb;
640  }
641 
642  inline
643  VoxelHSV operator - (const uint64_t &aa, const VoxelHSV &bb)
644  {
645  #ifdef CARTO_DEBUG_RGB
646  std::cout << "HSV:: uint64_t - HSV" << std::endl;
647  #endif
648  VoxelHSV result( aa );
649  return result -= bb;
650  }
651 
652  inline
653  VoxelHSV operator - (const float &aa, const VoxelHSV &bb)
654  {
655  #ifdef CARTO_DEBUG_RGB
656  std::cout << "HSV:: float - HSV" << std::endl;
657  #endif
658  VoxelHSV result( static_cast<uint8_t>(aa) );
659  return result -= bb;
660  }
661 
662  inline
663  VoxelHSV operator - (const double &aa, const VoxelHSV &bb)
664  {
665  #ifdef CARTO_DEBUG_RGB
666  std::cout << "HSV:: double - HSV" << std::endl;
667  #endif
668  VoxelHSV result( static_cast<uint8_t>(aa) );
669  return result -= bb;
670  }
671 
672  inline
673  VoxelHSV operator * (const VoxelHSV &aa, const uint8_t &bb)
674  {
675  #ifdef CARTO_DEBUG_RGB
676  std::cout << "HSV:: HSV * uint8_t" << std::endl;
677  #endif
678  VoxelHSV result( aa );
679  return result *= bb;
680  }
681 
682  inline
683  VoxelHSV operator * (const VoxelHSV &aa, const uint16_t &bb)
684  {
685  #ifdef CARTO_DEBUG_RGB
686  std::cout << "HSV:: HSV * uint16_t" << std::endl;
687  #endif
688  VoxelHSV result( aa );
689  return result *= bb;
690  }
691 
692  inline
693  VoxelHSV operator * (const VoxelHSV &aa, const uint32_t &bb)
694  {
695  #ifdef CARTO_DEBUG_RGB
696  std::cout << "HSV:: HSV * uint32_t" << std::endl;
697  #endif
698  VoxelHSV result( aa );
699  return result *= bb;
700  }
701 
702  inline
703  VoxelHSV operator * (const VoxelHSV &aa, const uint64_t &bb)
704  {
705  #ifdef CARTO_DEBUG_RGB
706  std::cout << "HSV:: HSV * uint64_t" << std::endl;
707  #endif
708  VoxelHSV result( aa );
709  return result *= bb;
710  }
711 
712  inline
713  VoxelHSV operator * (const VoxelHSV &aa, const float &bb)
714  {
715  #ifdef CARTO_DEBUG_RGB
716  std::cout << "HSV:: HSV * float" << std::endl;
717  #endif
718  VoxelHSV result( aa );
719  return result *= bb;
720  }
721 
722  inline
723  VoxelHSV operator * (const VoxelHSV &aa, const double &bb)
724  {
725  #ifdef CARTO_DEBUG_RGB
726  std::cout << "HSV:: HSV * double" << std::endl;
727  #endif
728  VoxelHSV result( aa );
729  return result *= bb;
730  }
731 
732  inline
733  VoxelHSV operator * (const uint8_t &aa, const VoxelHSV &bb)
734  {
735  #ifdef CARTO_DEBUG_RGB
736  std::cout << "HSV:: uint8_t * HSV" << std::endl;
737  #endif
738  VoxelHSV result( bb );
739  return result *= aa;
740  }
741 
742  inline
743  VoxelHSV operator * (const uint16_t &aa, const VoxelHSV &bb)
744  {
745  #ifdef CARTO_DEBUG_RGB
746  std::cout << "HSV:: uint16_t * HSV" << std::endl;
747  #endif
748  VoxelHSV result( bb );
749  return result *= aa;
750  }
751 
752  inline
753  VoxelHSV operator * (const uint32_t &aa, const VoxelHSV &bb)
754  {
755  #ifdef CARTO_DEBUG_RGB
756  std::cout << "HSV:: uint32_t * HSV" << std::endl;
757  #endif
758  VoxelHSV result( bb );
759  return result *= aa;
760  }
761 
762  inline
763  VoxelHSV operator * (const uint64_t &aa, const VoxelHSV &bb)
764  {
765  #ifdef CARTO_DEBUG_RGB
766  std::cout << "HSV:: uint64_t * HSV" << std::endl;
767  #endif
768  VoxelHSV result( bb );
769  return result *= aa;
770  }
771 
772  inline
773  VoxelHSV operator * (const float &aa, const VoxelHSV &bb)
774  {
775  #ifdef CARTO_DEBUG_RGB
776  std::cout << "HSV:: float * HSV" << std::endl;
777  #endif
778  VoxelHSV result( bb );
779  return result *= aa;
780  }
781 
782  inline
783  VoxelHSV operator * (const double &aa, const VoxelHSV &bb)
784  {
785  #ifdef CARTO_DEBUG_RGB
786  std::cout << "HSV:: double * HSV" << std::endl;
787  #endif
788  VoxelHSV result( bb );
789  return result *= aa;
790  }
791 
792  inline
793  VoxelHSV operator / (const VoxelHSV &aa, const uint8_t &bb)
794  {
795  #ifdef CARTO_DEBUG_RGB
796  std::cout << "HSV:: HSV / uint8_t" << std::endl;
797  #endif
798  VoxelHSV result( aa );
799  return result /= bb;
800  }
801 
802  inline
803  VoxelHSV operator / (const VoxelHSV &aa, const uint16_t &bb)
804  {
805  #ifdef CARTO_DEBUG_RGB
806  std::cout << "HSV:: HSV / uint16_t" << std::endl;
807  #endif
808  VoxelHSV result( aa );
809  return result /= bb;
810  }
811 
812  inline
813  VoxelHSV operator / (const VoxelHSV &aa, const uint32_t &bb)
814  {
815  #ifdef CARTO_DEBUG_RGB
816  std::cout << "HSV:: HSV / uint32_t" << std::endl;
817  #endif
818  VoxelHSV result( aa );
819  return result /= bb;
820  }
821 
822  inline
823  VoxelHSV operator / (const VoxelHSV &aa, const uint64_t &bb)
824  {
825  #ifdef CARTO_DEBUG_RGB
826  std::cout << "HSV:: HSV / uint64_t" << std::endl;
827  #endif
828  VoxelHSV result( aa );
829  return result /= bb;
830  }
831 
832  inline
833  VoxelHSV operator / (const VoxelHSV &aa, const float &bb)
834  {
835  #ifdef CARTO_DEBUG_RGB
836  std::cout << "HSV:: HSV / float" << std::endl;
837  #endif
838  VoxelHSV result( aa );
839  return result /= bb;
840  }
841 
842  inline
843  VoxelHSV operator / (const VoxelHSV &aa, const double &bb)
844  {
845  #ifdef CARTO_DEBUG_RGB
846  std::cout << "HSV:: HSV / double" << std::endl;
847  #endif
848  VoxelHSV result( aa );
849  return result /= bb;
850  }
851 
852  //=== LONG INT OPERATORS ===================================================
853 
854  inline
855  VoxelHSV & VoxelHSV::operator *= ( const long & val )
856  {
857  #ifdef CARTO_DEBUG_RGB
858  std::cout << "HSV:: operator *= ( long )" << std::endl;
859  #endif
860  hue() *= static_cast<uint8_t>( val );
861  saturation() *= static_cast<uint8_t>( val );
862  value() *= static_cast<uint8_t>( val );
863  return *this;
864  }
865 
866  inline
867  VoxelHSV & VoxelHSV::operator /= ( const long & val )
868  {
869  #ifdef CARTO_DEBUG_RGB
870  std::cout << "HSV:: operator /= ( long )" << std::endl;
871  #endif
872  ASSERT( val != 0 );
873  hue() /= static_cast<uint8_t>( val );
874  saturation() /= static_cast<uint8_t>( val );
875  value() /= static_cast<uint8_t>( val );
876  return *this;
877  }
878 
879  inline
880  VoxelHSV operator * (const VoxelHSV &aa, const long &bb)
881  {
882  #ifdef CARTO_DEBUG_RGB
883  std::cout << "HSV:: HSV * long" << std::endl;
884  #endif
885  VoxelHSV result( aa );
886  return result *= bb;
887  }
888 
889  inline
890  VoxelHSV operator * (const long &aa, const VoxelHSV &bb)
891  {
892  #ifdef CARTO_DEBUG_RGB
893  std::cout << "HSV:: long * HSV" << std::endl;
894  #endif
895  VoxelHSV result( bb );
896  return result *= aa;
897  }
898 
899  inline
900  VoxelHSV operator / (const VoxelHSV &aa, const long &bb)
901  {
902  #ifdef CARTO_DEBUG_RGB
903  std::cout << "HSV:: HSV / long" << std::endl;
904  #endif
905  VoxelHSV result( aa );
906  return result /= bb;
907  }
908 
909 }
910 
911 #endif
VoxelHSV & operator=(const VoxelHSV &other)
Definition: voxelhsv.h:187
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:757
VoxelHSV & operator*=(const uint8_t &val)
Definition: voxelhsv.h:261
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:377
uint8_t & hue()
Definition: voxelhsv.h:107
Base class for any multichannel data (RGB, RGBA, HSV, ...)
Definition: voxelvalue.h:58
HSV Value.
Definition: voxelhsv.h:67
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
Definition: voxelrgb_def.h:637
uint8_t & value()
Definition: voxelhsv.h:109
VoxelHSV & operator+=(const VoxelHSV &other)
Definition: voxelhsv.h:213
VoxelHSV & operator-=(const VoxelHSV &other)
Definition: voxelhsv.h:225
const uint8_t & hue() const
Definition: voxelhsv.h:104
const uint8_t & value() const
Definition: voxelhsv.h:106
VoxelHSV & operator/=(const uint8_t &val)
Definition: voxelhsv.h:333
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
Definition: voxelrgb_def.h:507
static std::string dataType()
Definition: types.h:230
uint8_t & saturation()
Definition: voxelhsv.h:108
const uint8_t & saturation() const
Definition: voxelhsv.h:105
VoxelHSV(const VoxelHSV &other)
Definition: voxelhsv.h:148
#define ASSERT(EX)
Definition: assert.h:81