Notifications
Clear all

[Closed] test a vertex that it is inside an object or not

Hello there, long time no see.

I wonder if anyone have an idea how to fill up an object with vertices, that are never outside the volume. Basically I want to test that vertice is inside an object or not.

Basically the whole thing started from that I wrote a litle script that wireizes an object. It works by using edges and vertices. I want to have wires inside the object as well.

Now, knowing that the vertex I create is inside an object would greatly help.

here ares mall examples of what it does

4 Replies

I think the easiest way would be to use pflow to create particles distributed inside the object’s volume and then use a script to build vertex for every particle.

Thanks well, I thought I would manage by programming, but if nothing else then I would use this idea.

You could create a script that builds the pflow system for you and delete it after it gets all the vertexes.

There is another way that I found to test if a point is inside an object or not.
This algorithm assumes that the object is closed, if the object has open areas, the algorithm won’t work in 100% of the times.

  1. pick a direction vector (for example [0,0,1])
  2. assuming the object has uniform normals pointing out of the volume, add a normal modifier and flip the object’s normals to direct into the volume.
  3. fire a ray from the point in the picked direction at the object.
  4. if there was no intersection, then the point is outside of the volume, else continue to 4
  5. disable the normal modifier so that the normals of the object will point outside the volume again.
  6. fire the same ray as before at the object again.
  7. if there was no intersection this time, then the point is inside the object, else continue to 7.
  8. if the distance from the point to the first hit is smaller then the distance from the point to the second hit, then the point is inside the object, else it’s outside.
    end

the cons of this method are slow runtime compare to pflow and problems dealing with open geometry.

This one is very good idea thanks,
Maybe I will try both.