Bullet Collision Detection & Physics Library: btPointCollector.h Source File

Bullet Collision Detection & Physics Library

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

btPointCollector.h
Go to the documentation of this file.
1/*
2Bullet Continuous Collision Detection and Physics Library
3Copyright (c) 2003-2006 Erwin Coumans https://bulletphysics.org
4
5This software is provided 'as-is', without any express or implied warranty.
6In no event will the authors be held liable for any damages arising from the use of this software.
7Permission is granted to anyone to use this software for any purpose,
8including commercial applications, and to alter it and redistribute it freely,
9subject to the following restrictions:
10
111. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
122. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
133. This notice may not be removed or altered from any source distribution.
14*/
15
16#ifndef BT_POINT_COLLECTOR_H
17#define BT_POINT_COLLECTOR_H
18
19#include "btDiscreteCollisionDetectorInterface.h"
20
21 struct btPointCollector : public btDiscreteCollisionDetectorInterface::Result
22{
23 btVector3 m_normalOnBInWorld;
24 btVector3 m_pointInWorld;
25 btScalar m_distance; //negative means penetration
26
27 bool m_hasResult;
28
29 btPointCollector()
30 : m_distance(btScalar(BT_LARGE_FLOAT)), m_hasResult(false)
31 {
32 }
33
34 virtual void setShapeIdentifiersA(int partId0, int index0)
35 {
36 (void)partId0;
37 (void)index0;
38 }
39 virtual void setShapeIdentifiersB(int partId1, int index1)
40 {
41 (void)partId1;
42 (void)index1;
43 }
44
45 virtual void addContactPoint(const btVector3& normalOnBInWorld, const btVector3& pointInWorld, btScalar depth)
46 {
47 if (depth < m_distance)
48 {
49 m_hasResult = true;
50 m_normalOnBInWorld = normalOnBInWorld;
51 m_pointInWorld = pointInWorld;
52 //negative means penetration
53 m_distance = depth;
54 }
55 }
56};
57
58#endif //BT_POINT_COLLECTOR_H
btDiscreteCollisionDetectorInterface.h
btScalar
float btScalar
The btScalar type abstracts floating point numbers, to easily switch between double and single floati...
Definition btScalar.h:314
BT_LARGE_FLOAT
#define BT_LARGE_FLOAT
Definition btScalar.h:316
btVector3
btVector3 can be used to represent 3D points and vectors.
Definition btVector3.h:82
btDiscreteCollisionDetectorInterface::Result
Definition btDiscreteCollisionDetectorInterface.h:30
btPointCollector
Definition btPointCollector.h:22
btPointCollector::setShapeIdentifiersB
virtual void setShapeIdentifiersB(int partId1, int index1)
Definition btPointCollector.h:39
btPointCollector::btPointCollector
btPointCollector()
Definition btPointCollector.h:29
btPointCollector::m_normalOnBInWorld
btVector3 m_normalOnBInWorld
Definition btPointCollector.h:23
btPointCollector::m_distance
btScalar m_distance
Definition btPointCollector.h:25
btPointCollector::setShapeIdentifiersA
virtual void setShapeIdentifiersA(int partId0, int index0)
setShapeIdentifiersA/B provides experimental support for per-triangle material / custom material comb...
Definition btPointCollector.h:34
btPointCollector::m_hasResult
bool m_hasResult
Definition btPointCollector.h:27
btPointCollector::m_pointInWorld
btVector3 m_pointInWorld
Definition btPointCollector.h:24
btPointCollector::addContactPoint
virtual void addContactPoint(const btVector3 &normalOnBInWorld, const btVector3 &pointInWorld, btScalar depth)
Definition btPointCollector.h:45