Main Page
Namespaces
Classes
Files
File List
File Members
include
Mathematics
GteIntrHalfspace3Sphere3.h
Go to the documentation of this file.
1
// David Eberly, Geometric Tools, Redmond WA 98052
2
// Copyright (c) 1998-2017
3
// Distributed under the Boost Software License, Version 1.0.
4
// http://www.boost.org/LICENSE_1_0.txt
5
// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
6
// File Version: 3.0.0 (2016/06/19)
7
8
#pragma once
9
10
#include <
Mathematics/GteHalfspace.h
>
11
#include <
Mathematics/GteHypersphere.h
>
12
#include <
Mathematics/GteFIQuery.h
>
13
#include <
Mathematics/GteTIQuery.h
>
14
15
// Queries for intersection of objects with halfspaces. These are useful for
16
// containment testing, object culling, and clipping.
17
18
namespace
gte
19
{
20
21
template
<
typename
Real>
22
class
TIQuery
<Real,
Halfspace3
<Real>,
Sphere3
<Real>>
23
{
24
public
:
25
struct
Result
26
{
27
bool
intersect
;
28
};
29
30
Result
operator()
(
Halfspace3<Real>
const
& halfspace,
31
Sphere3<Real>
const
& sphere);
32
};
33
34
35
template
<
typename
Real>
36
typename
TIQuery<Real, Halfspace3<Real>
,
Sphere3<Real>
>::Result
37
TIQuery<Real, Halfspace3<Real>
,
Sphere3<Real>
>::operator()(
38
Halfspace3<Real>
const
& halfspace,
Sphere3<Real>
const
& sphere)
39
{
40
Result
result
;
41
42
// Project the sphere center onto the normal line. The plane of the
43
// halfspace occurs at the origin (zero) of the normal line.
44
Real center =
Dot
(halfspace.normal, sphere.center) - halfspace.constant;
45
46
// The sphere and halfspace intersect when the projection interval
47
// maximum is nonnegative.
48
result.intersect = (center + sphere.radius >= (Real)0);
49
return
result
;
50
}
51
52
53
}
gte::TIQuery
Definition:
GteTIQuery.h:18
GteTIQuery.h
gte::TIQuery< Real, Halfspace3< Real >, Sphere3< Real > >::Result::intersect
bool intersect
Definition:
GteIntrHalfspace3Sphere3.h:27
gte::Halfspace
Definition:
GteHalfspace.h:20
GteFIQuery.h
gte
Definition:
GLX/GteWICFileIO.h:16
gte::Dot
DualQuaternion< Real > Dot(DualQuaternion< Real > const &d0, DualQuaternion< Real > const &d1)
GteHalfspace.h
gte::Hypersphere
Definition:
GteHypersphere.h:20
GteHypersphere.h
gte::TIQuery::operator()
Result operator()(Type0 const &primitive0, Type1 const &primitive1)
result
GLuint64EXT * result
Definition:
glext.h:10003
geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 04:00:00