Skip to content

Commit a4f0934

Browse files
committed
Merge from upstream
2 parents 8ac78b7 + f0a2afc commit a4f0934

File tree

12 files changed

+103
-117
lines changed

12 files changed

+103
-117
lines changed

CONTIRBUTORS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@
1313
- Songzhuozhuo '[souo](https://github.com/souo)'
1414
- Emil '[Skeen](https://github.com/Skeen)' Madsen
1515
- Ian '[IanDoarn](https://github.com/IanDoarn)' Doarn
16-
- Timothy '[Tjstretchalot](https://github.com/Tjstretchalot)' Moore
16+
- Timothy '[Tjstretchalot](https://github.com/Tjstretchalot)' Moore
17+
- Sharad '[sharadbhat](https://github.com/sharadbhat)' Bhat
18+
- Alexey '[aesee](https://github.com/aesee)' Sarapulov
19+
- Anthony '[MrDupin](https://github.com/MrDupin)' Marakis

pygorithm/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727
Emil 'Skeen' Madsen
2828
Ian 'IanDoarn' Doarn
2929
Timothy 'Tjsretchalot' Moore
30+
Sharad 'sharadbhat' Bhat
31+
Alexey 'aesee' Sarapulov
32+
Anthony 'MrDupin' Marakis
3033
3134
"""
3235

pygorithm/data_structures/modules.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

pygorithm/fibonacci/modules.py

Lines changed: 0 additions & 20 deletions
This file was deleted.

pygorithm/geometry/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@
55
from . import axisall
66
from . import line2
77
from . import polygon2
8+
from . import rect_broad_phase
89

910
__all__ = [
1011
'vector2',
1112
'axisall',
1213
'line2',
13-
'polygon2'
14+
'polygon2',
15+
'collision_detection.py'
1416
]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""
2+
Author: ALEXEY SARAPULOV
3+
Created On: 23 August 2017
4+
"""
5+
6+
# To test if two rectangle intersect, we only have to find out
7+
# if their projections intersect on all of the coordinate axes
8+
9+
import inspect
10+
11+
12+
class Coord:
13+
"""Coord
14+
Class to initialize Coordinate of one point
15+
"""
16+
17+
def __init__(self, x, y):
18+
self.x = x
19+
self.y = y
20+
21+
22+
class SimpleRectangle:
23+
"""SimpleRectangle
24+
Class to initialize Body of Object
25+
"""
26+
27+
def __init__(self, coord1, coord2):
28+
"""
29+
:type coord1: object of class Coord
30+
:type coord2: object of class Coord
31+
"""
32+
self.min_x = coord1.x
33+
self.min_y = coord1.y
34+
self.max_x = coord2.x
35+
self.max_y = coord2.y
36+
37+
38+
def broad_phase(simpleRect1, simpleRect2):
39+
"""
40+
:type simpleRect1: object
41+
:type simpleRect2: object
42+
"""
43+
d1x = simpleRect2.min_x - simpleRect1.max_x
44+
d1y = simpleRect2.min_y - simpleRect1.max_y
45+
d2x = simpleRect1.min_x - simpleRect2.max_x
46+
d2y = simpleRect1.min_y - simpleRect2.max_y
47+
48+
if d1x > 0 or d1y > 0:
49+
return False
50+
51+
if d2x > 0 or d2y > 0:
52+
return False
53+
54+
return True
55+
56+
57+
def get_code():
58+
"""
59+
returns the code for the broad phase function
60+
"""
61+
return inspect.getsource(broad_phase)

pygorithm/math/modules.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

pygorithm/pathfinding/modules.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

pygorithm/searching/modules.py

Lines changed: 0 additions & 14 deletions
This file was deleted.

pygorithm/sorting/modules.py

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)