Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Recent
    • Tags
    • Users
    • Login

    Smarter way to check proximity over many objects?

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 310 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H Offline
      Helper
      last edited by

      On 01/07/2014 at 16:24, xxxxxxxx wrote:

      Hello all,

      Does anyone know or have heard about a clever, faster way to check for proximity between individual objects in large groups without a nested for loop?  I've always done:

      for object in parent.GetChildren() :
      for everyOtherObject in parent.GetChildren() :
      ##Find distance here (ouch!)
      if distance < thresholdValue:
      ##Whatever

      But it seems so dumb.  Do you guys have any suggested reading or know-how on the matter?  Seems like someone would have asked this before, but I either overlooked a post or I'm not using the right search keywords.

      Thanks a million in advance.

      1 Reply Last reply Reply Quote 0
      • H Offline
        Helper
        last edited by

        On 02/07/2014 at 05:12, xxxxxxxx wrote:

        Hi Whithers,

        You are looking for an Octree. 🙂

        https://en.wikipedia.org/wiki/Octree

        Best,
        -Niklas

        1 Reply Last reply Reply Quote 0
        • H Offline
          Helper
          last edited by

          On 02/07/2014 at 06:33, xxxxxxxx wrote:

          :gasp: 😄

          Thank you so much.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post