+ Reply to Thread
Results 1 to 10 of 10

Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinates

  1. #1
    Registered User
    Join Date
    07-26-2022
    Location
    Charlotte, NC
    MS-Off Ver
    2018
    Posts
    4

    Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinates

    Hello All,

    I have a list of coordinates in 3D space (X,Y,Z) of a couple thousand points. These points represent the midpoint of a line in 3D space. Ideally, two points would be exactly the same (due to two lines intersecting in 3D space at their midpoint) so if my data contained 2000 points, only 1000 would be unique. However, this is not the case and the two points that should be identical are simply very close to each other. The data that I have is scrambled. What I would like to do is sort my data so that two points that should be the same are next to each other. Attached is a sample file of what I have and what I would like. I also showed an example of sorting by one criteria only (one axis) but how that can lead to erroneous results. I've been wrecking my brain for a while trying to figure this one out and would greatly appreciate some input.

    Thank you for reading!
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,820

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    How much of this is geometry, how much is algorithm development, and how much is specific to Excel/spreadsheets? Your example of sorting on X coordinate suggests to me that you are more in the algorithm development stage, which is kind of separate from the programming phase.

    That said, my first thought was an algorithm based on distance. Calculate the distance between each possible pair of points, then either sort them and the closest points with a distance near 0 rise to the top, or identify those pairs of points that are within tolerance of 0 units. Does that sound like a workable algorithm? It seems to work on this data set.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    Post deleted
    Last edited by kvsrinivasamurthy; 07-27-2022 at 02:11 AM.
    Pl note
    Array formula should be confirmed with Ctrl+Shift+Enter keys together.
    If answere is satisfactory press * to add reputation.

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    Slight clarification required.
    In your expected result Do you mean,
    1 is nearest to 5, then 2 is nearest 1, then 4 is nearest 2, so on
    Last edited by kvsrinivasamurthy; 07-27-2022 at 04:24 AM.

  5. #5
    Registered User
    Join Date
    07-26-2022
    Location
    Charlotte, NC
    MS-Off Ver
    2018
    Posts
    4

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    MrShorty, that is a great question that I'm not entirely sure. I actually did create an algorithm based on distance but that also provided some erroneous results. For instance, the distance from 0,0,0 to 3,3,3 is exactly the same as the distance to -3,-3,-3. So if I was to sort by distance, my sorting would then tell me that those two points are next to each other when in fact they are not. I was thinking I may need to write some piece of code (in another program that I'm more familiar with its coding syntax) in order to do what I want. However, I was hoping there was a tool in Excel that would help me sort by multiple criteria simultaneously as opposed to one at a time.


    kvsrinivasamurthy, I care that 1 is near to 5, 4 is near to 2, and 6 is near to 3 because those pairs should be the exact same point in 3D space. I'm not really concerned that 2 should be next to 1 or 3 next to 4 in the sorting because those are two far away points in 3D space. I hope this clarified things but let me know if it didn't.

  6. #6
    Registered User
    Join Date
    07-26-2022
    Location
    Charlotte, NC
    MS-Off Ver
    2018
    Posts
    4

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    MrShorty, I misread part of your response. Your suggestion was to calculate the distance between each possible pair of points and then do the sorting. That's what I'm thinking of doing now as the approach that I described previously did not work for 100% of the data. To be honest, I don't know how to do that in Excel but I may be able to figure it out in MathCad.

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    Is this way
    Select 1 nearest is 5
    Select 2 nearest is 4
    Select 3 nearest is 6
    So on.........
    Last edited by kvsrinivasamurthy; 07-27-2022 at 11:19 AM.

  8. #8
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,820

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    Excel's built in sort utility (https://support.microsoft.com/en-us/...8-15cbb7712539 ) can sort on multiple criteria, but I don't see how to arrange those criteria in a way that is truly spatially aware in 3 dimensions. I don't understand your -3,3,3 to 0,0,0 to 3,3,3 example, because no pair in those three points seems particular close. A simple threshold test (are these points within threshold units distance of each other) would prevent detecting these as being the same point.

    That said, I am unaware of any built in or pre-programmed utility for Excel that has the spatial awareness needed for this kind of problem. If others are aware of something, then I invite them to comment. If you already know how to do this in another program or programming language, you are probably better off using that than trying to coax a spreadsheet into doing it. I have no doubt that a spreadsheet can be programmed to do this, but it will almost certainly be easier for to use something you are already familiar with.

  9. #9
    Registered User
    Join Date
    07-26-2022
    Location
    Charlotte, NC
    MS-Off Ver
    2018
    Posts
    4

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat


  10. #10
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Finding Same Point in 3D Space and Sorting Next to Each Other Based on Their Coordinat

    spherical coords?
    r
    Please Login or Register  to view this content.
    φ(rad)
    Please Login or Register  to view this content.
    ϴ(rad)
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by protonLeah; 07-28-2022 at 02:30 PM.
    Ben Van Johnson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Chart Point Coordinates from Plot Picture
    By jefflabuz in forum Excel Charting & Pivots
    Replies: 4
    Last Post: 06-06-2022, 12:58 PM
  2. Calculate new point coordinates after rotation
    By Evripos in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-21-2021, 10:09 AM
  3. X and Y coordinates, locating closest Point to point distance.
    By Erav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2020, 04:02 PM
  4. Problem to find the coordinates of a point on a graph
    By rapha9 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-03-2013, 12:50 PM
  5. Convert point coordinates -> pixel coordinates
    By Zorro in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-31-2006, 10:30 PM
  6. [SOLVED] How to get x,y coordinates of point from scatter chart in VBA
    By Milo in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-28-2005, 08:25 PM
  7. finding the coordinates of the maximum point on a graph
    By eastham85 in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 01-16-2005, 10:06 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1