VR-Vantage
Loading...
Searching...
No Matches
DtPlane.inl
Go to the documentation of this file.
1/******************************************************************************
2** Copyright (c) 2020 MAK Technologies, Inc.
3** All rights reserved.
4******************************************************************************/
5
9#pragma once
10
11#include <iostream>
12
13namespace makVrv
14{
15
16 template<class T>
18 : d(0.0f)
19 {
20 //intentional
21 }
22
23 template<class T>
25 {
26
27 }
28
29 template<class T>
31 {
32 if (box.isNull())
33 return NO_SIDE;
34 if (box.isInfinite())
35 return BOTH_SIDE;
36
37 return getSide(box.center(), box.halfSize());
38 }
39
40 template<class T>
42 , const DtVector3<T>& halfSize) const
43 {
44 // Calculate the distance between box centre and the plane
45 T dist = getDistance(centre);
46
47 // Calculate the maximise allows absolute distance for
48 // the distance between box centre and plane
49 T maxAbsDist = vNormal.absDotProduct(halfSize);
50
51 if (dist < -maxAbsDist)
52 return NEGATIVE_SIDE;
53
54 if (dist > +maxAbsDist)
55 return POSITIVE_SIDE;
56
57 return BOTH_SIDE;
58 }
59
60 template<class T>
62 {
63 return vNormal.dotProduct(rhs) + d;
64 }
65
66 template<class T>
67 inline std::ostream& operator <<
68 (std::ostream& o, const DtPlane<T>& plane)
69 {
70 o << std::fixed <<"normal: " << plane.vNormal<<" d: "<< plane.d;
71 return o;
72 }
73
74} //namespace makVrv
Template for 32/64 bit Axis Aligned bounding boxesnot virtual because its stored as is on the GPU.
Definition DtAxisAlignedBoundingBox.h:28
bool isNull(void) const
is null?
Definition DtAxisAlignedBoundingBox.inl:203
DtVector3< T > center(void) const
get the center
Definition DtAxisAlignedBoundingBox.inl:67
bool isInfinite(void) const
is infinite extents?
Definition DtAxisAlignedBoundingBox.inl:193
DtVector3< T > halfSize(void) const
half size
Definition DtAxisAlignedBoundingBox.inl:132
DtPlane class.
Definition DtPlane.h:25
T d
Definition DtPlane.h:35
virtual ~DtPlane()
DTOR.
Definition DtPlane.inl:24
T getDistance(const DtVector3< T > &rhs) const
Definition DtPlane.inl:61
DtPlane()
CTOR.
Definition DtPlane.inl:17
DtVector3< T > vNormal
Definition DtPlane.h:34
PlaneSide getSide(const DtAxisAlignedBoundingBox< T > &box) const
Definition DtPlane.inl:30
2 dimensional vector
Definition DtVector3.h:27
Contains DtCreateSensorFieldOfViewCommand and DtCreateSensorFieldOfViewCommandCreator class declarati...
Definition DtGridLinesSettingsRecord.h:16
PlaneSide
Definition DtPlane.h:14
@ POSITIVE_SIDE
Definition DtPlane.h:16
@ NEGATIVE_SIDE
Definition DtPlane.h:17
@ BOTH_SIDE
Definition DtPlane.h:18
@ NO_SIDE
Definition DtPlane.h:15