Skip to content

Commit 7934eee

Browse files
authored
Update README.md
1 parent 1373f24 commit 7934eee

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

README.md

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,29 @@
11
# olcUTIL_Geometry2D
2-
A rare public repo for getting this utility file across the finish line
2+
A stand-alone single header file that handles many and various 2D geometric interactions.
33

4-
The olcPixelGameEngine is still a popular way to prototype ideas and create games in C++. To accompany it, I have created a set of "utility" files that encapsulate common functionality found in games and applications.
4+
**NOTE! The olc::PixelGameEngine is NOT required to use this file, though it works very well with it!**
55

66
The Geometry2D (& PGE) utility file defines:
77
* Points
88
* Lines
99
* Circles
1010
* Rectangles
1111
* Triangles
12+
* Rays
1213

1314
I would like this file to provide functions that cover every combination Shape Vs Shape for the following functions:
14-
1515
* [true/false] **contains** (Shape A, Shape B) - Shape B entirely exists with Shape A. Points from Shape B can touch Shape A boundary.
1616
* [true/false] **overlaps** (Shape A, Shape B) - Some part or Shape A and some part of Shape B occupy the same 2D space.
1717
* [vector<points>] **intersects** (Shape A, Shape B) - Return all points (or none) where the boundaries of Shape A and Shape B overlap.
18+
* [optional<point>] **project** (Shape A, Shape B, Ray) - Project Shape A along Ray until it is in contact with Shape B (or not).
19+
* [optional<normal, double>] **collide** (Shape A, Shape B, Ray) - Check if Shape A, when moved along Ray, collides with Shape B. If it does, return the distance along the ray and the normal of Shape B at the point of collision.
20+
* [optional<ray>] **reflect** (Ray A, Shape B) - Return a ray (if possible) that is a reflection of incident Ray A, when reflected off Shape B.
21+
* [point] **closest** (Shape A, Shape B) - Return a point on Shape A, which is closest to any part of Shape B.
22+
* [point] **constrain** (Shape A, Point B) - Return a point within Shape A closest to Point B.
1823
* [circle] **envelope_c** (Shape A) - Return a minimum size circle shape that fully encapsulates Shape A
1924
* [rect] **envelope_r** (Shape A) - Return a minimum size rectangle shape that fully encapsulates Shape A
2025

21-
In total there are 25 potential **contains**, 25 potential **overlaps**, 25 potential **intersects** and 10 potential **envelopes**, which need some maths to think about and some C++ expertise to implement efficiently. In short, it's a lot of work! There are many already implemented, but I've left a "TODO" where I think there is something missing. I know many of the community have code snippets buried away somewhere that satisfy some of these functions.
22-
23-
All contributors will becredited in the header file, and this will be a fantastic resource/reference for those that might need a function or two for their other projects!
26+
This project is a collaborative effort, and a continuous "Work-In-Progress" - If you feel you can contribute then please do so! There are many functions required, and we've not yet implemented all of them. Check the header file for the completion matrix. All contributors will becredited in the header file, and this will be a fantastic resource/reference for those that might need a function or two for their other projects!
2427

2528
**So, please, help me!**
2629

0 commit comments

Comments
 (0)