cartobase 6.0.6
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 --------------------------------------------------------------
40//--- system -----------------------------------------------------------------
41//#define CARTO_DEBUG_RGB
42#ifdef CARTO_DEBUG_RGB
43 #include <iostream>
44#endif
45//----------------------------------------------------------------------------
46
47namespace 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 template <>
143 {
144 static inline bool less( const carto::VoxelHSV & lhs, const carto::VoxelHSV & rhs );
145 };
146
147 //==========================================================================
148 // D E F I N I T I O N
149 //==========================================================================
150
151 //=== CONSTRUCTORS =========================================================
152
153 inline
155 : VoxelValue<uint8_t,3>( other )
156 {
157 #ifdef CARTO_DEBUG_RGB
158 std::cout << "HSV:: Constructor( HSV )" << std::endl;
159 #endif
160 }
161
162 inline
164 : VoxelValue<uint8_t,3>( other )
165 {
166 #ifdef CARTO_DEBUG_RGB
167 std::cout << "HSV:: Constructor( VV<3> )" << std::endl;
168 #endif
169 }
170
171 inline
172 VoxelHSV::VoxelHSV( const uint8_t &h, const uint8_t &s, const uint8_t &v )
173 {
174 #ifdef CARTO_DEBUG_RGB
175 std::cout << "HSV:: Constructor( h,s,v )" << std::endl;
176 #endif
177 hue() = h;
178 saturation() = s;
179 value() = v;
180 }
181
182 inline
184 {
185 #ifdef CARTO_DEBUG_RGB
186 std::cout << "HSV:: Destructor" << std::endl;
187 #endif
188 }
189
190 //=== AFFECTATION ==========================================================
191
192 inline
194 {
195 #ifdef CARTO_DEBUG_RGB
196 std::cout << "HSV:: operator = ( HSV )" << std::endl;
197 #endif
198 hue() = other.hue();
199 saturation() = other.saturation();
200 value() = other.value();
201 return *this;
202 }
203
204 inline
205 VoxelHSV & VoxelHSV::operator = ( const uint8_t & val )
206 {
207 #ifdef CARTO_DEBUG_RGB
208 std::cout << "HSV:: operator = ( uint8_t )" << std::endl;
209 #endif
210 hue() = val;
211 saturation() = val;
212 value() = val;
213 return *this;
214 }
215
216 //=== OPERATORS ============================================================
217
218 inline
220 {
221 #ifdef CARTO_DEBUG_RGB
222 std::cout << "HSV:: operator += ( HSV )" << std::endl;
223 #endif
224 hue() += other.hue();
225 saturation() += other.saturation();
226 value() += other.value();
227 return *this;
228 }
229
230 inline
232 {
233 #ifdef CARTO_DEBUG_RGB
234 std::cout << "HSV:: operator -= ( HSV )" << std::endl;
235 #endif
236 hue() -= other.hue();
237 saturation() -= other.saturation();
238 value() -= other.value();
239 return *this;
240 }
241
242 inline
243 VoxelHSV & VoxelHSV::operator += ( const uint8_t & val )
244 {
245 #ifdef CARTO_DEBUG_RGB
246 std::cout << "HSV:: operator += ( uint8_t )" << std::endl;
247 #endif
248 hue() += val;
249 saturation() += val;
250 value() += val;
251 return *this;
252 }
253
254 inline
255 VoxelHSV & VoxelHSV::operator -= ( const uint8_t & val )
256 {
257 #ifdef CARTO_DEBUG_RGB
258 std::cout << "HSV:: operator -= ( uint8_t )" << std::endl;
259 #endif
260 hue() -= val;
261 saturation() -= val;
262 value() -= val;
263 return *this;
264 }
265
266 inline
267 VoxelHSV & VoxelHSV::operator *= ( const uint8_t & val )
268 {
269 #ifdef CARTO_DEBUG_RGB
270 std::cout << "HSV:: operator *= ( uint8_t )" << std::endl;
271 #endif
272 hue() *= static_cast<uint8_t>( val );
273 saturation() *= static_cast<uint8_t>( val );
274 value() *= static_cast<uint8_t>( val );
275 return *this;
276 }
277
278 inline
279 VoxelHSV & VoxelHSV::operator *= ( const uint16_t & val )
280 {
281 #ifdef CARTO_DEBUG_RGB
282 std::cout << "HSV:: operator *= ( uint16_t )" << std::endl;
283 #endif
284 hue() *= static_cast<uint8_t>( val );
285 saturation() *= static_cast<uint8_t>( val );
286 value() *= static_cast<uint8_t>( val );
287 return *this;
288 }
289
290 inline
291 VoxelHSV & VoxelHSV::operator *= ( const uint32_t & val )
292 {
293 #ifdef CARTO_DEBUG_RGB
294 std::cout << "HSV:: operator *= ( uint32_t )" << std::endl;
295 #endif
296 hue() *= static_cast<uint8_t>( val );
297 saturation() *= static_cast<uint8_t>( val );
298 value() *= static_cast<uint8_t>( val );
299 return *this;
300 }
301
302 inline
303 VoxelHSV & VoxelHSV::operator *= ( const uint64_t & val )
304 {
305 #ifdef CARTO_DEBUG_RGB
306 std::cout << "HSV:: operator *= ( uint64_t )" << std::endl;
307 #endif
308 hue() *= static_cast<uint8_t>( val );
309 saturation() *= static_cast<uint8_t>( val );
310 value() *= static_cast<uint8_t>( val );
311 return *this;
312 }
313
314 inline
315 VoxelHSV & VoxelHSV::operator *= ( const float & val )
316 {
317 #ifdef CARTO_DEBUG_RGB
318 std::cout << "HSV:: operator *= ( float )" << std::endl;
319 #endif
320 hue() *= static_cast<uint8_t>( val );
321 saturation() *= static_cast<uint8_t>( val );
322 value() *= static_cast<uint8_t>( val );
323 return *this;
324 }
325
326 inline
327 VoxelHSV & VoxelHSV::operator *= ( const double & val )
328 {
329 #ifdef CARTO_DEBUG_RGB
330 std::cout << "HSV:: operator *= ( double )" << std::endl;
331 #endif
332 hue() *= static_cast<uint8_t>( val );
333 saturation() *= static_cast<uint8_t>( val );
334 value() *= static_cast<uint8_t>( val );
335 return *this;
336 }
337
338 inline
339 VoxelHSV & VoxelHSV::operator /= ( const uint8_t & val )
340 {
341 #ifdef CARTO_DEBUG_RGB
342 std::cout << "HSV:: operator /= ( uint8_t )" << std::endl;
343 #endif
344 ASSERT( val != 0 );
345 hue() /= static_cast<uint8_t>( val );
346 saturation() /= static_cast<uint8_t>( val );
347 value() /= static_cast<uint8_t>( val );
348 return *this;
349 }
350
351 inline
352 VoxelHSV & VoxelHSV::operator /= ( const uint16_t & val )
353 {
354 #ifdef CARTO_DEBUG_RGB
355 std::cout << "HSV:: operator /= ( uint16_t )" << std::endl;
356 #endif
357 ASSERT( val != 0 );
358 hue() /= static_cast<uint8_t>( val );
359 saturation() /= static_cast<uint8_t>( val );
360 value() /= static_cast<uint8_t>( val );
361 return *this;
362 }
363
364 inline
365 VoxelHSV & VoxelHSV::operator /= ( const uint32_t & val )
366 {
367 #ifdef CARTO_DEBUG_RGB
368 std::cout << "HSV:: operator /= ( uint32_t )" << std::endl;
369 #endif
370 ASSERT( val != 0 );
371 hue() /= static_cast<uint8_t>( val );
372 saturation() /= static_cast<uint8_t>( val );
373 value() /= static_cast<uint8_t>( val );
374 return *this;
375 }
376
377 inline
378 VoxelHSV & VoxelHSV::operator /= ( const uint64_t & val )
379 {
380 #ifdef CARTO_DEBUG_RGB
381 std::cout << "HSV:: operator /= ( uint64_t )" << std::endl;
382 #endif
383 ASSERT( val != 0 );
384 hue() /= static_cast<uint8_t>( val );
385 saturation() /= static_cast<uint8_t>( val );
386 value() /= static_cast<uint8_t>( val );
387 return *this;
388 }
389
390 inline
391 VoxelHSV & VoxelHSV::operator /= ( const float & val )
392 {
393 #ifdef CARTO_DEBUG_RGB
394 std::cout << "HSV:: operator /= ( float )" << std::endl;
395 #endif
396 ASSERT( val != 0 );
397 hue() /= static_cast<uint8_t>( val );
398 saturation() /= static_cast<uint8_t>( val );
399 value() /= static_cast<uint8_t>( val );
400 return *this;
401 }
402
403 inline
404 VoxelHSV & VoxelHSV::operator /= ( const double & val )
405 {
406 #ifdef CARTO_DEBUG_RGB
407 std::cout << "HSV:: operator /= ( double )" << std::endl;
408 #endif
409 ASSERT( val != 0 );
410 hue() /= static_cast<uint8_t>( val );
411 saturation() /= static_cast<uint8_t>( val );
412 value() /= static_cast<uint8_t>( val );
413 return *this;
414 }
415
416 //=== EXTERN OPERATORS =====================================================
417
418 inline
419 VoxelHSV operator + (const VoxelHSV &aa, const VoxelHSV &bb)
420 {
421 #ifdef CARTO_DEBUG_RGB
422 std::cout << "HSV:: HSV + HSV" << std::endl;
423 #endif
424 VoxelHSV result( aa );
425 return result += bb;
426 }
427
428 inline
429 VoxelHSV operator + (const VoxelHSV &aa, const uint8_t &bb)
430 {
431 #ifdef CARTO_DEBUG_RGB
432 std::cout << "HSV:: HSV + uint8_t" << std::endl;
433 #endif
434 VoxelHSV result( aa );
435 return result += bb;
436 }
437
438 inline
439 VoxelHSV operator + (const VoxelHSV &aa, const uint16_t &bb)
440 {
441 #ifdef CARTO_DEBUG_RGB
442 std::cout << "HSV:: HSV + uint16_t" << std::endl;
443 #endif
444 VoxelHSV result( aa );
445 return result += bb;
446 }
447
448 inline
449 VoxelHSV operator + (const VoxelHSV &aa, const uint32_t &bb)
450 {
451 #ifdef CARTO_DEBUG_RGB
452 std::cout << "HSV:: HSV + uint32_t" << std::endl;
453 #endif
454 VoxelHSV result( aa );
455 return result += bb;
456 }
457
458 inline
459 VoxelHSV operator + (const VoxelHSV &aa, const uint64_t &bb)
460 {
461 #ifdef CARTO_DEBUG_RGB
462 std::cout << "HSV:: HSV + uint64_t" << std::endl;
463 #endif
464 VoxelHSV result( aa );
465 return result += bb;
466 }
467
468 inline
469 VoxelHSV operator + (const VoxelHSV &aa, const float &bb)
470 {
471 #ifdef CARTO_DEBUG_RGB
472 std::cout << "HSV:: HSV + float" << std::endl;
473 #endif
474 VoxelHSV result( aa );
475 return result += static_cast<uint8_t>(bb);
476 }
477
478 inline
479 VoxelHSV operator + (const VoxelHSV &aa, const double &bb)
480 {
481 #ifdef CARTO_DEBUG_RGB
482 std::cout << "HSV:: HSV + double" << std::endl;
483 #endif
484 VoxelHSV result( aa );
485 return result += static_cast<uint8_t>(bb);
486 }
487
488 inline
489 VoxelHSV operator + (const uint8_t &aa, const VoxelHSV &bb)
490 {
491 #ifdef CARTO_DEBUG_RGB
492 std::cout << "HSV:: uint8_t + HSV" << std::endl;
493 #endif
494 VoxelHSV result( aa );
495 return result += bb;
496 }
497
498 inline
499 VoxelHSV operator + (const uint16_t &aa, const VoxelHSV &bb)
500 {
501 #ifdef CARTO_DEBUG_RGB
502 std::cout << "HSV:: uint16_t + HSV" << std::endl;
503 #endif
504 VoxelHSV result( aa );
505 return result += bb;
506 }
507
508 inline
509 VoxelHSV operator + (const uint32_t &aa, const VoxelHSV &bb)
510 {
511 #ifdef CARTO_DEBUG_RGB
512 std::cout << "HSV:: uint32_t + HSV" << std::endl;
513 #endif
514 VoxelHSV result( aa );
515 return result += bb;
516 }
517
518 inline
519 VoxelHSV operator + (const uint64_t &aa, const VoxelHSV &bb)
520 {
521 #ifdef CARTO_DEBUG_RGB
522 std::cout << "HSV:: uint64_t + HSV" << std::endl;
523 #endif
524 VoxelHSV result( aa );
525 return result += bb;
526 }
527
528 inline
529 VoxelHSV operator + (const float &aa, const VoxelHSV &bb)
530 {
531 #ifdef CARTO_DEBUG_RGB
532 std::cout << "HSV:: float + HSV" << std::endl;
533 #endif
534 VoxelHSV result( static_cast<uint8_t>(aa) );
535 return result += bb;
536 }
537
538 inline
539 VoxelHSV operator + (const double &aa, const VoxelHSV &bb)
540 {
541 #ifdef CARTO_DEBUG_RGB
542 std::cout << "HSV:: double + HSV" << std::endl;
543 #endif
544 VoxelHSV result( static_cast<uint8_t>(aa) );
545 return result += bb;
546 }
547
548 inline
549 VoxelHSV operator - (const VoxelHSV &aa, const VoxelHSV &bb)
550 {
551 #ifdef CARTO_DEBUG_RGB
552 std::cout << "HSV:: HSV - HSV" << std::endl;
553 #endif
554 VoxelHSV result( aa );
555 return result -= bb;
556 }
557
558 inline
559 VoxelHSV operator - (const VoxelHSV &aa, const uint8_t &bb)
560 {
561 #ifdef CARTO_DEBUG_RGB
562 std::cout << "HSV:: HSV - uint8_t" << std::endl;
563 #endif
564 VoxelHSV result( aa );
565 return result -= bb;
566 }
567
568 inline
569 VoxelHSV operator - (const VoxelHSV &aa, const uint16_t &bb)
570 {
571 #ifdef CARTO_DEBUG_RGB
572 std::cout << "HSV:: HSV - uint16_t" << std::endl;
573 #endif
574 VoxelHSV result( aa );
575 return result -= bb;
576 }
577
578 inline
579 VoxelHSV operator - (const VoxelHSV &aa, const uint32_t &bb)
580 {
581 #ifdef CARTO_DEBUG_RGB
582 std::cout << "HSV:: HSV - uint32_t" << std::endl;
583 #endif
584 VoxelHSV result( aa );
585 return result -= bb;
586 }
587
588 inline
589 VoxelHSV operator - (const VoxelHSV &aa, const uint64_t &bb)
590 {
591 #ifdef CARTO_DEBUG_RGB
592 std::cout << "HSV:: HSV - uint64_t" << std::endl;
593 #endif
594 VoxelHSV result( aa );
595 return result -= bb;
596 }
597
598 inline
599 VoxelHSV operator - (const VoxelHSV &aa, const float &bb)
600 {
601 #ifdef CARTO_DEBUG_RGB
602 std::cout << "HSV:: HSV - float" << std::endl;
603 #endif
604 VoxelHSV result( aa );
605 return result -= static_cast<uint8_t>(bb);
606 }
607
608 inline
609 VoxelHSV operator - (const VoxelHSV &aa, const double &bb)
610 {
611 #ifdef CARTO_DEBUG_RGB
612 std::cout << "HSV:: HSV - double" << std::endl;
613 #endif
614 VoxelHSV result( aa );
615 return result -= static_cast<uint8_t>(bb);
616 }
617
618 inline
619 VoxelHSV operator - (const uint8_t &aa, const VoxelHSV &bb)
620 {
621 #ifdef CARTO_DEBUG_RGB
622 std::cout << "HSV:: uint8_t - HSV" << std::endl;
623 #endif
624 VoxelHSV result( aa );
625 return result -= bb;
626 }
627
628 inline
629 VoxelHSV operator - (const uint16_t &aa, const VoxelHSV &bb)
630 {
631 #ifdef CARTO_DEBUG_RGB
632 std::cout << "HSV:: uint16_t - HSV" << std::endl;
633 #endif
634 VoxelHSV result( aa );
635 return result -= bb;
636 }
637
638 inline
639 VoxelHSV operator - (const uint32_t &aa, const VoxelHSV &bb)
640 {
641 #ifdef CARTO_DEBUG_RGB
642 std::cout << "HSV:: uint32_t - HSV" << std::endl;
643 #endif
644 VoxelHSV result( aa );
645 return result -= bb;
646 }
647
648 inline
649 VoxelHSV operator - (const uint64_t &aa, const VoxelHSV &bb)
650 {
651 #ifdef CARTO_DEBUG_RGB
652 std::cout << "HSV:: uint64_t - HSV" << std::endl;
653 #endif
654 VoxelHSV result( aa );
655 return result -= bb;
656 }
657
658 inline
659 VoxelHSV operator - (const float &aa, const VoxelHSV &bb)
660 {
661 #ifdef CARTO_DEBUG_RGB
662 std::cout << "HSV:: float - HSV" << std::endl;
663 #endif
664 VoxelHSV result( static_cast<uint8_t>(aa) );
665 return result -= bb;
666 }
667
668 inline
669 VoxelHSV operator - (const double &aa, const VoxelHSV &bb)
670 {
671 #ifdef CARTO_DEBUG_RGB
672 std::cout << "HSV:: double - HSV" << std::endl;
673 #endif
674 VoxelHSV result( static_cast<uint8_t>(aa) );
675 return result -= bb;
676 }
677
678 inline
679 VoxelHSV operator * (const VoxelHSV &aa, const uint8_t &bb)
680 {
681 #ifdef CARTO_DEBUG_RGB
682 std::cout << "HSV:: HSV * uint8_t" << std::endl;
683 #endif
684 VoxelHSV result( aa );
685 return result *= bb;
686 }
687
688 inline
689 VoxelHSV operator * (const VoxelHSV &aa, const uint16_t &bb)
690 {
691 #ifdef CARTO_DEBUG_RGB
692 std::cout << "HSV:: HSV * uint16_t" << std::endl;
693 #endif
694 VoxelHSV result( aa );
695 return result *= bb;
696 }
697
698 inline
699 VoxelHSV operator * (const VoxelHSV &aa, const uint32_t &bb)
700 {
701 #ifdef CARTO_DEBUG_RGB
702 std::cout << "HSV:: HSV * uint32_t" << std::endl;
703 #endif
704 VoxelHSV result( aa );
705 return result *= bb;
706 }
707
708 inline
709 VoxelHSV operator * (const VoxelHSV &aa, const uint64_t &bb)
710 {
711 #ifdef CARTO_DEBUG_RGB
712 std::cout << "HSV:: HSV * uint64_t" << std::endl;
713 #endif
714 VoxelHSV result( aa );
715 return result *= bb;
716 }
717
718 inline
719 VoxelHSV operator * (const VoxelHSV &aa, const float &bb)
720 {
721 #ifdef CARTO_DEBUG_RGB
722 std::cout << "HSV:: HSV * float" << std::endl;
723 #endif
724 VoxelHSV result( aa );
725 return result *= bb;
726 }
727
728 inline
729 VoxelHSV operator * (const VoxelHSV &aa, const double &bb)
730 {
731 #ifdef CARTO_DEBUG_RGB
732 std::cout << "HSV:: HSV * double" << std::endl;
733 #endif
734 VoxelHSV result( aa );
735 return result *= bb;
736 }
737
738 inline
739 VoxelHSV operator * (const uint8_t &aa, const VoxelHSV &bb)
740 {
741 #ifdef CARTO_DEBUG_RGB
742 std::cout << "HSV:: uint8_t * HSV" << std::endl;
743 #endif
744 VoxelHSV result( bb );
745 return result *= aa;
746 }
747
748 inline
749 VoxelHSV operator * (const uint16_t &aa, const VoxelHSV &bb)
750 {
751 #ifdef CARTO_DEBUG_RGB
752 std::cout << "HSV:: uint16_t * HSV" << std::endl;
753 #endif
754 VoxelHSV result( bb );
755 return result *= aa;
756 }
757
758 inline
759 VoxelHSV operator * (const uint32_t &aa, const VoxelHSV &bb)
760 {
761 #ifdef CARTO_DEBUG_RGB
762 std::cout << "HSV:: uint32_t * HSV" << std::endl;
763 #endif
764 VoxelHSV result( bb );
765 return result *= aa;
766 }
767
768 inline
769 VoxelHSV operator * (const uint64_t &aa, const VoxelHSV &bb)
770 {
771 #ifdef CARTO_DEBUG_RGB
772 std::cout << "HSV:: uint64_t * HSV" << std::endl;
773 #endif
774 VoxelHSV result( bb );
775 return result *= aa;
776 }
777
778 inline
779 VoxelHSV operator * (const float &aa, const VoxelHSV &bb)
780 {
781 #ifdef CARTO_DEBUG_RGB
782 std::cout << "HSV:: float * HSV" << std::endl;
783 #endif
784 VoxelHSV result( bb );
785 return result *= aa;
786 }
787
788 inline
789 VoxelHSV operator * (const double &aa, const VoxelHSV &bb)
790 {
791 #ifdef CARTO_DEBUG_RGB
792 std::cout << "HSV:: double * HSV" << std::endl;
793 #endif
794 VoxelHSV result( bb );
795 return result *= aa;
796 }
797
798 inline
799 VoxelHSV operator / (const VoxelHSV &aa, const uint8_t &bb)
800 {
801 #ifdef CARTO_DEBUG_RGB
802 std::cout << "HSV:: HSV / uint8_t" << std::endl;
803 #endif
804 VoxelHSV result( aa );
805 return result /= bb;
806 }
807
808 inline
809 VoxelHSV operator / (const VoxelHSV &aa, const uint16_t &bb)
810 {
811 #ifdef CARTO_DEBUG_RGB
812 std::cout << "HSV:: HSV / uint16_t" << std::endl;
813 #endif
814 VoxelHSV result( aa );
815 return result /= bb;
816 }
817
818 inline
819 VoxelHSV operator / (const VoxelHSV &aa, const uint32_t &bb)
820 {
821 #ifdef CARTO_DEBUG_RGB
822 std::cout << "HSV:: HSV / uint32_t" << std::endl;
823 #endif
824 VoxelHSV result( aa );
825 return result /= bb;
826 }
827
828 inline
829 VoxelHSV operator / (const VoxelHSV &aa, const uint64_t &bb)
830 {
831 #ifdef CARTO_DEBUG_RGB
832 std::cout << "HSV:: HSV / uint64_t" << std::endl;
833 #endif
834 VoxelHSV result( aa );
835 return result /= bb;
836 }
837
838 inline
839 VoxelHSV operator / (const VoxelHSV &aa, const float &bb)
840 {
841 #ifdef CARTO_DEBUG_RGB
842 std::cout << "HSV:: HSV / float" << std::endl;
843 #endif
844 VoxelHSV result( aa );
845 return result /= bb;
846 }
847
848 inline
849 VoxelHSV operator / (const VoxelHSV &aa, const double &bb)
850 {
851 #ifdef CARTO_DEBUG_RGB
852 std::cout << "HSV:: HSV / double" << std::endl;
853 #endif
854 VoxelHSV result( aa );
855 return result /= bb;
856 }
857
858 //=== LONG INT OPERATORS ===================================================
859
860 inline
861 VoxelHSV & VoxelHSV::operator *= ( const long & val )
862 {
863 #ifdef CARTO_DEBUG_RGB
864 std::cout << "HSV:: operator *= ( long )" << std::endl;
865 #endif
866 hue() *= static_cast<uint8_t>( val );
867 saturation() *= static_cast<uint8_t>( val );
868 value() *= static_cast<uint8_t>( val );
869 return *this;
870 }
871
872 inline
873 VoxelHSV & VoxelHSV::operator /= ( const long & val )
874 {
875 #ifdef CARTO_DEBUG_RGB
876 std::cout << "HSV:: operator /= ( long )" << std::endl;
877 #endif
878 ASSERT( val != 0 );
879 hue() /= static_cast<uint8_t>( val );
880 saturation() /= static_cast<uint8_t>( val );
881 value() /= static_cast<uint8_t>( val );
882 return *this;
883 }
884
885 inline
886 VoxelHSV operator * (const VoxelHSV &aa, const long &bb)
887 {
888 #ifdef CARTO_DEBUG_RGB
889 std::cout << "HSV:: HSV * long" << std::endl;
890 #endif
891 VoxelHSV result( aa );
892 return result *= bb;
893 }
894
895 inline
896 VoxelHSV operator * (const long &aa, const VoxelHSV &bb)
897 {
898 #ifdef CARTO_DEBUG_RGB
899 std::cout << "HSV:: long * HSV" << std::endl;
900 #endif
901 VoxelHSV result( bb );
902 return result *= aa;
903 }
904
905 inline
906 VoxelHSV operator / (const VoxelHSV &aa, const long &bb)
907 {
908 #ifdef CARTO_DEBUG_RGB
909 std::cout << "HSV:: HSV / long" << std::endl;
910 #endif
911 VoxelHSV result( aa );
912 return result /= bb;
913 }
914
915 // KeyComparator VoxelHSV specialization
916 inline
918 {
919 #ifdef CARTO_DEBUG_RGB
920 std::cout << "HSV:: KeyComparator less()" << std::endl;
921 #endif
923 }
924
925}
926
927#endif
#define ASSERT(EX)
Definition assert.h:81
static std::string dataType()
Definition types.h:230
HSV Value.
Definition voxelhsv.h:68
uint8_t & saturation()
Definition voxelhsv.h:108
VoxelHSV & operator=(const VoxelHSV &other)
Definition voxelhsv.h:193
const uint8_t & saturation() const
Definition voxelhsv.h:105
VoxelHSV & operator/=(const uint8_t &val)
Definition voxelhsv.h:339
VoxelHSV & operator+=(const VoxelHSV &other)
Definition voxelhsv.h:219
const uint8_t & value() const
Definition voxelhsv.h:106
const uint8_t & hue() const
Definition voxelhsv.h:104
VoxelHSV & operator-=(const VoxelHSV &other)
Definition voxelhsv.h:231
VoxelHSV & operator*=(const uint8_t &val)
Definition voxelhsv.h:267
uint8_t & hue()
Definition voxelhsv.h:107
uint8_t & value()
Definition voxelhsv.h:109
VoxelHSV(const VoxelHSV &other)
Definition voxelhsv.h:154
VoxelRGB operator/(const VoxelRGB &aa, const uint8_t &bb)
VoxelRGB operator+(const VoxelRGB &aa, const VoxelRGB &bb)
VoxelRGB operator-(const VoxelRGB &aa, const VoxelRGB &bb)
VoxelRGB operator*(const VoxelRGB &aa, const uint8_t &bb)
static bool less(const carto::VoxelHSV &lhs, const carto::VoxelHSV &rhs)
Definition voxelhsv.h:917
KeyComparator is used to compare keys of types that do not have comparison operator.
Definition voxelvalue.h:108
static bool less(const V &lhs, const V &rhs)