Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8915997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T05:07:19+00:00 2026-06-15T05:07:19+00:00

I have created a structure and populated an array with variables that can be

  • 0

I have created a structure and populated an array with variables that can be thought of as coordinates in the x y z plane, or as distance in 3 dimensions from a point.

for (a=1; a<=lst; a++) {
for (b=1; b<=hst; b++) {    
        for (c=1; c<=wst; c++) {

    point[d].x=a*k+px;
    point[d].y=b*k+py;
    point[d].z=c*k+pz;
    d++;

    }
    }
}

The variables px … are there as random additions a fraction of the generic k to make a less ‘rigid’ cube. I would like to identify ‘points’ that are within a given radius of a chosen ‘point’ in an iteration of a loop that runs for as many times as there are points. However, I would like to do this without running a loop to check every single point in the point[num] array to see if it is close. Is there anything I can do to avoid this without doing a check which is based on the order of the point in the point[num] array?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T05:07:20+00:00Added an answer on June 15, 2026 at 5:07 am

    I can see two good ways to do this.

    1. If the points you are looking for are in some ordered axially aligned grid, then you can access the ones that are in a certain radius immediately. The way to do this is to get the x, y, z point and convert it to its grid position along with the radius to define the min and max grid positions for x, y, and z. You can then access those variables immediately.

    2. If the points are not in a form that’s not axially aligned and ordered into a grid then you need to put it inot a form that will be quick to search. I would suggest the kd tree. It takes a searching operation from being O(n) to O(log(n). The way it does it is to split the point set in half along the mean and repeat untill you have a fast searchable tree:

    enter image description here

    The PCL (point cloud Library) will do this for your as well!

    Here is a link:

    http://pointclouds.org/

    And a tutorial on kd trees with pcl:

    http://pointclouds.org/documentation/tutorials/kdtree_search.php#kdtree-search

    In fact it even shows you the code for a radius search from an entered point into a kd tree stored point cloud. Look at neighbours in radius search on the tutorial page i have provided.

    Good Luck!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data structure created using read.csv() of dimensions 130, 395. I am
I have created a class of type BaseAdapter that is populated with buttons -
I have created a Structure for my XML to work with JAXB Unmarshalling The
I have created a directory structure with an executable file. Following is the output
I have created the following project structure for my new asp.net mvc project any
I have created a table with the following structure- $sql = CREATE TABLE followers
I have created a procedure with this structure but it doesn't work for datetime
I have created a JSF 2 page which uses Facelets to define the structure
I have created a table on an Oracle 10g database with this structure :
Hey Guys, i have created the following Menu Structure: <div id=menu> <ul> <li><a href=#>Main

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.