Platform SDK: DirectX

Minimize

This helper function returns a vector that is made up of the smallest components of the two specified vectors. Minimize is part of the suite of extra functionality that is available to C++ programmers who define D3D_OVERLOADS.

_D3DVECTOR Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2);

This function is defined as follows:

inline _D3DVECTOR
Minimize (const _D3DVECTOR& v1, const _D3DVECTOR& v2)
{
   return _D3DVECTOR( v1[0] < v2[0] ? v1[0] : v2[0],
                      v1[1] < v2[1] ? v1[1] : v2[1],
                      v1[2] < v2[2] ? v1[2] : v2[2]);
}

Remarks

You can use the Maximize and Minimize functions to compute the bounding box for a set of points, in a function that looks like this:

    void
    ComputeBoundingBox(const D3DVECTOR *pts, int N, D3DVECTOR *min, D3DVECTOR *max)
    {
        int i;
        *min = *max = pts[0];
        for (i = 1; i < N; i += 1)
        {
            *min = Minimize(*min, pts[i]);
            *max = Maximize(*max, pts[i]);
        }
    }

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Version: Requires DirectX 5.0 or later.
  Header: Declared in d3d.h.

See Also

Maximize