HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Color3< T > Class Template Reference

#include <ImathColor.h>

+ Inheritance diagram for Color3< T >:

Public Member Functions

 Color3 ()=default
 
 Color3 (float r, float g, float b)
 
Color3 linearToSrgb () const
 
Color3 srgbToLinear () const
 
Constructors and Assignemt
IMATH_HOSTDEVICE Color3 () IMATH_NOEXCEPT
 No initialization by default. More...
 
IMATH_HOSTDEVICE constexpr Color3 (T a) IMATH_NOEXCEPT
 Initialize to (a a a) More...
 
IMATH_HOSTDEVICE constexpr Color3 (T a, T b, T c) IMATH_NOEXCEPT
 Initialize to (a b c) More...
 
IMATH_HOSTDEVICE constexpr Color3 (const Color3 &c) IMATH_NOEXCEPT
 Construct from Color3. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr Color3 (const Vec3< S > &v) IMATH_NOEXCEPT
 Construct from Vec3. More...
 
IMATH_HOSTDEVICE ~Color3 ()=default
 Destructor. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator= (const Color3 &c) IMATH_NOEXCEPT
 Component-wise assignment. More...
 
Arithmetic
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator+= (const Color3 &c) IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator+ (const Color3 &c) const IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator-= (const Color3 &c) IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator- (const Color3 &c) const IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator- () const IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
negate () IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator*= (const Color3 &c) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator*= (T a) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator* (const Color3 &c) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator* (T a) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator/= (const Color3 &c) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Color3
operator/= (T a) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator/ (const Color3 &c) const IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Color3 operator/ (T a) const IMATH_NOEXCEPT
 Component-wise division. More...
 
- Public Member Functions inherited from VectorN< Color3, float, 3 >
 VectorN ()
 
 VectorN (Uninit)
 
 VectorN (floats)
 
 VectorN (const std::array< float, N > &arr)
 
 VectorN (const vector< float > &vec)
 
 VectorN (const float *begin, const float *end)
 
bool operator== (const Color3 &rhs) const
 Return true if the given vector is identical to this one. More...
 
bool operator!= (const Color3 &rhs) const
 Return true if the given vector differs from this one. More...
 
bool operator< (const Color3 &rhs) const
 Compare two vectors lexicographically. More...
 
floatoperator[] (size_t i)
 Return the scalar value at the given index. More...
 
const floatoperator[] (size_t i) const
 Return the const scalar value at the given index. More...
 
Color3 operator+ (const Color3 &rhs) const
 Component-wise addition of two vectors. More...
 
VectorNoperator+= (const Color3 &rhs)
 Component-wise addition of two vectors. More...
 
Color3 operator- (const Color3 &rhs) const
 Component-wise subtraction of two vectors. More...
 
Color3 operator- () const
 Unary negation of a vector. More...
 
VectorNoperator-= (const Color3 &rhs)
 Component-wise subtraction of two vectors. More...
 
Color3 operator* (const Color3 &rhs) const
 Component-wise multiplication of two vectors. More...
 
Color3 operator* (floats) const
 Component-wise multiplication of a vector by a scalar. More...
 
VectorNoperator*= (const Color3 &rhs)
 Component-wise multiplication of two vectors. More...
 
VectorNoperator*= (floats)
 Component-wise multiplication of a vector by a scalar. More...
 
Color3 operator/ (const Color3 &rhs) const
 Component-wise division of two vectors. More...
 
Color3 operator/ (floats) const
 Component-wise division of a vector by a scalar. More...
 
VectorNoperator/= (const Color3 &rhs)
 Component-wise division of two vectors. More...
 
VectorNoperator/= (floats)
 Component-wise division of a vector by a scalar. More...
 
float getMagnitude () const
 Return the magnitude of the vector. More...
 
Color3 getNormalized () const
 Return a normalized vector. More...
 
float dot (const Color3 &rhs) const
 Return the dot product of two vectors. More...
 
Iterator begin ()
 
ConstIterator begin () const
 
Iterator end ()
 
ConstIterator end () const
 
floatdata ()
 Return a pointer to the underlying data array. More...
 
const floatdata () const
 Return a const pointer to the underlying data array. More...
 
- Public Member Functions inherited from Vec3< T >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 T
operator[] (int i) IMATH_NOEXCEPT
 Element access by index. More...
 
IMATH_HOSTDEVICE constexpr
const T
operator[] (int i) const IMATH_NOEXCEPT
 Element access by index. More...
 
IMATH_HOSTDEVICE Vec3 () IMATH_NOEXCEPT
 Uninitialized by default. More...
 
IMATH_HOSTDEVICE constexpr Vec3 (T a) IMATH_NOEXCEPT
 Initialize to a scalar (a,a,a) More...
 
IMATH_HOSTDEVICE constexpr Vec3 (T a, T b, T c) IMATH_NOEXCEPT
 Initialize to given elements (a,b,c) More...
 
IMATH_HOSTDEVICE constexpr Vec3 (const Vec3 &v) IMATH_NOEXCEPT
 Copy constructor. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr Vec3 (const Vec3< S > &v) IMATH_NOEXCEPT
 Construct from Vec3 of another base type. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr Vec3 (const Vec4< S > &v) IMATH_NOEXCEPT
 
template<class S >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 Vec3 (const Vec4< S > &v, InfException)
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator= (const Vec3 &v) IMATH_NOEXCEPT
 Assignment. More...
 
 ~Vec3 () IMATH_NOEXCEPT=default
 Destructor. More...
 
template<typename V , IMATH_ENABLE_IF(has_xyz< V, T >::value) >
IMATH_HOSTDEVICE constexpr Vec3 (const V &v) IMATH_NOEXCEPT
 
template<typename V , IMATH_ENABLE_IF(has_subscript< V, T, 3 >::value &&!has_xyz< V, T >::value) >
IMATH_HOSTDEVICE Vec3 (const V &v)
 
template<typename V , IMATH_ENABLE_IF(has_xyz< V, T >::value) >
IMATH_HOSTDEVICE const Vec3operator= (const V &v) IMATH_NOEXCEPT
 
template<typename V , IMATH_ENABLE_IF(has_subscript< V, T, 3 >::value &&!has_xyz< V, T >::value) >
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator= (const V &v)
 
template<class S >
IMATH_HOSTDEVICE void setValue (S a, S b, S c) IMATH_NOEXCEPT
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void setValue (const Vec3< S > &v) IMATH_NOEXCEPT
 Set the value. More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (S &a, S &b, S &c) const IMATH_NOEXCEPT
 Return the value in a, b, and c More...
 
template<class S >
IMATH_HOSTDEVICE void getValue (Vec3< S > &v) const IMATH_NOEXCEPT
 Return the value in v More...
 
IMATH_HOSTDEVICE TgetValue () IMATH_NOEXCEPT
 Return a raw pointer to the array of values. More...
 
IMATH_HOSTDEVICE const TgetValue () const IMATH_NOEXCEPT
 Return a raw pointer to the array of values. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator== (const Vec3< S > &v) const IMATH_NOEXCEPT
 Equality. More...
 
template<class S >
IMATH_HOSTDEVICE constexpr bool operator!= (const Vec3< S > &v) const IMATH_NOEXCEPT
 Inequality. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
equalWithAbsError (const Vec3< T > &v, T e) const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 bool 
equalWithRelError (const Vec3< T > &v, T e) const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE constexpr T dot (const Vec3 &v) const IMATH_NOEXCEPT
 Dot product. More...
 
IMATH_HOSTDEVICE constexpr T operator^ (const Vec3 &v) const IMATH_NOEXCEPT
 Dot product. More...
 
IMATH_HOSTDEVICE constexpr Vec3 cross (const Vec3 &v) const IMATH_NOEXCEPT
 Right-handed cross product. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator%= (const Vec3 &v) IMATH_NOEXCEPT
 Right-handed cross product. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator% (const Vec3 &v) const IMATH_NOEXCEPT
 Right-handed cross product. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator+= (const Vec3 &v) IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator+ (const Vec3 &v) const IMATH_NOEXCEPT
 Component-wise addition. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator-= (const Vec3 &v) IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator- (const Vec3 &v) const IMATH_NOEXCEPT
 Component-wise subtraction. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator- () const IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
negate () IMATH_NOEXCEPT
 Component-wise multiplication by -1. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator*= (const Vec3 &v) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator*= (T a) IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator* (const Vec3 &v) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator* (T a) const IMATH_NOEXCEPT
 Component-wise multiplication. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator/= (const Vec3 &v) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE
IMATH_CONSTEXPR14 const Vec3
operator/= (T a) IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator/ (const Vec3 &v) const IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE constexpr Vec3 operator/ (T a) const IMATH_NOEXCEPT
 Component-wise division. More...
 
IMATH_HOSTDEVICE T length () const IMATH_NOEXCEPT
 Return the Euclidean norm. More...
 
IMATH_HOSTDEVICE constexpr T length2 () const IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE const Vec3normalize () IMATH_NOEXCEPT
 Normalize in place. If length()==0, return a null vector. More...
 
const Vec3normalizeExc ()
 Normalize in place. If length()==0, throw an exception. More...
 
IMATH_HOSTDEVICE const Vec3normalizeNonNull () IMATH_NOEXCEPT
 
IMATH_HOSTDEVICE Vec3< Tnormalized () const IMATH_NOEXCEPT
 Return a normalized vector. Does not modify *this. More...
 
Vec3< TnormalizedExc () const
 
IMATH_HOSTDEVICE Vec3< TnormalizedNonNull () const IMATH_NOEXCEPT
 

Additional Inherited Members

- Public Types inherited from VectorN< Color3, float, 3 >
using Iterator = typename std::array< float, N >::iterator
 
using ConstIterator = typename std::array< float, N >::const_iterator
 
- Public Types inherited from Vec3< T >
typedef T BaseType
 
- Static Public Member Functions inherited from VectorN< Color3, float, 3 >
static constexpr size_t numElements ()
 Return the number of scalar elements for the vector. More...
 
- Static Public Member Functions inherited from Vec3< T >
IMATH_HOSTDEVICE static
constexpr unsigned int 
dimensions () IMATH_NOEXCEPT
 Return the number of dimensions, i.e. 3. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeLowest () IMATH_NOEXCEPT
 Largest possible negative value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeMax () IMATH_NOEXCEPT
 Largest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeSmallest () IMATH_NOEXCEPT
 Smallest possible positive value. More...
 
IMATH_HOSTDEVICE static constexpr T baseTypeEpsilon () IMATH_NOEXCEPT
 Smallest possible e for which 1+e != 1. More...
 
- Public Attributes inherited from Vec3< T >
T x
 
T y
 
T z
 
- Protected Attributes inherited from VectorN< Color3, float, 3 >
std::array< float, N > _arr
 

Detailed Description

template<class T>
class Color3< T >

3-channel color class that inherits from Vec3.

This class does not impose interpretation on the channels, which can represent either rgb or hsv color values.

Note: because Color3 inherits from Vec3, its member fields are called x, y, and z.

A three-component color value

Definition at line 30 of file ImathColor.h.

Constructor & Destructor Documentation

template<class T >
IMATH_HOSTDEVICE Color3< T >::Color3 ( )
inline

No initialization by default.

Definition at line 310 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T >::Color3 ( T  a)
inlineexplicit

Initialize to (a a a)

Definition at line 315 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T >::Color3 ( T  a,
T  b,
T  c 
)
inline

Initialize to (a b c)

Definition at line 320 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T >::Color3 ( const Color3< T > &  c)
inline

Construct from Color3.

Definition at line 325 of file ImathColor.h.

template<class T >
template<class S >
IMATH_HOSTDEVICE constexpr Color3< T >::Color3 ( const Vec3< S > &  v)
inline

Construct from Vec3.

Definition at line 332 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE Color3< T >::~Color3 ( )
default

Destructor.

template<class T >
Color3< T >::Color3 ( )
default
template<class T >
Color3< T >::Color3 ( float  r,
float  g,
float  b 
)
inline

Definition at line 346 of file Types.h.

Member Function Documentation

template<class T >
Color3 Color3< T >::linearToSrgb ( ) const

Transform the given color from linear RGB to the sRGB encoding, returning the result as a new value.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::negate ( )
inline

Component-wise multiplication by -1.

Definition at line 384 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator* ( const Color3< T > &  c) const
inline

Component-wise multiplication.

Definition at line 408 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator* ( T  a) const
inline

Component-wise multiplication.

Definition at line 415 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator*= ( const Color3< T > &  c)
inline

Component-wise multiplication.

Definition at line 392 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator*= ( T  a)
inline

Component-wise multiplication.

Definition at line 400 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator+ ( const Color3< T > &  c) const
inline

Component-wise addition.

Definition at line 355 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator+= ( const Color3< T > &  c)
inline

Component-wise addition.

Definition at line 347 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator- ( const Color3< T > &  c) const
inline

Component-wise subtraction.

Definition at line 370 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator- ( ) const
inline

Component-wise multiplication by -1.

Definition at line 377 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator-= ( const Color3< T > &  c)
inline

Component-wise subtraction.

Definition at line 362 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator/ ( const Color3< T > &  c) const
inline

Component-wise division.

Definition at line 438 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE constexpr Color3< T > Color3< T >::operator/ ( T  a) const
inline

Component-wise division.

Definition at line 445 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator/= ( const Color3< T > &  c)
inline

Component-wise division.

Definition at line 422 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator/= ( T  a)
inline

Component-wise division.

Definition at line 430 of file ImathColor.h.

template<class T >
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 const Color3< T > & Color3< T >::operator= ( const Color3< T > &  c)
inline

Component-wise assignment.

Definition at line 339 of file ImathColor.h.

template<class T >
Color3 Color3< T >::srgbToLinear ( ) const

Transform the given color from the sRGB encoding to linear RGB, returning the result as a new value.


The documentation for this class was generated from the following files: