Add almost completely useless flip() method

This commit is contained in:
rdb 2011-04-01 12:24:08 +00:00
parent a003a73c3f
commit e508c07765
4 changed files with 29 additions and 3 deletions

View File

@ -99,3 +99,13 @@ INLINE const Planef &CollisionPlane::
get_plane() const {
return _plane;
}
////////////////////////////////////////////////////////////////////
// Function: CollisionPlane::flip
// Access: Published
// Description: Convenience method to flip the plane in-place.
////////////////////////////////////////////////////////////////////
INLINE void CollisionPlane::
flip() {
_plane.flip();
}

View File

@ -55,6 +55,8 @@ PUBLISHED:
INLINE void set_plane(const Planef &plane);
INLINE const Planef &get_plane() const;
INLINE void flip();
protected:
virtual PT(BoundingVolume) compute_internal_bounds() const;

View File

@ -66,7 +66,7 @@ FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
// a point within the plane.
////////////////////////////////////////////////////////////////////
INLINE_MATHUTIL FLOATNAME(Plane)::
FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
const FLOATNAME(LPoint3) &point) {
FLOATNAME(LVector3) p = ::normalize(normal);
@ -177,6 +177,20 @@ project(const FLOATNAME(LPoint3) &point) const {
return point - get_normal() * dist_to_plane(point);
}
////////////////////////////////////////////////////////////////////
// Function: Plane::flip
// Access: Published
// Description: Convenience method that flips the plane in-place.
// This is done by simply flipping the normal vector.
////////////////////////////////////////////////////////////////////
INLINE_MATHUTIL void FLOATNAME(Plane)::
flip() {
_v.v._0 = -_v.v._0;
_v.v._1 = -_v.v._1;
_v.v._2 = -_v.v._2;
// We don't flip D, that would make the plane flip over the origin.
}
////////////////////////////////////////////////////////////////////
// Function: Plane::intersects_line
// Access: Published

View File

@ -21,7 +21,7 @@ class EXPCL_PANDA_MATHUTIL FLOATNAME(Plane) : public FLOATNAME(LVecBase4) {
PUBLISHED:
INLINE_MATHUTIL FLOATNAME(Plane)();
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVecBase4) &copy);
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a,
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a,
const FLOATNAME(LPoint3) &b,
const FLOATNAME(LPoint3) &c);
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
@ -42,7 +42,7 @@ PUBLISHED:
INLINE_MATHUTIL FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const;
INLINE_MATHUTIL FLOATNAME(LPoint3) project(const FLOATNAME(LPoint3) &point) const;
INLINE_MATHUTIL void flip();
INLINE_MATHUTIL bool intersects_line(FLOATNAME(LPoint3) &intersection_point,
const FLOATNAME(LPoint3) &p1,