Skip to main content

All Questions

Filter by
Sorted by
Tagged with
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 ...
ToAskOrNotToAsk's user avatar
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 ...
nkvns's user avatar
  • 399
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 ...
aki's user avatar
  • 854
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 ...
baduker's user avatar
  • 1,378
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 ...
Ivan ZAR's user avatar
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 ...
MrYouMath's user avatar
  • 123
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 ...
Tank's user avatar
  • 185
1 vote
1 answer
1k views

Finding the distance between the two closest points in a 2-D plane

Here is my code: ...
BuluBestTapu's user avatar
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 ...
Jan Kuiken's user avatar
  • 1,523
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)...
Solomon Bothwell's user avatar
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 (...
Illia Ananich's user avatar
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 ...
Noxio's user avatar
  • 146
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 ...
TheDoctor's user avatar
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 ...
Vildnex's user avatar
  • 195
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: ...
Marcus Vinícius Monteiro's user avatar

15 30 50 per page