# 3D extents

Does anyone know of a method to calculate the extents for all 3D objects in a scene?
So I want x_min,x_max........z_max calculated by comparing each solid after any transformations.

## Comment viewing options

### Re: 3D extents

@Soundbomber

Why do you want AABBs?

### Re: 3D extents

I'm not Soundbomber, but one advantage of AABBs is dead-simple collision detection.

### Re: 3D extents

.. I know :)

But he does seem to want AABBs, and I ask because this topic was started because of the extents3d computation, which is simple in both OBB and AABB case. OBB is simpler/faster if only thing needed is extents.

For collision detecion AABBs are simpler/faster.

### Re: 3D extents

I only want to calculate the physical extents of my objects so I can fit my scene into the OpenGL control correctly.
(No collision detection needed)
So really I just need to know the minimum and maximum x,y and z values. (After transforms)

### Re: 3D extents

The aforementioned gamasutra articale describes how to calculate the correct AABBs (go to second page).

### Re: 3D extents

As I am applying my transforms to each object as it is rendered, presumably I would have to carry out this calculation at render time also?

### Re: 3D extents

Yes, you have to recalculate AABBs at render time, but only if you rotate an object. Fortunately this is fairly fast.

### Re: 3D extents

Cool. Does OpenTK have a function to multiply a vector by a matrix?

### Re: 3D extents

Yes, Vector3.Transform(). It is a static method.

Use the overload tat takes 3 parameters by reference, as it is much faster.

### Re: 3D extents

Off topic: Is there a way to setup email notification for forum topics?