sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Face or line or vertex inside a solid

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 2 Posters 136 Views 2 Watching
    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.
    • voljankoV Offline
      voljanko
      last edited by

      Hello,
      does anybody ever tried to calculate if a line (edge) or face or vertex is inside (without touching it's shell) a solid body.It's seems to be a very hard mathematical task.Is there any ruby function that can help?
      Thanks.
      David

      SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

      1 Reply Last reply Reply Quote 0
      • TIGT Offline
        TIG Moderator
        last edited by

        For a tested_face intersect it with the solid_object's entities - put the results into a temporary+group's entities, so you cab check if there are any and erase that group.
        If there are intersection entities then it intersects.
        Now it could still be fully inside the solid OR fully outside the object.
        You cab text if the bounding boxes intersect but that's not a certainty.
        Hide everything except the object and test the faces vertices with a model.raytest([vpoint, Z_AXIS], true)
        If there's no result it's outside of the object.
        If there's a result that includes the object then it's either inside the object or below the object [or 'below' some part of it - e.g. it's a hollow donut ring on its side].
        If it's 'below' the object then the face the ray hits will have face.normal.z<0
        If it's inside the object then the face the ray hits will have face.normal.z>0
        If it hits an edge rather than a face there will be two edge faces... you can get the normals of those faces and the angles they make with the Z_AXIS...
        If both angles <= 90.degrees then the tested face is inside the object, otherwise it's outside.
        You might also want to test for the face having a vertex being coplanar with one of the object's faces... i.e. neither inside or outside the object - if "on==in" you need an extra set of tests...
        To do that iterate all of the object's entities to collect the faces and then test each of the vpoints with face.classify_point(vpoint) and from the result you can tell if the tested_face's vertices fall on any of the object's faces [or their edges/vertices]...
        It's NOT easy BUT it is doable... πŸ€“

        TIG

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          You'd have to do multiple tests for each point and then the raytest[0] point etc.
          You'll have to hide everything else first ?
          Test it - if it works post some code...

          TIG

          1 Reply Last reply Reply Quote 0
          • voljankoV Offline
            voljanko
            last edited by

            Hello Tig,
            I have also thought about rays.
            What do you think about this solution:
            If the tested object and a solid are not intersecting.
            If a ray from a tested object hits faces of a solid odd number of times ,the tested object is inside the solid.
            If the ray hits an edge or a vertex,repeat the ray test in other direction.
            David

            SuSolid.com - solid check - solid repair- solid intersection check - weight plugin

            1 Reply Last reply Reply Quote 0
            • 1 / 1
            • First post
              Last post
            Buy SketchPlus
            Buy SUbD
            Buy WrapR
            Buy eBook
            Buy Modelur
            Buy Vertex Tools
            Buy SketchCuisine
            Buy FormFonts

            Advertisement