GteCullingPlane.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/GteVector4.h>
11 
12 // The plane is defined by Dot((n0,n1,n2,c),(x0,x1,x2,1)) = 0, where a
13 // plane normal is N = (n0,n1,n2,0), c is a constant, and X = (x0,x1,x2,1)
14 // is a point on the plane. If P = (p0,p1,p2,1) is a point on the plane, then
15 // Dot(N,X-P) = 0, in which case c = -Dot(N,P). If P0, P1, and P2 are points
16 // on the plane and are not collinear, then N = Cross(P1-P0,P2-P0) and
17 // c = -Dot(N,P0).
18 
19 namespace gte
20 {
21 
23 {
24 public:
25  // Construction and destruction. The destructor hides the base-class
26  // destructor, but the latter has no side effects.
27  ~CullingPlane ();
28  CullingPlane ();
29  CullingPlane (CullingPlane const& plane);
30  CullingPlane (Vector4<float> const& N, float c);
31  CullingPlane (float n0, float n1, float n2, float c);
32  CullingPlane (Vector4<float> const& N, Vector4<float> const& P);
33  CullingPlane (Vector4<float> const& P0, Vector4<float> const& P1,
34  Vector4<float> const& P2);
35 
36  // Assignment.
37  CullingPlane& operator= (CullingPlane const& plane);
38 
39  // Member access. Because N and c are interdependent, there are no
40  // accessors to set N or c individually.
41  void Set (Vector4<float> const& N, float c);
42  void Get (Vector4<float>& N, float& c) const;
43  Vector4<float> GetNormal () const;
44  float GetConstant () const;
45 
46  // Compute L = Length(n0,n1,n2) and set the plane to (n0,n1,n2,c)/L.
47  // This is useful when transforming planes by homogeneous matrices.
48  // The function returns L.
49  float Normalize ();
50 
51  // The "positive side" of the plane is the half space to which the
52  // plane normal is directed. The "negative side" is the other half
53  // space. The function returns +1 when P is on the positive side, -1
54  // when P is on the negative side, or 0 when P is on the plane.
55  int WhichSide (Vector4<float> const& P) const;
56 
57  // Compute d = Dot(N,P)+c where N is the plane normal and c is the plane
58  // constant. This is a signed pseudodistance. The sign of the return
59  // value is consistent with that in the comments for WhichSide(...).
60  float DistanceTo (Vector4<float> const& P) const;
61 
62 private:
64 };
65 
66 }
const GLubyte * c
Definition: glext.h:11671
Real Normalize(GVector< Real > &v, bool robust=false)
Definition: GteGVector.h:454
Vector4< float > mTuple
#define GTE_IMPEXP
Definition: GTEngineDEF.h:63


geometric_tools_engine
Author(s): Yijiang Huang
autogenerated on Thu Jul 18 2019 03:59:59