HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EX_Matrix.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  * NAME: EX_Matrix.C ( EXPR Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __EX_Matrix_h__
12 #define __EX_Matrix_h__
13 
14 #include "EXPR_API.h"
15 #include <UT/UT_VectorTypes.h>
16 #include <SYS/SYS_Types.h>
17 
18 class ev_Vector;
19 
20 //
21 // Class definition for array data types
22 //
23 
25 {
26 public:
27  ev_Matrix(int rows=1, int cols=1);
28  ev_Matrix(const ev_Matrix &src);
29  ~ev_Matrix();
30 
31  ev_Matrix &operator=(const ev_Matrix &src) = delete;
32 
33  int getRows() const { return myRowCount; }
34  int getCols() const { return myColCount; }
35  fpreal getValue(int r, int c) const;
36  fpreal fastGet(int r, int c) const { return myRowVals[r][c]; }
37  void setValue(int r, int c, fpreal val);
38 
39  void copy(const ev_Matrix &src);
40  void add(const ev_Matrix &src);
41  void sub(const ev_Matrix &src);
42  void times(fpreal scalar);
43  void times(const ev_Matrix &src);
44 
45  int castFrom(const char *str);
46  int castFrom(fpreal val);
47  int castFrom(const ev_Vector &from);
48  int castTo(ev_Vector &to) const;
49  int castToFloat(fpreal &rval) const;
50  char *castToString() const;
51 
52  void getMatrix3(UT_Matrix3R &v, int overwrite=1) const;
53  void getMatrix4(UT_Matrix4R &v, int overwrite=1) const;
54  void setMatrix3(const UT_Matrix3R &v);
55  void setMatrix4(const UT_Matrix4R &v);
56 
57  void identity(int size);
58 
59  // Returns 1 if it's a valid matrix string
60  int scan(const char *str);
61 
62  fpreal operator()(int r, int c) const { return getValue(r, c); }
63  void grow(int rows, int cols)
64  {
65  if (rows != myRowCount) setRows(rows);
66  if (cols != myColCount) setCols(cols);
67  }
68  void setRows(int rows);
69  void setCols(int cols);
70 
71 private:
72  int myRowCount, myColCount;
73  fpreal **myRowVals;
74 };
75 
76 #endif
fpreal operator()(int r, int c) const
Definition: EX_Matrix.h:62
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
const GLdouble * v
Definition: glcorearb.h:837
__hostdev__ void setValue(uint32_t offset, bool v)
Definition: NanoVDB.h:5750
fpreal fastGet(int r, int c) const
Definition: EX_Matrix.h:36
__hostdev__ float getValue(uint32_t i) const
Definition: NanoVDB.h:5578
ImageBuf OIIO_API sub(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
void grow(int rows, int cols)
Definition: EX_Matrix.h:63
int getCols() const
Definition: EX_Matrix.h:34
int getRows() const
Definition: EX_Matrix.h:33
GLsizeiptr size
Definition: glcorearb.h:664
fpreal64 fpreal
Definition: SYS_Types.h:277
LeafData & operator=(const LeafData &)=delete
GLuint GLfloat * val
Definition: glcorearb.h:1608
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define EXPR_API
Definition: EXPR_API.h:10
GLboolean r
Definition: glcorearb.h:1222
GLenum src
Definition: glcorearb.h:1793