HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GU_RayRBezCurve.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: GU library (C++)
7  *
8  * COMMENTS: Ray intersction objects for faces, this does not
9  * include closed faces (Ie: polygons)
10  *
11  */
12 
13 #ifndef __GU_RayRBezCurve_h__
14 #define __GU_RayRBezCurve_h__
15 
16 #include "GU_API.h"
17 #include <UT/UT_Matrix4.h>
18 #include <UT/UT_Matrix3.h>
19 #include <UT/UT_Vector3.h>
20 #include <UT/UT_Vector4Array.h>
21 #include <UT/UT_Matrix.h>
22 #include <UT/UT_BoundingBox.h>
23 
24 #include "GU_RayIntersect.h"
25 
26 class GEO_Primitive;
27 class GU_RayInfo;
28 class GU_MinInfo;
29 class GU_RayRBezCurve;
30 class GU_RayRBezSurf;
31 class TS_MetaExpression;
32 class GU_IsectCurveSet;
33 class GU_IsectCurve;
34 
35 
36 //________________________________________________________
37 //
38 // Bezier segment ray intersection class
39 //
40 // Note: working in homogeneous coordinate
41 //________________________________________________________
42 //
43 
45 {
46 public:
47  void init(int order, float uStart, float uLength, int isRational);
48  void buildBBox();
49  int intersect(const UT_Vector3 &org,
50  const UT_Vector3 &dir,
51  GU_RayInfo &hitInfo, int depth) const;
52  int intersect(const UT_Vector3 &p,
53  GU_RayInfo &hitInfo, int depth) const;
54  int intersect(const GU_RayRBezCurve &curve,
55  GU_RayInfo &hitInfo, int depth) const;
56  int intersect(GU_RayRBezSurf &surf, GU_RayInfo &hitInfo,
57  int depth) const;
58  int intersectQR(GU_RayRBezSurf &surf, GU_RayInfo &hitInfo,
59  int depth) const;
60  int intersectAP(GU_RayRBezSurf &surf, GU_RayInfo &hitInfo);
61 
62  // checks the proximity of the ray to the end points of the curve,
63  // and compares it with the tolerance given in hit_info.
64  // If ray passes within the given tolerance, in the hemispherical cup
65  // at the end of the curve, that "seals" the cylidrical zone around
66  // the curve, it is considered as a hit, and 1 is returned.
67  // INPUTS:
68  // org, dir - the origin and direction of the ray
69  // hit_info - its tolerance is treated as a radius of a hemisphere at the
70  // endpoints, within which to test the ray's presence
71  // OUTPUT
72  // hit_info - if hit, a hit is added
73  // RETURN:
74  // 1 if hit: ray passes within tolerance radius of endpoint, otherwise 0
75  int intersectFirstPointZone(const UT_Vector3 &org,
76  const UT_Vector3 &dir,
77  GU_RayInfo &hit_info) const;
78  int intersectLastPointZone(const UT_Vector3 &org,
79  const UT_Vector3 &dir,
80  GU_RayInfo &hit_info) const;
81 
82  // Start/end are in 0,1 range.
83  int polishCurveSurf(const GU_RayRBezSurf &surf,
84  UT_MatrixF &C1, UT_MatrixF &C2, UT_MatrixF &R,
85  UT_MatrixF &tmp, float start, float end,
87  GU_RayFindType findType,
88  int firstiter = 3, float firsttol = 1e-2F,
89  int finaliter = 50, float finaltol = 1e-6F,
90  float ttol = 1e-3F);
91 
92  int minimum(const UT_Vector3 &p,
93  GU_MinInfo &mininfo, int depth) const;
94  int minimum(const GU_RayRBezCurve &curve,
95  GU_MinInfo &mininfo, int depth,
96  int noBBoxTest = 0) const;
97 
98  void split(GU_RayRBezCurve *left, GU_RayRBezCurve *right,
99  float tol) const;
100  // Does an inplace cut at both start and end, ustart < uend.
101  void carve(float ustart, float uend);
102  void evaluate(float t, UT_Vector3 &pos) const;
103  void evaluate(float t, UT_Vector3 &pos,
104  UT_Vector3 &der) const;
105  void evaluate(float t, UT_Vector3 &pos,
106  UT_Vector3 &der, UT_Vector3 &der2) const;
107 
108  void print() const;
109 
110  int64 getMemoryUsage(bool inclusive) const
111  {
112  int64 mem = inclusive ? sizeof(*this) : 0;
113  mem += myCV.getMemoryUsage(false);
114  return mem;
115  }
116 
117 public:
120  float myUStart, myULength;
122 };
123 
124 #endif
125 
GLint left
Definition: glcorearb.h:2004
GLuint start
Definition: glcorearb.h:474
long long int64
Definition: SYS_Types.h:107
UT_Vector4Array myCV
GLint GLint GLsizei GLsizei GLsizei depth
Definition: glcorearb.h:475
bool intersect(const Line3< T > &line, const Vec3< T > &v0, const Vec3< T > &v1, const Vec3< T > &v2, Vec3< T > &pt, Vec3< T > &barycentric, bool &front)
int64 getMemoryUsage(bool inclusive) const
GLuint GLuint end
Definition: glcorearb.h:474
#define GU_API
Definition: GU_API.h:12
GU_RayFindType
UT_BoundingBox myBBox