HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HOM_Vector4.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * COMMENTS:
7  */
8 
9 #ifndef __HOM_Vector4_h__
10 #define __HOM_Vector4_h__
11 
12 #include "HOM_API.h"
13 #include "HOM_Defines.h"
14 #include "HOM_Errors.h"
15 #include "HOM_Module.h"
16 #include "HOM_Vector3.h"
17 #include "HOM_Matrix4.h"
18 #include "HOM_PtrOrNull.h"
19 #include <UT/UT_Vector4.h>
20 #include <vector>
21 #include <stdexcept>
22 class HOM_Vector4;
23 
24 SWIGOUT(%rename(Vector4) HOM_Vector4;)
25 
27 {
28 public:
30  : myVector4(0.0, 0.0, 0.0, 0.0)
31  { HOM_CONSTRUCT_OBJECT(this) }
32 
33  HOM_Vector4(double x, double y, double z, double w)
34  : myVector4(x, y, z, w)
35  { HOM_CONSTRUCT_OBJECT(this) }
36 
37  SWIGOUT(%ignore HOM_Vector4(const UT_Vector4D&);)
38  HOM_Vector4(const UT_Vector4D &vector4)
39  : myVector4(vector4)
40  { HOM_CONSTRUCT_OBJECT(this) }
41 
42  SWIGOUT(%ignore HOM_Vector4(const UT_Vector4F&);)
43  HOM_Vector4(const UT_Vector4F &vector4)
44  : myVector4(vector4)
45  { HOM_CONSTRUCT_OBJECT(this) }
46 
47  HOM_Vector4(const std::vector<double> &sequence)
48  {
50  setTo(sequence);
51  }
52 
53  HOM_Vector4(HOM_Vector3 &vector3);
54 
56  { HOM_DESTRUCT_OBJECT(this) }
57 
59  { return vector4.myPointer && myVector4 == vector4.myPointer->myVector4; }
60 
62  { return !operator==(vector4); }
63 
64  bool isAlmostEqual(HOM_Vector4 &vector4, double tolerance=0.00001);
65 
66  // This method is deprecated.
67  bool almostEqual(HOM_Vector4 &vector4, double tolerance=0.00001)
68  { return isAlmostEqual(vector4, tolerance); }
69 
70  int __hash__();
73 
74  double __getitem__(int index);
75  void __setitem__(int index, double value);
76  int __len__()
77  { return 4; }
78 
79  // operator[] exists only to make this class easier to use from C++,
80  // and isn't wrapped by swig.
81  SWIGOUT(%ignore operator[];)
82  double &operator[](int index);
83 
84  void setTo(const std::vector<double> &sequence);
85 
86  SWIGOUT(%ignore operator=;)
87  HOM_Vector4 &operator=(const HOM_Vector4& vector4)
88  {
89  myVector4 = vector4.myVector4;
90  return *this;
91  }
92 
94  { return HOM_Vector4(myVector4 + vector4.myVector4); }
96  { return HOM_Vector4(myVector4 - vector4.myVector4); }
97  HOM_Vector4 __mul__(double scalar)
98  { return HOM_Vector4(myVector4 * scalar); }
99  HOM_Vector4 __rmul__(double scalar)
100  { return HOM_Vector4(myVector4 * scalar); }
101  HOM_Vector4 __mul__(HOM_Matrix4 &matrix4);
102  HOM_Vector4 __div__(double scalar)
103  { return HOM_Vector4(myVector4 / scalar); }
104 
106  double length()
107  { return myVector4.length(); }
108  double lengthSquared()
109  { return myVector4.length2(); }
110 
111  double dot(HOM_Vector4 &vector4)
112  { return myVector4.dot(vector4.myVector4); }
113 
114  HOM_Vector4 ocio_transform(const std::string &src_space,
115  const std::string &dest_space) const;
116 
117  double x()
118  { return myVector4.x(); }
119  double y()
120  { return myVector4.y(); }
121  double z()
122  { return myVector4.z(); }
123  double w()
124  { return myVector4.w(); }
125 
127  { return &myVector4; }
128 
129  SWIGOUT(%ignore myVector4;)
131 };
132 
133 #endif
double x()
Definition: HOM_Vector4.h:117
#define HOM_DESTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:981
T & z(void)
Definition: UT_Vector4.h:372
double dot(HOM_Vector4 &vector4)
Definition: HOM_Vector4.h:111
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
GLdouble GLdouble GLdouble z
Definition: glcorearb.h:847
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
double lengthSquared()
Definition: HOM_Vector4.h:108
GLint y
Definition: glcorearb.h:102
int __hash__()
double __getitem__(int index)
HOM_Vector4 __div__(double scalar)
Definition: HOM_Vector4.h:102
SYS_FORCE_INLINE UT_StorageNum< typename UT_StorageBetter< T, S >::Type >::AtLeast32Bit dot(const UT_FixedVector< S, SIZE, S_INSTANTIATED > &that) const
HOM_Vector4(const std::vector< double > &sequence)
Definition: HOM_Vector4.h:47
HOM_Vector4 __mul__(double scalar)
Definition: HOM_Vector4.h:97
double length()
Definition: HOM_Vector4.h:106
HOM_Vector4 __rmul__(double scalar)
Definition: HOM_Vector4.h:99
HOM_Vector4(const UT_Vector4F &vector4)
Definition: HOM_Vector4.h:43
#define HOM_API
Definition: HOM_API.h:13
#define HOM_CONSTRUCT_OBJECT(pointer)
Definition: HOM_Module.h:980
double y()
Definition: HOM_Vector4.h:119
GLint GLenum GLboolean normalized
Definition: glcorearb.h:871
HOM_Vector4(double x, double y, double z, double w)
Definition: HOM_Vector4.h:33
T & y(void)
Definition: UT_Vector4.h:370
std::string __repr__()
void __setitem__(int index, double value)
bool isAlmostEqual(HOM_Vector4 &vector4, double tolerance=0.00001)
bool operator==(HOM_PtrOrNull< HOM_Vector4 > vector4)
Definition: HOM_Vector4.h:58
UT_Vector4D myVector4
Definition: HOM_Vector4.h:130
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double z()
Definition: HOM_Vector4.h:121
bool almostEqual(HOM_Vector4 &vector4, double tolerance=0.00001)
Definition: HOM_Vector4.h:67
GLuint index
Definition: glcorearb.h:785
void * _asVoidPointer()
Definition: HOM_Vector4.h:126
void setTo(const std::vector< double > &sequence)
GLint GLenum GLint x
Definition: glcorearb.h:408
HOM_Vector4 ocio_transform(const std::string &src_space, const std::string &dest_space) const
std::string __str__()
T & x(void)
Definition: UT_Vector4.h:368
HOM_Vector4 __add__(HOM_Vector4 &vector4)
Definition: HOM_Vector4.h:93
GLubyte GLubyte GLubyte GLubyte w
Definition: glcorearb.h:856
double w()
Definition: HOM_Vector4.h:123
HOM_Vector4(const UT_Vector4D &vector4)
Definition: HOM_Vector4.h:38
SYS_FORCE_INLINE Storage::AtLeast32Bit length2() const noexcept
T & w(void)
Definition: UT_Vector4.h:374
SYS_FORCE_INLINE Storage::MathFloat length() const
int __len__()
Definition: HOM_Vector4.h:76
bool operator==(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Equality operator, does exact floating point comparisons.
Definition: Mat3.h:596
HOM_Vector4 __sub__(HOM_Vector4 &vector4)
Definition: HOM_Vector4.h:95
bool operator!=(HOM_PtrOrNull< HOM_Vector4 > vector4)
Definition: HOM_Vector4.h:61