Questions tagged [closest-points]

107 questions
2
votes
2 answers

getClosestPoint from the mouse-cursor position to first object that hits of the raycast (maya mel script)

researching for getting a worldpoint from the mouse-cursor position to first object that hits of the raycast. maybe an api func getClosestPoint or rayIntersect can do that job ?if so how? (thank you)
Zen Of Kursat
  • 2,672
  • 1
  • 31
  • 47
2
votes
1 answer

Recursively compute closest pairs

I am trying to perform the closest pairs algorithm - there is one area however where I am totally stuck. The problem can be solved in O(n log n) time using the recursive divide and conquer approach, e.g., as follows: 1) Sort points according to…
matt
  • 83
  • 1
  • 6
2
votes
2 answers

find all values close to a target like numpy.searchsorted() but return all same values?

Is there any good ways to find all value indices in an sorted array A close to several targets? Use numpy.searchsorted() can allow us to find indices close to several targets efficiently: Finding the nearest value and return the index of array in…
Wang
  • 7,250
  • 4
  • 35
  • 66
2
votes
2 answers

How to retrieve the closest store we have placed with a marker in google maps?

Let me explain the project a bit. We have a huge list of stores with addresses. Each one of theses addresses in the database have a geo location. Now my question is: when a user fills in his address and postal code etc., we have his location and his…
Iason
  • 372
  • 1
  • 5
  • 20
1
vote
1 answer

incorrect result showing in K nearest neighbour approach

I am reforming the 2D coordinate number in a aligned way which was not aligned (coordinate numbers were suffled) before. I have below input coordinates, X = [2, 2, 3, 4, 4, 4, 4, 5, 6, 6, 6, 6, 6, 5, 4, 3, 5, 5, 5] Y = [2, 3, 3, 3, 4, 5, 6, 6, 6,…
Urvesh
  • 331
  • 4
  • 15
1
vote
0 answers

Finding closest point from a dataframe without repetition

I have two dataframes df1 and df2. I want to find the closest point from df2 corresponding to the points in the df1. Once a point is selected from df2 corresponding to the point in df1, remove it from df2 dataframe (To avoid the repetition of points…
vgb_backup
  • 49
  • 1
  • 6
1
vote
1 answer

Using ST_ClosestPoint, ST_StartPoint, and ST_EndPoint to find closest object to beginning and end points of lines

I need to find the closest points to either end of a line using geometry from two separate tables. So far I was able to use the following to find the geometry of the end points: SELECT "id", ST_StartPoint(dmp.geom) AS upstream, …
AThomspon
  • 135
  • 12
1
vote
0 answers

Closest pair algorithm why 7 points and not less

From multiple sources, I've learned that in the divide and conquer closest pair algorithm, when finding the special cases (pairs of points in different halves), you scan for at most 7 indexes ahead of any given point. When I worked it out, it seems…
Will Kanga
  • 652
  • 1
  • 6
  • 12
1
vote
1 answer

Java Find Closest Pair in Dataset gives NullPointerException

I am trying to find closest pair from a few different datasets. So far it works with the SmallerSet which has 12 points but when I change dataset which has 100 points . It's giving NullPointer Excepiton at the line that I add "--->" before the loop…
1
vote
1 answer

PostGIS: Find nearest point from a list of 3D points

Using a PostGIS databse I would like to filter from a list of points (stored as geometry in a table) the one closest to a certain point passed to the query. I have already tried ST_3DClosestPoint, but they always talk about a point on a line. How…
1
vote
0 answers

Closest Pair Algorithm: Why Won't My Code Work with Large Values?

I have recently tried to implement Closest Pair Algorithm using C++, and a huge part of my code was inspired by what I found on GeeksforGeeks. However, I can't seem to run the code with large n values. I tried entering 5,000,000 as the n value…
1
vote
2 answers

Iterating though a 2D list and put the elements in a Hashtable

I have a list of point coordinate and want to iterate through a 2D list then process the elements in the hash function to generate the key for my hashtable. I am a bit struggling to iterate through the List> points, also how to pass coordinate (x,y)…
user1712095
  • 197
  • 1
  • 3
  • 14
1
vote
1 answer

TypeError: unsupported operand type(s) for /: 'tuple' and 'int'

I'm having trouble with dealing with this error unsupported operand type error and I'm not sure what I'm doing wrong in this case. Any help would be appreciated!! def closest_pair(list): if (len(list) <= 3): return min_distance(list) else: …
Beatrice
  • 11
  • 1
  • 2
1
vote
3 answers

Closest pair algorithm from (n log^2 n) to (n log n) time

I am trying to understand how to go from n log^2 n time to n log n time for the closet pair algorithm. I get the below part (from http://www.cs.mcgill.ca/~cs251/ClosestPair/ClosestPairDQ.html) Divide the set into two equal sized parts by the line…
max_max_mir
  • 1,494
  • 3
  • 20
  • 36
1
vote
2 answers

Closest pair of points (CLRS pg 1043): Running time of splitting a sorted array into two sorted arrays

In finding the closest pair of points in O(nlgn) time, the pseudocode for splitting a sorted list into two sorted lists (CLRS 3rd ed pg 1043) is said to run in O(n) time. However, this assumes that line 4 runs in constant time, which I find hard…
max_max_mir
  • 1,494
  • 3
  • 20
  • 36