MCPcopy Create free account
hub / github.com/crownengine/crown / from_cone

Function from_cone

src/core/math/sphere.cpp:19–36  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17 }
18
19 Sphere from_cone(const Vector3 &tip, const Vector3 &dir, f32 range, f32 angle)
20 {
21 const f32 sin_a = fsin(angle);
22 const f32 cos_a = fcos(angle);
23 const f32 slant = range / cos_a;
24 const f32 sotca = slant / (2.0f * cos_a);
25 Sphere s;
26
27 if (angle > PI_FOURTH) {
28 s.c = tip + dir * range;
29 s.r = sin_a * slant;
30 } else {
31 s.c = tip + dir * sotca;
32 s.r = sotca;
33 }
34
35 return s;
36 }
37
38 Sphere merge(const Sphere &a, const Sphere &b)
39 {

Callers 1

local_sphereFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected