mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-02 18:03:56 -04:00
Add almost completely useless flip() method
This commit is contained in:
parent
a003a73c3f
commit
e508c07765
@ -99,3 +99,13 @@ INLINE const Planef &CollisionPlane::
|
|||||||
get_plane() const {
|
get_plane() const {
|
||||||
return _plane;
|
return _plane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: CollisionPlane::flip
|
||||||
|
// Access: Published
|
||||||
|
// Description: Convenience method to flip the plane in-place.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE void CollisionPlane::
|
||||||
|
flip() {
|
||||||
|
_plane.flip();
|
||||||
|
}
|
||||||
|
@ -55,6 +55,8 @@ PUBLISHED:
|
|||||||
INLINE void set_plane(const Planef &plane);
|
INLINE void set_plane(const Planef &plane);
|
||||||
INLINE const Planef &get_plane() const;
|
INLINE const Planef &get_plane() const;
|
||||||
|
|
||||||
|
INLINE void flip();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual PT(BoundingVolume) compute_internal_bounds() const;
|
virtual PT(BoundingVolume) compute_internal_bounds() const;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a, const FLOATNAME(LPoint3) &b,
|
|||||||
// a point within the plane.
|
// a point within the plane.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_MATHUTIL FLOATNAME(Plane)::
|
INLINE_MATHUTIL FLOATNAME(Plane)::
|
||||||
FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
|
FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
|
||||||
const FLOATNAME(LPoint3) &point) {
|
const FLOATNAME(LPoint3) &point) {
|
||||||
FLOATNAME(LVector3) p = ::normalize(normal);
|
FLOATNAME(LVector3) p = ::normalize(normal);
|
||||||
|
|
||||||
@ -177,6 +177,20 @@ project(const FLOATNAME(LPoint3) &point) const {
|
|||||||
return point - get_normal() * dist_to_plane(point);
|
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
|
// Function: Plane::intersects_line
|
||||||
// Access: Published
|
// Access: Published
|
||||||
|
@ -21,7 +21,7 @@ class EXPCL_PANDA_MATHUTIL FLOATNAME(Plane) : public FLOATNAME(LVecBase4) {
|
|||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE_MATHUTIL FLOATNAME(Plane)();
|
INLINE_MATHUTIL FLOATNAME(Plane)();
|
||||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVecBase4) ©);
|
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVecBase4) ©);
|
||||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a,
|
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LPoint3) &a,
|
||||||
const FLOATNAME(LPoint3) &b,
|
const FLOATNAME(LPoint3) &b,
|
||||||
const FLOATNAME(LPoint3) &c);
|
const FLOATNAME(LPoint3) &c);
|
||||||
INLINE_MATHUTIL FLOATNAME(Plane)(const FLOATNAME(LVector3) &normal,
|
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 FLOATTYPE dist_to_plane(const FLOATNAME(LPoint3) &point) const;
|
||||||
INLINE_MATHUTIL FLOATNAME(LPoint3) project(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,
|
INLINE_MATHUTIL bool intersects_line(FLOATNAME(LPoint3) &intersection_point,
|
||||||
const FLOATNAME(LPoint3) &p1,
|
const FLOATNAME(LPoint3) &p1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user