Panda3D
 All Classes Functions Variables Enumerations
odeCollisionEntry.I
1 // Filename: odeCollisionEntry.cxx
2 // Created by: pro-rsoft (13Mar09)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 ////////////////////////////////////////////////////////////////////
16 // Function: OdeCollisionEntry::Constructor
17 // Access: Private
18 // Description:
19 ////////////////////////////////////////////////////////////////////
20 INLINE OdeCollisionEntry::
21 OdeCollisionEntry() {
22 }
23 
24 ////////////////////////////////////////////////////////////////////
25 // Function: OdeCollisionEntry::get_geom1
26 // Access: Published
27 // Description: Returns the first geom in the collision.
28 ////////////////////////////////////////////////////////////////////
30 get_geom1() const {
31  return OdeGeom(_geom1);
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: OdeCollisionEntry::get_geom2
36 // Access: Published
37 // Description: Returns the second geom in the collision.
38 ////////////////////////////////////////////////////////////////////
40 get_geom2() const {
41  return OdeGeom(_geom2);
42 }
43 
44 ////////////////////////////////////////////////////////////////////
45 // Function: OdeCollisionEntry::get_body1
46 // Access: Published
47 // Description: Returns the first body in the collision.
48 ////////////////////////////////////////////////////////////////////
50 get_body1() const {
51  return OdeBody(_body1);
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: OdeCollisionEntry::get_body2
56 // Access: Published
57 // Description: Returns the second body in the collision.
58 ////////////////////////////////////////////////////////////////////
60 get_body2() const {
61  return OdeBody(_body2);
62 }
63 
64 ////////////////////////////////////////////////////////////////////
65 // Function: OdeCollisionEntry::get_num_contacts
66 // Access: Published
67 // Description: Returns the number of contacts in the collision.
68 ////////////////////////////////////////////////////////////////////
69 INLINE size_t OdeCollisionEntry::
71  return _num_contacts;
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: OdeCollisionEntry::get_contact_geom
76 // Access: Published
77 // Description: Returns the nth contact geom in the collision.
78 ////////////////////////////////////////////////////////////////////
80 get_contact_geom(size_t n) const {
81  nassertr(n >= 0 && n < _num_contacts, OdeContactGeom());
82  return _contact_geoms[n];
83 }
84 
85 ////////////////////////////////////////////////////////////////////
86 // Function: OdeCollisionEntry::operator []
87 // Access: Published
88 // Description: Returns the nth contact geom in the collision.
89 ////////////////////////////////////////////////////////////////////
91 operator [] (size_t n) const {
92  nassertr(n >= 0 && n < _num_contacts, OdeContactGeom());
93  return _contact_geoms[n];
94 }
95 
96 ////////////////////////////////////////////////////////////////////
97 // Function: OdeCollisionEntry::get_contact_point
98 // Access: Published
99 // Description: Returns the nth contact point in the collision.
100 // This does exactly the same as
101 // get_contact_geom(n).get_pos().
102 ////////////////////////////////////////////////////////////////////
104 get_contact_point(size_t n) const {
105  nassertr(n >= 0 && n < _num_contacts, LPoint3f::zero());
106  return _contact_geoms[n].get_pos();
107 }
108 
109 ////////////////////////////////////////////////////////////////////
110 // Function: OdeCollisionEntry::operator bool
111 // Access: Published
112 // Description: An OdeCollisionEntry evaluates to False if it
113 // holds no contacts.
114 ////////////////////////////////////////////////////////////////////
115 INLINE OdeCollisionEntry::
116 operator bool () const {
117  return (_num_contacts != 0);
118 }
119 
120 ////////////////////////////////////////////////////////////////////
121 // Function: OdeCollisionEntry::is_empty
122 // Access: Published
123 // Description: Returns true if the entry holds no contacts.
124 ////////////////////////////////////////////////////////////////////
125 INLINE bool OdeCollisionEntry::
126 is_empty() const {
127  return (_num_contacts == 0);
128 }
129 
OdeBody get_body2() const
Returns the second body in the collision.
OdeContactGeom operator[](size_t n) const
Returns the nth contact geom in the collision.
LPoint3f get_contact_point(size_t n) const
Returns the nth contact point in the collision.
static const LPoint3f & zero()
Returns a zero-length point.
Definition: lpoint3.h:258
size_t get_num_contacts() const
Returns the number of contacts in the collision.
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
OdeContactGeom get_contact_geom(size_t n) const
Returns the nth contact geom in the collision.
OdeGeom get_geom1() const
Returns the first geom 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.