ScriptSpot home

Forum topic · General Scripting

Is the Point in a Volume?

By schaf82 · 2007-02-19

Description

Hello

 

i have a smale problem. I am searching for a cheap solution how i can find (in maxscript) out if a point is in a volume or not

 

thx

 

 

Comments (3)
nykster

 

Hello,

I never tried to do that, but here's a solution that you could use, if your volume is a simple box, not a complex mesh.

Compare your vertex.pos.x and the volume.min.x and volume.max.x

Do the same for the 3 axis. If your vertex is between the min and max on the 3 axis, it should be in the volume...

Hope this helps...

-Nykster

Reply to nykster
schaf82

i was looking for a funktion for random volumes but i've found something.

the problem is called point containment problem and there some ways to solve it.

maeh maeh

schaf

Reply to schaf82
arketip

If you look for a fast method:

1) first, you should search if the point is inside the bounding box.

2) if it is the case, then you search the closest face near your point. You take the normal of this face and if the normal isn't oriented to your point (but at the opposite), you could assume that it is inside the volume...

Of course it is an approximation.

This should work for convex volumes.