-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGJK.h
48 lines (40 loc) · 934 Bytes
/
GJK.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
#pragma once
#include "stdafx.h"
#include "Object.h"
class Simplex
{
public:
std::vector<sf::Vector2f> points;
void Add(sf::Vector2f a)
{
points.push_back(a);
}
sf::Vector2f getLast()
{
return points[points.size()-1];
}
void Remove(int a)
{
points.erase(points.begin() + a);
}
void Insert(sf::Vector2f point, int a)
{
points.insert(points.begin() + a, point);
}
};
class GJK
{
public:
GJK();
//void Check(std::vector<std::vector<Object*>>, std::vector<std::vector<Object*>>);
bool Check(Object*, Object*);
bool containsOrigin(sf::Vector2f&);
//sf::Vector2f tripleProduct(sf::Vector2f, sf::Vector2f, sf::Vector2f);
sf::Vector2f support(Object*, Object*, sf::Vector2f);
sf::Vector2f GetFarthest(std::vector<sf::Vector2f>, sf::Vector2f);
//sf::Vector2f Cross(sf::Vector2f, sf::Vector2f);
//float Dot(sf::Vector2f, sf::Vector2f);
//sf::Vector2f Normalise(sf::Vector2f);
Simplex simplex;
private:
};