28#ifndef INCLUDED_OOMATHS_h
29 #error Do not include OOBoundingBox.h directly; include OOMaths.h.
64OOINLINE void bounding_box_add_vector(BoundingBox *box, Vector vec)
67 box->min.x = fmin(box->min.x, vec.x);
68 box->max.x = fmax(box->max.x, vec.x);
69 box->min.y = fmin(box->min.y, vec.y);
70 box->max.y = fmax(box->max.y, vec.y);
71 box->min.z = fmin(box->min.z, vec.z);
72 box->max.z = fmax(box->max.z, vec.z);
76OOINLINE void bounding_box_add_xyz(BoundingBox *box, GLfloat
x, GLfloat
y, GLfloat z)
79 box->min.x = fmin(box->min.x,
x);
80 box->max.x = fmax(box->max.x,
x);
81 box->min.y = fmin(box->min.y,
y);
82 box->max.y = fmax(box->max.y,
y);
83 box->min.z = fmin(box->min.z, z);
84 box->max.z = fmax(box->max.z, z);
88OOINLINE void bounding_box_reset(BoundingBox *box)
95OOINLINE void bounding_box_reset_to_vector(BoundingBox *box, Vector vec)
103OOINLINE void bounding_box_get_dimensions(BoundingBox bb, GLfloat *xSize, GLfloat *ySize, GLfloat *zSize)
105 if (xSize != NULL) *xSize = bb.max.x - bb.min.x;
106 if (ySize != NULL) *ySize = bb.max.y - bb.min.y;
107 if (zSize != NULL) *zSize = bb.max.z - bb.min.z;
111OOINLINE Vector OOBoundingBoxCenter(BoundingBox bb)
113 return vector_multiply_scalar(vector_add(bb.min, bb.max), 0.5f);
#define ALWAYS_INLINE_FUNC
#define INLINE_CONST_FUNC
HPVector OOHPRandomPositionInBoundingBox(BoundingBox bb)
const BoundingBox kZeroBoundingBox
Vector OORandomPositionInBoundingBox(BoundingBox bb)