Skip to main content

All Questions

Tagged with
7 votes
2 answers
8k views

Find the intersect area of two overlapping rectangles

This is my solution to find the coordinates of 2 overlapped rectangles implemented in JavaScript. Each rectangle is represented by 2 points, each with 2 (x,y) coordinates. Can this code be improved?...
Achref Boukhili's user avatar
6 votes
1 answer
404 views

Handling collision on a turn-based 2D game

I have implemented a collision check algorithm that I have created for my game, and the algorithm uses recursion. Now it all works fine, and I thought to myself, what if there was a way to solve this ...
Ben Beri's user avatar
5 votes
0 answers
238 views

Spacial hashing Library

Old code ...
Tobi's user avatar
  • 241
2 votes
2 answers
2k views

High performance, branchless Intersection testing: sphere-aabb & aabb-aabb

From my tests: AABB-Sphere: 2954.8 tests per ms. AABB-AABB: 1087.0 tests per ms. The sphere test is almost 3 times faster, but the two intersection tests seem to perform about the same number ...
jpx's user avatar
  • 29
11 votes
1 answer
586 views

Bounding volume hierarchy

I'm building a bounding volume hierarchy in Golang. I can tell my code works because I did some test on it and it gives the same results as the brute force implementation (brute force is to test all ...
user avatar
9 votes
1 answer
13k views

Line segment to circle collision algorithm

I've written a function (in Python 3) which computes if a line segment (constraint) and a circle (body) collide, and returns the point of intersection (closest point to the centre of the circle): <...
Tochi Obudulu's user avatar
3 votes
1 answer
675 views

Intersection-detection algorithm

This is an intersection-detection algorithm I developed as an alternative method to the one developed for my coursework. I won't post some of the other functions as they are used in the coursework too,...
user avatar