HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HOM_hmath.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  * This "submodule" is named hou.hmath instead of hou.math to prevent
8  * conflicts with the python math module, since expression evaluation
9  * contexts have run from hou import *.
10  */
11 
12 #ifndef __HOM_hmath_h__
13 #define __HOM_hmath_h__
14 
15 #include "HOM_API.h"
16 #include "HOM_Defines.h"
17 #include "HOM_Errors.h"
18 #include <SYS/SYS_Math.h>
19 #include <vector>
20 #include <map>
21 class HOM_Matrix4;
22 class HOM_Vector3;
23 
24 SWIGOUT(%rename(hmath) HOM_hmath;)
25 
27 {
28 public:
29  virtual ~HOM_hmath()
30  {}
31 
32  virtual std::string __repr__() = 0;
33 
34  SWIGOUT(%newobject identityTransform;)
35  virtual HOM_Matrix4 *identityTransform() = 0;
36 
37  SWIGOUT(%newobject buildTranslate;)
38  virtual HOM_Matrix4 *buildTranslate(double tx, double ty, double tz) = 0;
39  virtual HOM_Matrix4 *buildTranslate(const std::vector<double> &values) = 0;
40  virtual HOM_Matrix4 *buildTranslate(HOM_Vector3 &values) = 0;
41 
42  SWIGOUT(%newobject buildScale;)
43  virtual HOM_Matrix4 *buildScale(double sx, double sy, double sz) = 0;
44  virtual HOM_Matrix4 *buildScale(const std::vector<double> &values) = 0;
45  virtual HOM_Matrix4 *buildScale(HOM_Vector3 &values) = 0;
46 
47  SWIGOUT(%newobject buildShear;)
48  virtual HOM_Matrix4 *buildShear(double sxy, double sxz, double syz) = 0;
49  virtual HOM_Matrix4 *buildShear(const std::vector<double> &values) = 0;
50  virtual HOM_Matrix4 *buildShear(HOM_Vector3 &values) = 0;
51 
52  SWIGOUT(%newobject buildRotate;)
53  virtual HOM_Matrix4 *buildRotate(
54  double rx, double ry, double rz, const char *order="xyz") = 0;
55  virtual HOM_Matrix4 *buildRotate(
56  const std::vector<double> &values, const char *order="xyz") = 0;
57  virtual HOM_Matrix4 *buildRotate(
58  HOM_Vector3 &values, const char *order="xyz") = 0;
59 
60  SWIGOUT(%newobject buildRotateAboutAxis;)
61  virtual HOM_Matrix4 *buildRotateAboutAxis(
62  const std::vector<double> &axis, double angle_in_deg)= 0;
63  virtual HOM_Matrix4 *buildRotateAboutAxis(
64  HOM_Vector3 &axis, double angle_in_deg) = 0;
65 
66  virtual HOM_Matrix4* buildTransform(
67  const std::map<std::string, std::vector<double> > &values_dict,
68  const char *transform_order="srt",
69  const char *rotate_order="xyz") = 0;
70 
71 
72  virtual double degToRad(double degrees) = 0;
73  virtual double radToDeg(double radians) = 0;
74 
75  virtual double noise1d(const std::vector<double> &pos) const = 0;
76 
77  virtual HOM_Vector3 noise3d(const std::vector<double> &pos) const = 0;
78 
79  double fit(
80  double value, double oldmin, double oldmax,
81  double newmin, double newmax)
82  { return SYSfit(value, oldmin, oldmax, newmin, newmax); }
83 
84  double fit01(double value, double newmin, double newmax)
85  { return SYSfit(value, 0, 1, newmin, newmax); }
86 
87  double fit10(double value, double newmin, double newmax)
88  { return SYSfit(value, 1, 0, newmin, newmax); }
89 
90  double fit11(double value, double newmin, double newmax)
91  { return SYSfit(value, -1, 1, newmin, newmax); }
92 
93  double sign(double value)
94  { return value < 0 ? -1 : (value > 0); }
95 
96  double clamp(double value, double min, double max)
97  { return SYSclamp(value, min, max); }
98 
99  double smooth(double value, double min, double max)
100  {
101  // Caution, the order of the arguments is switched around here
102  return SYSsmooth(min, max, value);
103  }
104 
105  virtual double wrap(double value, double min, double max) const = 0;
106 
107  virtual double rand(double seed) const = 0;
108 
109  virtual double orient2d(
110  const std::vector<double> &pa,
111  const std::vector<double> &pb,
112  const std::vector<double> &point) = 0;
113  virtual double orient3d(
114  const std::vector<double> &pa,
115  const std::vector<double> &pb,
116  const std::vector<double> &pc,
117  const std::vector<double> &point) = 0;
118  virtual double inCircle(
119  const std::vector<double> &pa,
120  const std::vector<double> &pb,
121  const std::vector<double> &pc,
122  const std::vector<double> &point) = 0;
123  virtual double inSphere(
124  const std::vector<double> &pa,
125  const std::vector<double> &pb,
126  const std::vector<double> &pc,
127  const std::vector<double> &pd,
128  const std::vector<double> &point) = 0;
129 
130  virtual HOM_Vector3 intersectPlane(
131  HOM_Vector3 const& plane_point,
132  HOM_Vector3 const& plane_dir,
133  HOM_Vector3 const& line_origin,
134  HOM_Vector3 const& line_dir
135  ) = 0;
136 };
137 
138 #endif
double fit10(double value, double newmin, double newmax)
Definition: HOM_hmath.h:87
GLsizei const GLchar *const * string
Definition: glcorearb.h:813
#define SWIGOUT(x)
Definition: HOM_Defines.h:24
string __repr__(VtArray< T > const &self)
Definition: wrapArray.h:344
double smooth(double value, double min, double max)
Definition: HOM_hmath.h:99
#define HOM_API
Definition: HOM_API.h:13
double fit11(double value, double newmin, double newmax)
Definition: HOM_hmath.h:90
SYS_FORCE_INLINE REAL orient3d(const REAL pa[3], const REAL pb[3], const REAL pc[3], const REAL pd[3])
const std::enable_if<!VecTraits< T >::IsVec, T >::type & max(const T &a, const T &b)
Definition: Composite.h:133
double clamp(double value, double min, double max)
Definition: HOM_hmath.h:96
GLenum GLsizei GLsizei GLint * values
Definition: glcorearb.h:1601
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fit(double value, double oldmin, double oldmax, double newmin, double newmax)
Definition: HOM_hmath.h:79
double fit01(double value, double newmin, double newmax)
Definition: HOM_hmath.h:84
double sign(double value)
Definition: HOM_hmath.h:93
const std::enable_if<!VecTraits< T >::IsVec, T >::type & min(const T &a, const T &b)
Definition: Composite.h:129
SYS_FORCE_INLINE REAL orient2d(const REAL pa[2], const REAL pb[2], const REAL pc[2])
virtual ~HOM_hmath()
Definition: HOM_hmath.h:29