Panda3D
odeCollisionEntry.I
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 odeCollisionEntry.I
10  * @author rdb
11  * @date 2009-03-13
12  */
13 
14 /**
15  *
16  */
17 INLINE OdeCollisionEntry::
18 OdeCollisionEntry() {
19 }
20 
21 /**
22  * Returns the first geom in the collision.
23  */
25 get_geom1() const {
26  return OdeGeom(_geom1);
27 }
28 
29 /**
30  * Returns the second geom in the collision.
31  */
33 get_geom2() const {
34  return OdeGeom(_geom2);
35 }
36 
37 /**
38  * Returns the first body in the collision.
39  */
41 get_body1() const {
42  return OdeBody(_body1);
43 }
44 
45 /**
46  * Returns the second body in the collision.
47  */
49 get_body2() const {
50  return OdeBody(_body2);
51 }
52 
53 /**
54  * Returns the number of contacts in the collision.
55  */
56 INLINE size_t OdeCollisionEntry::
57 get_num_contacts() const {
58  return _num_contacts;
59 }
60 
61 /**
62  * Returns the nth contact geom in the collision.
63  */
65 get_contact_geom(size_t n) const {
66  nassertr(n >= 0 && n < _num_contacts, OdeContactGeom());
67  return _contact_geoms[n];
68 }
69 
70 /**
71  * Returns the nth contact geom in the collision.
72  */
74 operator [] (size_t n) const {
75  nassertr(n >= 0 && n < _num_contacts, OdeContactGeom());
76  return _contact_geoms[n];
77 }
78 
79 /**
80  * Returns the nth contact point in the collision. This does exactly the same
81  * as get_contact_geom(n).get_pos().
82  */
83 INLINE LPoint3f OdeCollisionEntry::
84 get_contact_point(size_t n) const {
85  nassertr(n >= 0 && n < _num_contacts, LPoint3f::zero());
86  return _contact_geoms[n].get_pos();
87 }
88 
89 /**
90  * An OdeCollisionEntry evaluates to False if it holds no contacts.
91  */
92 INLINE OdeCollisionEntry::
93 operator bool () const {
94  return (_num_contacts != 0);
95 }
96 
97 /**
98  * Returns true if the entry holds no contacts.
99  */
100 INLINE bool OdeCollisionEntry::
101 is_empty() const {
102  return (_num_contacts == 0);
103 }
get_contact_geom
Returns the nth contact geom in the collision.
OdeBody get_body2() const
Returns the second body in the collision.
OdeGeom get_geom1() const
Returns the first geom in the collision.
get_contact_point
Returns the nth contact point in the collision.
bool is_empty() const
Returns true if the entry holds no contacts.
OdeGeom get_geom2() const
Returns the second geom in the collision.
OdeBody get_body1() const
Returns the first body in the collision.
OdeContactGeom operator [](size_t n) const
Returns the nth contact geom in the collision.