All Questions
24 questions
1
vote
2
answers
264
views
Closest Pair of Points - Optimizing Code for big sets of points
I'm trying to create an algorithm that finds the closest pair of points (2D) within a set of points. I'm using a divide and conquer method which is explained here Closest Pair of Points Algorithm.
...
7
votes
3
answers
3k
views
Determine if a triangle is equilateral, isosceles, or scalene
I've been fiddling around with some easy code challenges and there's one about determining if a triangle is equilateral, isosceles, or scalene.
I've come up with a working solution, but I feel this ...
7
votes
4
answers
28k
views
Algorithm to get an arbitrary perpendicular vector
Is there a more efficient/direct way to find an arbitrary perpendicular vector of another vector?
...
5
votes
3
answers
220
views
Detect loop in rectilinear path
Given a rectilinear path, find if it has a loop. A rectilinear path is made up of made up of alternating horizontal and vertical segments.
Input => Ordered set of points representing ra ectilinear ...
3
votes
0
answers
78
views
Python: Algorithm for fast boundings box collision between two large sets of m and n rectangles
AABB: Axis Aligned Bounding Box
ALGORITHM:
Compare m number of AABB to n number of AABB to find if there is a collision between m and n sets.
PROBLEM:
Slow implementation for large number of ...
11
votes
3
answers
7k
views
Python implementation of the Ramer-Douglas-Peucker Algorithm
I recently implemented the RDP polygon approximation algorithm in Python and I'm skeptical of whether or not I implemented it correctly of with the greatest efficiency. The algorithm runs in around 0....
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):
<...
4
votes
2
answers
3k
views
Find the largest area polygon built from a given list of vertices
This is code that gets a list of polygon vertices, non-ordered, and finds the order in which they should be arranged in order to create the polygon with the largest area.
There are two key elements ...
10
votes
2
answers
244
views
Where is the most desolate place in Colorado?
The Story
While flying a plane over the forests of Wisconsin a couple years ago, I thought to myself "If I lost an engine, I would be awfully long way from an emergency landing airport. I wonder ...
6
votes
1
answer
944
views
Choosing evenly distributed points from a million points on a sphere
I have \$10^5\$ to \$10^6\$ points on a sphere, and want to choose some points from them which are as close as uniformly distributed as possible. For that reason, I do the following: at each step I ...
5
votes
2
answers
14k
views
Closest distance between points in a list
In a course I'm doing, I was given the task of finding the closest pair of points among the given points. The program that passed all test cases was the following:
...
5
votes
2
answers
3k
views
Given a list of coordinates check if 4 points make a line
I was doing some preparation for coding interviews and I came across the following question:
Given a list of coordinates "x y" return True if there exists a line ...
6
votes
1
answer
591
views
Searching extreme points of polyhedron
In my Uni, my scientific professor asked me to make some researches about the extreme points of polyhedrals. And I did them. I found that there is still no code in public for searching extreme points ...
12
votes
1
answer
7k
views
2D Bin Packing Algorithm Implementation
I wrote a 2D greedy bin packing algorithm using Python 3.6
Heres a quick summary:
The algorithm consists of two classes (which I will attach at the end of this file along with a link to my github repo)...
6
votes
1
answer
2k
views
Finding overlaps between two lists of axis-aligned rectangles
I am trying to find an efficient solution for finding overlapping of n rectangles where rectangles are stored in two separate lists. We are looking for all rectangles in ...