Panda3D
Loading...
Searching...
No Matches
physxBounds3.h
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxBounds3.h
10 * @author enn0x
11 * @date 2009-10-31
12 */
13
14#ifndef PHYSXBOUNDS3_H
15#define PHYSXBOUNDS3_H
16
17#include "pandabase.h"
18#include "luse.h"
19
20#include "config_physx.h"
21#include "physx_includes.h"
22
23/**
24 * Represention of a axis aligned bounding box. The box is stored as minimum
25 * and maximum extent corners. Alternate representation would be center and
26 * dimensions. May be empty or nonempty. If not empty, min <= max has to
27 * hold.
28 */
29class EXPCL_PANDAPHYSX PhysxBounds3 {
30
31PUBLISHED:
32 INLINE PhysxBounds3();
33 INLINE ~PhysxBounds3();
34
35 void bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims);
36 void combine(const PhysxBounds3 &b2);
37 bool contain(const LPoint3f &p) const;
38 void fatten(float distance);
39 void include(const LPoint3f &v);
40 bool intersects(const PhysxBounds3 &b) const;
41 bool intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const;
42 bool is_empty() const;
43 void scale(float scale);
44 void set(const LPoint3f &min, const LPoint3f &max);
45 void set_center_extents(const LPoint3f &center, const LVector3f &extents);
46 void set_empty();
47 void set_infinite();
48 void transform(const LMatrix3f &orientation, const LPoint3f &translation);
49
50 LPoint3f get_max() const;
51 LPoint3f get_min() const;
52 LPoint3f get_center() const;
53 LVector3f get_dimensions() const;
54
55 void set_max(LPoint3f value);
56 void set_min(LPoint3f value);
57
58public:
59 NxBounds3 _bounds;
60};
61
62#include "physxBounds3.I"
63
64#endif // PHYSBOUNDS3_H
void set_min(LPoint3f value)
Sets the minimum corner of the bounding box.
LPoint3f get_min() const
Returns the maximum corner of the bounding box.
void set_max(LPoint3f value)
Sets the maximum corner of the bounding box.
void transform(const LMatrix3f &orientation, const LPoint3f &translation)
Transforms this volume as if it was an axis aligned bounding box, and then assigns the results' bound...
void scale(float scale)
Scales the AABB by the given factor.
bool is_empty() const
Returns TRUE if the bounding box is empty.
void set_empty()
Sets empty to TRUE.
void include(const LPoint3f &v)
Expands the volume to include the point v.
bool intersects(const PhysxBounds3 &b) const
Returns TRUE if the intersection of this and b is is not empty.
bool contain(const LPoint3f &p) const
Returns TRUE if these bounds contain the point v.
LVector3f get_dimensions() const
Returns the extents of the bounding box.
void fatten(float distance)
Fattens the AABB in all three dimensions by the given distance.
void combine(const PhysxBounds3 &b2)
Sets this to the union of this and b2.
void set(const LPoint3f &min, const LPoint3f &max)
Setup this AABB from minimum corner and maximum corner.
LPoint3f get_max() const
Returns the minimum corner of the bounding box.
LPoint3f get_center() const
Returns the center of the bounding box.
void set_infinite()
Sets infinite bounds.
bool intersects2d(const PhysxBounds3 &b, unsigned axis_to_ignore) const
Indicates whether the intersection of this and b is empty or not in the plane orthogonal to the axis ...
void bounds_of_obb(const LMatrix3f &orientation, const LPoint3f &translation, const LVector3f &half_dims)
Sets this to the AABB (axis ligned bounding box) of the OBB (oriented bounding box).
void set_center_extents(const LPoint3f &center, const LVector3f &extents)
Setup this AABB from center point and extents vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.