# Bounding Boxes, or doing it buy hand?

Hello all,

I wondered if someone could help me, this maybe two questions in one. Browsing the site and searching I can’t seem to find a good tutorial on the bounding box functionality. Could someone point me right direction?

The second question is this, all I want to do is test whether a vector3f is within a specific cube volume.

In laman’s terms, I would suspect that to be checking if the vector is less than vector b, or greater than vector a. Vector A being the corner of the cube closest to the origin and Vector B being the opposite corner furthest from the origin.

Is the only current way to do this, is to get the x,y,z component of the vector and compare?

I’m guessing that I can use the bounding box functionality for this, but it seems like a sledgehammer to crack a walnut?

Many thanks,

Oriented bounding box or axis aligned?

[java]BoundingBox box = (BoundingBox) model.getWorldBound();

Geometry selectionGeom = new Geometry("", new Box(box.getMin(null), box.getMax(null)));[/java]

[java]if(spatial.getWorldBound().intersects(vector3fLocation)) {

//the Vector3f location is inside the boundingBox of spatial

}[/java]

Hey Guys,

Sorry for the delay and thanks for the responses, they really helped.

In the end, I investigated the boundingbox class to see how they did the intersect checks. For me I just needed to determine if a vector was within a particular space.

The way I have structured me code, it seems cleaner to implement a similar method. As all my sectors are cubes; it was sufficient to find the center of cube and then test if the point with within its extents.

That of course may all change later But does what I want for the moment.

The delay was mostly caused by re-factoring large chunks of my code, to implement the center of each sector being stored and using this information.

1 Like