| 135 | } |
| 136 | |
| 137 | ContainmentType OrientedBoundingBox::Contains(const Vector3& point, Real* distance) const |
| 138 | { |
| 139 | // Transform the point into the obb coordinates |
| 140 | Vector3 locPoint; |
| 141 | Transformation.WorldToLocal(point, locPoint); |
| 142 | locPoint.X = Math::Abs(locPoint.X); |
| 143 | locPoint.Y = Math::Abs(locPoint.Y); |
| 144 | locPoint.Z = Math::Abs(locPoint.Z); |
| 145 | |
| 146 | if (distance) |
| 147 | { |
| 148 | // Get minimum distance to edge in local space |
| 149 | Vector3 tmp; |
| 150 | Vector3::Subtract(Extents, locPoint, tmp); |
| 151 | const Real minDstToEdgeLocal = tmp.GetAbsolute().MinValue(); |
| 152 | |
| 153 | // Transform distance to world space |
| 154 | Vector3 dstVec = Vector3::UnitX * minDstToEdgeLocal; |
| 155 | Transformation.LocalToWorldVector(dstVec, dstVec); |
| 156 | *distance = dstVec.Length(); |
| 157 | } |
| 158 | |
| 159 | // Simple axes-aligned BB check |
| 160 | if (locPoint.X < Extents.X && locPoint.Y < Extents.Y && locPoint.Z < Extents.Z) |
| 161 | return ContainmentType::Contains; |
| 162 | if (Vector3::NearEqual(locPoint, Extents)) |
| 163 | return ContainmentType::Intersects; |
| 164 | return ContainmentType::Disjoint; |
| 165 | } |
| 166 | |
| 167 | ContainmentType OrientedBoundingBox::Contains(const BoundingSphere& sphere, bool ignoreScale) const |
| 168 | { |
nothing calls this directly
no test coverage detected