1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "Prerequisites/BsPrerequisitesUtil.h"
6#include "Math/BsVector3.h"
7
8namespace bs
9{
10 /** @addtogroup Math
11 * @{
12 */
13
14 /**
15 * Represents a torus at the world center. Outer radius represents the distance from the center, and inner radius
16 * represents the radius of the tube. Inner radius must be less or equal than the outer radius.
17 */
18 class BS_UTILITY_EXPORT Torus
19 {
20 public:
21 Torus() = default;
22
23 Torus(const Vector3& normal, float outerRadius, float innerRadius)
24 :normal(normal), outerRadius(outerRadius), innerRadius(innerRadius)
25 { }
26
27 /** Ray/torus intersection, returns boolean result and distance to nearest intersection point. */
28 std::pair<bool, float> intersects(const Ray& ray) const;
29
30 Vector3 normal{BsZero};
31 float outerRadius = 0.0f;
32 float innerRadius = 0.0f;
33 };
34
35 /** @} */
36}
37