All Questions
Tagged with computational-geometry python-3.x
23 questions
1
vote
2
answers
100
views
2D Point subclass of complex builtin
I'm writing a pure-python geometry tool for technical drawings / computational geometry (not a solver, as a solver has to work with constraints). I've already mentioned a previous version on code ...
6
votes
3
answers
282
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 a rectilinear ...
1
vote
2
answers
308
views
Read coordinates from many files and calculate polygon areas
My goal with this snippet is to create an array of coordinates which in turn is a tuple of 68 elements, area and modified area array for all 10k elements and assign it to the ...
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
0
answers
5k
views
Cubic spline interpolation in Python from scratch
I implemented the cubic spline interpolation explained in
https://en.wikipedia.org/wiki/Spline_interpolation as a Python class. Of course, such an interpolation should exist already in some Python ...
2
votes
1
answer
239
views
Curvature data to coordinates
I want to determine a path (x and y coordinates) by using curvature data (radius, with constant distance (length_of_arc) travelled between data points. I want to ...
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 ...
1
vote
1
answer
1k
views
Finding the distance between the two closest points in a 2-D plane
Here is my code:
...
6
votes
1
answer
3k
views
Solver for some simple tangrams
I decided to write a program to solve Tangram puzzles. This went a bit out of hand and I ended up with 600+ lines of code. I don't think it should have taken so much code.
Here is an image of a ...
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)...
4
votes
1
answer
259
views
Count lines with more the X dots on it
I have Python a Algorithm class with a calculate method that takes the list of tuples where every tuple have 2 integers (...
5
votes
1
answer
1k
views
Shortest path around a set of points
Problem
I'm trying to get into Python and get a bit familiar with it, so I found a problem online to train. The problem was to find the shortest path around some points, given a set of nodes which ...
7
votes
1
answer
2k
views
Calculate angle between planes
I have written working code calculating the angle between the adjacent planes.
I read subsequently from standart input:
n - amount of triangles,
m - amount of vertices
ind[] - indices of the vertices ...
2
votes
2
answers
531
views
Python Kohonen algorithm
I've tried to implement the Kohonen algorithm using Python and I've managed to do this, but my result is so slow. I want to know if anyone knows how I can improve it.
Objective:
I have to read a file ...
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:
...