Need Help Trying To Figure Out If a Geometry Contains A Point

I have a laser scanner attached to a robot and i am visualizing everything in JME. I have a model of the robot and i am displaying the point cloud. what i want to do is when i receive a point from the laser scanner check it again my virtual robots bounding box, and if it is contained in there, throw it away. i have created bounding boxes for my robot, each bounding box is a box mesh contained in a Geometry.

the code i am currently trying to use is [java]geometry.getMesh().getBound().contains(new Vector3f(x, y, z))[/java]

the problem is that this does not seem to take in account the local translation of the geometry. if i have a 1x1x1 box centered at 0,0,0 and test the point 0,0,0 this will return true, but if i set the geometry’s local translation to 20,0,0 and again check the point 0,0,0 it will also return true.
Can anyone help me with this simple problem.

i want to put a object/bounding box in the world, update its rotation and translation and then see if a point in the world is contained inside.

Thank you anyone who can assist me in this.

Remarkably this is almost identical to something I’ve done before. The way I did this was construct a ray from the laser start point and point it in the laser direction.

[java]Node shootableNode; //this will be a node to which all shootables are attached e.g. the robot (can be the root node)

Ray ray = new Ray(startPostion,direction); //get your information for this from the laser

CollisionResults results = new CollisionResults(); //this is where things you collide with will end up

shootableNode.collideWith(ray, results); //populates results
[/java]

CollisionResults has a number of methods for getting the closest collisions etc

Alternatively, why not just subtract the local node’s* co-ordinates from the input, putting the point in the “local frame”

*the one thats moved the robot

[java]robotNode.getLocalTranslation();[/java]

This is not exactly what i am looking for, i already have a simulation that does lasers in this way. My problem is simply is point A contained in object B. and subtracting the local translation does not take in account rotations of the bounding boxes

AHH i figured it out.

instead of [java]geometry.getMesh().getBound().contains(new Vector3f(x, y, z))[/java]

i should of been using [java]geometry.getWorldBound().intersects(new Vector3f(x, y, z));[/java]

@richtea said: Alternatively, why not just subtract the local node's* co-ordinates from the input, putting the point in the "local frame"

*the one thats moved the robot

[java]robotNode.getLocalTranslation();[/java]

That’s not the recommended way to do that.

Use:
robotNode.getWorldTransform().transformInverseVector()

This takes into account things like scale, rotation, parent transforms, etc.
(Use getLocalTransform() instead of getWorldTransform if you don’t want to include parent transforms).