Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware 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
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    [Beginner:Python] Turn object into a point selection bounding box

    Cinema 4D SDK
    3
    5
    959
    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.
    • J
      joe_curwen
      last edited by r_gigante

      Hi, I would like to know how to turn any editable or parametric object (geometry) into a selection bounding box, mainly to assign vertex weight, similar to joint weight shape falloff option. Thank you!

      1 Reply Last reply Reply Quote 0
      • r_giganteR
        r_gigante
        last edited by

        Hi joe_curwen, thanks for reaching out us.

        With regard to your question, can you please elaborate more? It's not completely clear what you're attempting to achieve and we can't be of any support with more information.

        Are you thinking to use a generic geometry as a some sort of 'live selectio' tool to select all the points (of other scene entities) that are intersected by this "selecting" geometry? Or what?

        Best, Riccardo

        J 1 Reply Last reply Reply Quote 0
        • J
          joe_curwen @r_gigante
          last edited by

          @r_gigante That's exactly right, it would be a live selection tool, a piece of geometry to be intersected with other entities in the scene, the intersecting vertex points would be assigned a vertex weight, although with just selecting said intersecting point would be enough. Thank you Riccardo!

          1 Reply Last reply Reply Quote 0
          • ManuelM
            Manuel
            last edited by Manuel

            Hello @joe_curwen ,

            There's not too much in our SDK that will help you doing this. You have to find an algorithm for that.
            Your algorithm will depend on how many points you have to check. (you can even implement several)

            Questions you have to think about before implementing something :

            • how complex are your objects ? (sphere, cube, convex mesh, non-convex mesh, close, open)
            • how many points there is in both object ?
            • how robust you want your tool to be ?

            Some examples :

            Sphere collision can be simple enough, it's fast you just compare a distance between the center of the sphere and the point to know if the point is inside the sphere.

            Cube or Bounding Box collision is pretty easy and fast (AABB algorithm for example)

            For more complicate geometry you can use the ray collider
            It's basic, for each point, you cast a ray (what ever direction, but long enough) and you count the number of collision you have. If it's odd, you are inside the mesh, if it's even or none you are outside.
            (I used once this and i remember having issue if a ray hit exactly a point and return every polygon attached to that point as a "collision", so you end up with false number of collision)

            For high number of points, you have to get a region first, using a bounding box selection and rays or using a KD-Tree. (we have kd-tree in c++ but not in python).

            Hope it help
            Cheers
            Manuel

            MAXON SDK Specialist

            MAXON Registered Developer

            1 Reply Last reply Reply Quote 2
            • ManuelM
              Manuel
              last edited by

              hello,

              If you have nothing to add, this thread will be considered as "solved" tomorrow.

              Cheers,
              Manuel

              MAXON SDK Specialist

              MAXON Registered Developer

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