33 #ifndef __H__UG__shapes_impl__
34 #define __H__UG__shapes_impl__
40 template <
class vector_t>
46 template <
class vector_t>
55 template <
class vector_t>
64 min = max = points[0];
66 for(
size_t i = 1; i < numPoints; ++i){
67 const vector_t&
p = points[i];
68 for(
size_t j = 0; j < vector_t::Size; ++j){
69 min[j] = std::min(min[j],
p[j]);
70 max[j] = std::max(max[j],
p[j]);
75 template <
class vector_t>
78 for(
size_t j = 0; j < vector_t::Size; ++j){
79 min[j] = std::min(b1.
min[j], b2.
min[j]);
80 max[j] = std::max(b1.
max[j], b2.
max[j]);
84 template <
class vector_t>
88 SetVec(vrad,
s.radius);
93 template <
class vector_t>
96 for(
size_t j = 0; j < vector_t::Size; ++j){
97 min[j] = std::min(b.
min[j], v[j]);
98 max[j] = std::max(b.
max[j], v[j]);
102 template <
class vector_t>
111 template <
class vector_t>
119 template <
class vector_t>
125 template <
class vector_t>
129 lmin = lmax = point1;
130 for (
size_t i = 0; i < vector_t::Size; i++) {
131 lmin[i] = std::min(lmin[i], point2[i]);
132 lmax[i] = std::max(lmax[i], point2[i]);
bool intersects(const Sphere &sphere) const
returns true if the specified sphere touches or intersects this sphere.
Definition: shapes_impl.h:47
vector_t center
Definition: shapes.h:54
number radius
Definition: shapes.h:55
bool contains_point(const vector_t &point) const
returns true if the point lies inside or on the bounds of the rectangle
Definition: shapes_impl.h:41
TNumber sq(TNumber val)
returns the square of a value (val*val)
Definition: math_util_impl.hpp:91
bool BoxBoundProbe(const vector_t &v, const vector_t &boxMin, const vector_t &boxMax)
Returns true if the point lies inside or on the boundary of the box.
Definition: math_util_impl.hpp:958
bool BoxBoxIntersection(const vector_t &box1Min, const vector_t &box1Max, const vector_t &box2Min, const vector_t &box2Max)
checks whether two boxes intersect.
Definition: math_util_impl.hpp:901
void VecSet(vector_t &vInOut, typename vector_t::value_type s)
Set each vector component to scalar (componentwise)
Definition: math_vector_functions_common_impl.hpp:539
void VecSubtract(vector_t &vOut, const vector_t &v1, const vector_t &v2)
subtracts v2 from v1 and stores the result in a vOut
Definition: math_vector_functions_common_impl.hpp:226
vector_t::value_type VecDistanceSq(const vector_t &v1, const vector_t &v2)
returns the squared distance of two vector_ts.
Definition: math_vector_functions_common_impl.hpp:351
void VecAdd(vector_t &vOut, const vector_t &v1, const vector_t &v2)
adds two MathVector<N>s and stores the result in a third one
Definition: math_vector_functions_common_impl.hpp:185
void VecScale(vector_t &vOut, const vector_t &v, typename vector_t::value_type s)
scales a MathVector<N>
Definition: math_vector_functions_common_impl.hpp:252
AABox()
Definition: shapes.h:61
vector_t min
Definition: shapes.h:88
vector_t max
Definition: shapes.h:89
vector_t center() const
returns the center of the box
Definition: shapes_impl.h:103
bool overlaps_line(const vector_t &point1, const vector_t &point2) const
return true if the given line (segment) and the box overlap
Definition: shapes_impl.h:126
vector_t extension() const
returns the extension (width/height/depth) of the box
Definition: shapes_impl.h:112
bool contains_point(const vector_t &point) const
returns true if the given point lies in the box or on its boundary
Definition: shapes_impl.h:120