Questions tagged [closest-points]

107 questions
1
vote
1 answer

How do I find the (x, y) coordinates of the point q on a closed 2D composite Beziér curve closest to the (x, y) coordinates of some arbitrary point p?

I have a set of 2D Cartesian points [b], which proceed clockwise from the start and form a closed shape. Each one of these has its own companion 2D Cartesian points q0 and q1 which define the Beziér curve around the point (along with the preceding…
Ky -
  • 30,724
  • 51
  • 192
  • 308
1
vote
2 answers

Why am I receiving a Stack overflow error?

The following code simulates finding the closest pair but when I generate a random amount of pairs greater than 250 it throws a stack overflow error. But 250 pairs and any even amount under seem to work fine. Any ideas? The error occurs at the…
1
vote
1 answer

how to hatch turtles that face closest neighbor of agentset doing the hatching

I currently have one agentset(ports) hatching another agentset(ships). The idea is to have the ships face the closest port to their current location. [let target min-one-of ports [distance myself] face target]. Unfortunately this makes the ships…
mowgly
  • 77
  • 8
1
vote
1 answer

Closest pair of points using sweep line algorithm in Java

First off; I'm doing this as an assignment for school, and that's why I'm using the sweep line algorithm. I'm basing it off of the pseudocode given by my teacher. I've done an implementation of my own using TreeMap instead of a balanced binary…
Cethy
  • 551
  • 6
  • 18
1
vote
1 answer

Reduce Complexity. Find closest pair of latitudes and longitudes

I have two arrays representing two different GPS paths. Each array contains latitudes in the even indices(starting from 0) and longitudes in the odd indices as shown below…
Lawrence
  • 427
  • 5
  • 15
1
vote
1 answer

Explain working of compareX in qsort() library function

I was searching for the closest pair code and i found this which has used qsort() library function. I basically didn't get the concept of how it's compare parameter works. Explanation related to this particular code will be more appreciated.…
lethal
  • 39
  • 2
  • 9
1
vote
3 answers

Finding closest (not equal) rows in two matrices matlab

I have two matrices A(m X 3) and B(n X 3); where m >> n. Numbers in B have close or equal values to numbers in A. I want to search closest possible values from A to the values present in B in a way that at the end of search, A will reduced to (n X…
Mushi
  • 367
  • 2
  • 4
  • 14
1
vote
0 answers

Closest-points set on simplicial complex

Given two (low-dimensional, probably 2D) simplicial complexes P and Q, is there an efficient algorithm for constructing P', the subset of P consisting of all points in P which are the closest point to some point q in Q? For instance, if P and Q were…
Sneftel
  • 40,271
  • 12
  • 71
  • 104
1
vote
3 answers

Closest pair of ten integers with only primitive data type in python

I really need help with the code. The user need to input 10 integers and the program must display the closest pair. I was able to do it using itertools but my prof won't accept the .sort (), min(), enumerate(), etc... I need to do it manually.…
Teacher Ai
  • 131
  • 1
  • 2
  • 9
0
votes
1 answer

Most suitable Closest Neighbor Search for 2D points

This problem arises from creating closest pair of nodes from two sets/surfaces in a FEM mesh. Here the basic logic of what I am trying to do: I have two surfaces/sets of nodes which are coplanar (can be treated as 2D even if it's a 3D space). From…
adeleo
  • 1
  • 1
0
votes
0 answers

Find the best rigid transformation (Rotation + translation) for two 2d small PointSet (Python)

Consider two sets of points, A and B as shown below. Ax = [-2.0, 20.0, -16.0, 6.0, 7.0, -9.0, 25.0, -26.0, -24.0, 11.0, 0.0, 20.0, -8.0, 21.0, -0.0, -21.0, -20.0, 13.0, -22.0, 19.0, -13.0] Ay = [-25.0, -14.0, -20.0, -20.0, 26.0, 24.0, -0.0, 0.0,…
0
votes
1 answer

O(n) solution for a one dimensional closest pair problem?

So, I am currently learning about closest pair algorithms and found this problem in a text book: Assume you have a sorrted Array of length n that contains one Dimensional points (integers) and are coloured. Now you want to find the closest pair of…
Chris c
  • 3
  • 2
0
votes
0 answers

Smallest Distance between 2 points in field

I have a set of points denoted by (x y) coordinates in a space with a specified width and height, let's call this set s. Given any point p (p is not necessarily in s), I want to find the point q in s, such that the distance between p and q is…
ronalama
  • 39
  • 1
0
votes
0 answers

Why do we compare at most 7 rather than 5 points in the closest pairs algoirithm?

I understand that we keep a constant δ value between points, and so at best create a grid of 8 points in a 2δ x δ rectangle. However, if we try and maximise the number of delta nearest points on such a grid, then theoretically our selected point…
Ahmed
  • 11
  • 3
0
votes
0 answers

ClosestPair distance

Can anyone please explain what each of these two functions do, and what could be a simplified equivalent function to each of them? def dist(p1, p2): return math.sqrt((p1.x - p2.x) * (p1.x - p2.x) + …
kezah
  • 13
  • 5