123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110 |
- #ifndef __CC_PLANE_H_
- #define __CC_PLANE_H_
- #include "base/ccMacros.h"
- #include "math/CCMath.h"
- NS_CC_BEGIN
- enum class PointSide
- {
- IN_PLANE,
- FRONT_PLANE,
- BEHIND_PLANE,
- };
- class CC_DLL Plane
- {
- public:
-
- Plane(const Vec3& p1, const Vec3& p2, const Vec3& p3);
-
- Plane(const Vec3& normal, float dist);
-
- Plane(const Vec3& normal, const Vec3& point);
-
-
- Plane();
-
-
- void initPlane(const Vec3& p1, const Vec3& p2, const Vec3& p3);
-
- void initPlane(const Vec3& normal, float dist);
-
- void initPlane(const Vec3& normal, const Vec3& point);
-
- float dist2Plane(const Vec3& p) const;
-
- const Vec3& getNormal() const { return _normal; }
-
- float getDist() const { return _dist; }
-
- PointSide getSide(const Vec3& point) const;
- protected:
- Vec3 _normal;
- float _dist;
- };
- NS_CC_END
- #endif
|