#include <Cone.h>
- Parameters
-
angle | Angle from the center line to the edge, in radians |
Vector3 direction
Definition: Cone.h:32
double pi()
Definition: g3dmath.h:147
Vector3 direction() const
Definition: Vector3.h:756
float angle
Definition: Cone.h:35
Vector3 tip
Definition: Cone.h:31
#define debugAssert(exp)
Definition: debugAssert.h:160
Forms the smallest cone that contains the box. Undefined if the tip is inside or on the box.
virtual G3D::Cone::~Cone |
( |
| ) |
|
|
inlinevirtual |
True if v is a point inside the cone.
130 return (x > 0) && (x >= cosf(
angle));
Vector3 direction
Definition: Cone.h:32
float angle
Definition: Cone.h:35
Vector3 tip
Definition: Cone.h:31
G3D::int16 x
Definition: Vector2int16.h:37
float G3D::Cone::halfAngleFromSolidAngle |
( |
float |
solidAngle | ) |
|
|
static |
Returns the half-angle (in radians) of a cone that subtends solidAngle (in steradians)
30 return acos((1.0f - (solidAngle / (2.0f *
pif()))));
float acos(float fValue)
Definition: g3dmath.h:633
float pif()
Definition: g3dmath.h:151
double G3D::Cone::halfAngleFromSolidAngle |
( |
double |
solidAngle | ) |
|
|
static |
34 return aCos((1.0 - (solidAngle / (2.0 *
pi()))));
double pi()
Definition: g3dmath.h:147
double aCos(double fValue)
Definition: g3dmath.h:622
Returns true if the cone touches, intersects, or contains b.
If c.intersects(s) and c.intersects(Sphere(s.center, s.radius * 2) then the sphere s is entirely within cone c.
111 if (b.contains(this->tip)) {
Vector3 direction
Definition: Cone.h:32
Cone(const Vector3 &tip, const Vector3 &direction, float angle)
Definition: Cone.cpp:38
float angle
Definition: Cone.h:35
Vector3 tip
Definition: Cone.h:31
48 const float cosThresh = cos(
angle);
58 v.x = rng.uniform(-1, 1);
59 v.y = rng.uniform(-1, 1);
60 v.z = rng.uniform(-1, 1);
63 vlenSquared = v.squaredLength();
64 }
while (vlenSquared > 1);
71 normalizer =
rsqrt(vlenSquared) *
sign(temp);
74 cosAngle = temp * normalizer;
76 }
while (cosAngle < cosThresh);
79 return v * normalizer;
Vector3 direction
Definition: Cone.h:32
float angle
Definition: Cone.h:35
double sign(double fValue)
Definition: g3dmath.h:669
double rsqrt(double x)
Definition: g3dmath.h:469
float G3D::Cone::solidAngleFromHalfAngle |
( |
float |
halfAngle | ) |
|
|
static |
Returns the solid angle (in steradians) subtended by a cone with half-angle halfAngle
22 return 2.0f *
pif() * (1 - cosf(halfAngle));
float pif()
Definition: g3dmath.h:151
double G3D::Cone::solidAngleFromHalfAngle |
( |
double |
halfAngle | ) |
|
|
static |
26 return 2.0 *
pi() * (1.0 - cos(halfAngle));
double pi()
Definition: g3dmath.h:147
Angle from the center line to the edge.
The documentation for this class was generated from the following files: