-
Notifications
You must be signed in to change notification settings - Fork 0
/
collide.h
70 lines (55 loc) · 1.31 KB
/
collide.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*
* Copyright (c) 2006-2007 Erin Catto http://www.gphysics.com
*
* Permission to use, copy, modify, distribute and sell this software
* and its documentation for any purpose is hereby granted without fee,
* provided that the above copyright notice appear in all copies.
* Erin Catto makes no representations about the suitability
* of this software for any purpose.
* It is provided "as is" without express or implied warranty.
*/
#ifndef COLLIDE_H
#define COLLIDE_H
#include "mathutils.h"
extern int debug;
struct Edges
{
char inEdge1;
char outEdge1;
char inEdge2;
char outEdge2;
};
struct Contact
{
struct Vec2 position;
struct Vec2 normal;
struct Vec2 r1, r2;
float separation;
float Pn; // accumulated normal impulse
float Pt; // accumulated tangent impulse
float Pnb; // accumulated normal impulse for position bias
float massNormal, massTangent;
float bias;
struct Edges feature;
};
struct Body
{
// Body();
// void Set(const Vec2& w, float m);
// void AddForce(const Vec2& f)
// {
// force += f;
// }
struct Vec2 position;
float rotation;
struct Vec2 velocity;
float angularVelocity;
struct Vec2 force;
float torque;
struct Vec2 width;
float friction;
float mass, invMass;
float I, invI;
};
int Collide(struct Contact* contacts, struct Body* bodyA, struct Body* bodyB);
#endif