mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -04:00
Add setters to BoundingBox and BoundingSphere
This commit is contained in:
parent
bff070430e
commit
8a8cc94cbb
@ -114,3 +114,17 @@ get_plane(int n) const {
|
|||||||
get_point(plane_def[n][1]),
|
get_point(plane_def[n][1]),
|
||||||
get_point(plane_def[n][2]));
|
get_point(plane_def[n][2]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundingBox::set_min_max
|
||||||
|
// Access: Published
|
||||||
|
// Description: Sets the min and max point of the rectangular solid.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_MATHUTIL void BoundingBox::
|
||||||
|
set_min_max(const LPoint3 &min, const LPoint3 &max) {
|
||||||
|
nassertv(!min.is_nan() && !max.is_nan());
|
||||||
|
nassertv(_min[0] <= _max[0] && _min[1] <= _max[1] && _min[2] <= _max[2]);
|
||||||
|
_min = min;
|
||||||
|
_max = max;
|
||||||
|
_flags = 0;
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
|
|
||||||
virtual void output(ostream &out) const;
|
virtual void output(ostream &out) const;
|
||||||
|
|
||||||
|
|
||||||
PUBLISHED:
|
PUBLISHED:
|
||||||
INLINE_MATHUTIL int get_num_points() const;
|
INLINE_MATHUTIL int get_num_points() const;
|
||||||
INLINE_MATHUTIL LPoint3 get_point(int n) const;
|
INLINE_MATHUTIL LPoint3 get_point(int n) const;
|
||||||
@ -54,6 +55,8 @@ PUBLISHED:
|
|||||||
INLINE_MATHUTIL LPlane get_plane(int n) const;
|
INLINE_MATHUTIL LPlane get_plane(int n) const;
|
||||||
MAKE_SEQ(get_planes, get_num_planes, get_plane);
|
MAKE_SEQ(get_planes, get_num_planes, get_plane);
|
||||||
|
|
||||||
|
INLINE_MATHUTIL void set_min_max(const LPoint3 &min, const LPoint3 &max);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Inline accessors for speed.
|
// Inline accessors for speed.
|
||||||
INLINE_MATHUTIL const LPoint3 &get_minq() const;
|
INLINE_MATHUTIL const LPoint3 &get_minq() const;
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
// Description: Constructs an empty sphere.
|
// Description: Constructs an empty sphere.
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_MATHUTIL BoundingSphere::
|
INLINE_MATHUTIL BoundingSphere::
|
||||||
BoundingSphere() {
|
BoundingSphere() : _center(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
@ -44,7 +44,6 @@ BoundingSphere(const LPoint3 ¢er, PN_stdfloat radius) :
|
|||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
INLINE_MATHUTIL LPoint3 BoundingSphere::
|
INLINE_MATHUTIL LPoint3 BoundingSphere::
|
||||||
get_center() const {
|
get_center() const {
|
||||||
nassertr(!is_empty(), LPoint3::zero());
|
|
||||||
nassertr(!is_infinite(), LPoint3::zero());
|
nassertr(!is_infinite(), LPoint3::zero());
|
||||||
return _center;
|
return _center;
|
||||||
}
|
}
|
||||||
@ -61,3 +60,25 @@ get_radius() const {
|
|||||||
return _radius;
|
return _radius;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundingSphere::set_center
|
||||||
|
// Access: Published
|
||||||
|
// Description: Sets the center point of the sphere.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_MATHUTIL void BoundingSphere::
|
||||||
|
set_center(const LPoint3 ¢er) {
|
||||||
|
nassertv(!center.is_nan());
|
||||||
|
_center = center;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
// Function: BoundingSphere::set_radius
|
||||||
|
// Access: Published
|
||||||
|
// Description: Sets the radius of the sphere.
|
||||||
|
////////////////////////////////////////////////////////////////////
|
||||||
|
INLINE_MATHUTIL void BoundingSphere::
|
||||||
|
set_radius(PN_stdfloat radius) {
|
||||||
|
nassertv(!cnan(radius));
|
||||||
|
_radius = radius;
|
||||||
|
_flags = 0;
|
||||||
|
}
|
||||||
|
@ -47,6 +47,10 @@ PUBLISHED:
|
|||||||
INLINE_MATHUTIL LPoint3 get_center() const;
|
INLINE_MATHUTIL LPoint3 get_center() const;
|
||||||
INLINE_MATHUTIL PN_stdfloat get_radius() const;
|
INLINE_MATHUTIL PN_stdfloat get_radius() const;
|
||||||
|
|
||||||
|
INLINE_MATHUTIL void set_center(const LPoint3 ¢er);
|
||||||
|
INLINE_MATHUTIL void set_radius(PN_stdfloat radius);
|
||||||
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual const BoundingSphere *as_bounding_sphere() const;
|
virtual const BoundingSphere *as_bounding_sphere() const;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user