HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_BoundingCone.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: UT_BoundingCone.h (UT Library, C++)
7  *
8  * COMMENTS: A cone centered at the origin with a given direction and
9  * half-angle.
10  */
11 
12 #ifndef __UT_BoundingCone_h__
13 #define __UT_BoundingCone_h__
14 
15 #include "UT_API.h"
16 #include "UT_Vector3.h"
17 
19 {
20 public:
22  {
23  myDir = 0;
24  myAngle = 0;
25  }
26 
27  // Cone angles are measured from the center to the edge of the cone.
28  UT_BoundingCone(const UT_Vector3 &dir, float angle)
29  : myDir(dir)
30  , myAngle(angle)
31  {
32  myDir.normalize();
33  }
34 
35  const UT_Vector3 &getDir() const { return myDir; }
36  float getAngle() const { return myAngle; }
37 
38  // Initialize the direction vector and set the angle to 0
39  void initBounds(const UT_Vector3 &dir);
40 
41  // Enlarge the cone so that it encloses the given direction vector.
42  void enlargeBounds(const UT_Vector3 &dir);
43 
44  // Tests for any intersection between two cones
45  bool intersects(const UT_BoundingCone &cone) const;
46 
47  // Find the intersection of this bounding cone with another cone and
48  // store the result in this. The result will be a conservative bound,
49  // since the exact intersection may not be a cone. If the cones are
50  // disjoint, the angle for this cone will be set to 0 and this method
51  // will return false.
52  bool computeIntersection(const UT_BoundingCone &cone);
53 
54  void dump();
55 
56 private:
57  UT_Vector3 myDir;
58  float myAngle;
59 };
60 
61 #endif
UT_BoundingCone(const UT_Vector3 &dir, float angle)
SIM_API const UT_StringHolder angle
#define UT_API
Definition: UT_API.h:14
const UT_Vector3 & getDir() const
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersects(const Box< Vec3< T >> &b, const Line3< T > &r, Vec3< T > &ip) IMATH_NOEXCEPT
Definition: ImathBoxAlgo.h:642
float getAngle() const