HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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 
16 #include <SYS/SYS_Types.h>
17 #include <UT/UT_VectorTypes.h>
18 
19 class ev_Vector;
20 
21 //
22 // Class definition for array data types
23 //
24 
26 public:
27  ev_Matrix(int rows=1, int cols=1);
28  ev_Matrix(const ev_Matrix &src);
29  ~ev_Matrix();
30 
31  int getRows() const { return myRowCount; }
32  int getCols() const { return myColCount; }
33  fpreal getValue(int r, int c) const;
34  fpreal fastGet(int r, int c) const { return myRowVals[r][c]; }
35  void setValue(int r, int c, fpreal val);
36 
37  void copy(const ev_Matrix &src);
38  void add(const ev_Matrix &src);
39  void sub(const ev_Matrix &src);
40  void times(fpreal scalar);
41  void times(const ev_Matrix &src);
42 
43  int castFrom(const char *str);
44  int castFrom(fpreal val);
45  int castFrom(const ev_Vector &from);
46  int castTo(ev_Vector &to) const;
47  int castToFloat(fpreal &rval) const;
48  char *castToString() const;
49 
50  void getMatrix3(UT_Matrix3R &v, int overwrite=1) const;
51  void getMatrix4(UT_Matrix4R &v, int overwrite=1) const;
52  void setMatrix3(const UT_Matrix3R &v);
53  void setMatrix4(const UT_Matrix4R &v);
54 
55  void identity(int size);
56 
57  // Returns 1 if it's a valid matrix string
58  int scan(const char *str);
59 
60  fpreal operator()(int r, int c) const { return getValue(r, c); }
61  void grow(int rows, int cols)
62  {
63  if (rows != myRowCount) setRows(rows);
64  if (cols != myColCount) setCols(cols);
65  }
66  void setRows(int rows);
67  void setCols(int cols);
68 
69 private:
70  int myRowCount, myColCount;
71  fpreal **myRowVals;
72 };
73 
74 #endif
fpreal operator()(int r, int c) const
Definition: EX_Matrix.h:60
const GLdouble * v
Definition: glcorearb.h:836
fpreal fastGet(int r, int c) const
Definition: EX_Matrix.h:34
GLsizeiptr size
Definition: glcorearb.h:663
void grow(int rows, int cols)
Definition: EX_Matrix.h:61
int getCols() const
Definition: EX_Matrix.h:32
int getRows() const
Definition: EX_Matrix.h:31
double fpreal
Definition: SYS_Types.h:269
GLuint GLfloat * val
Definition: glcorearb.h:1607
#define EXPR_API
Definition: EXPR_API.h:10
GLboolean r
Definition: glcorearb.h:1221
GLenum src
Definition: glcorearb.h:1792