VR-Forces 4.1.1 Class Documentation
plane.h
Go to the documentation of this file.
1 /*********************************************************************
2 ** Copyright (c) 1998 MaK Technologies, Inc.
3 ** All rights reserved.
4 *********************************************************************/
5 /*********************************************************************
6 ** $RCSfile: plane.h,v $ $Revision: 1.12 $ $State: Exp $
7 *********************************************************************/
8 
9 #ifndef plane_H_
10 #define plane_H_
11 
12 // \file plane.h
13 // \brief Contains the DtPlane class declaration.
14 
15 #include <vlutil/vlMachineTypes.h>
17 
18 // forward declarations
19 class DtPoint;
20 class DtVector;
21 class DtChord;
22 
23 //
24 // DtPlane represents a plane in 3-space.
26 {
27 public:
28 
29  // default constructor (returns the xy-plane)
30  DtPlane();
31 
32  // Define the plane passing through points v0, v1, and v2.
33  // the three points v0, v1, and v2, are not collinear and not coincident.
34  // The vertices v0, v1, and v2 appear in counterclockwise
35  // order when viewing the plane from outside to inside in
36  // a right-handed Cartesian coordinate system.
37  DtPlane(const DtPoint& v0, const DtPoint& v1, const DtPoint& v2);
38 
39  // Plane defined by a location and normal direction vector.
40  // \note The second parameter is passed by value so that the copy can be used
41  // internally to the function, for performance reasons.
42  DtPlane(const DtVector& point, DtVector normal);
43 
44  // define a plane by specifying the coefficients for the plane equation:
45  // Ax + By + Cz + D = 0
46  DtPlane(double a, double b, double c, double d);
47 
48  // Special version of the constructor that specifies the plane's coefficients,
49  // in that is assumes they are correct as specified.
50  // \note This version does \b not test them for correctness!
51  DtPlane(bool ignored, double a, double b, double c, double d);
52 
53  // copy constructor
54  DtPlane(const DtPlane& orig);
55 
56  // destructor
57  virtual ~DtPlane();
58 
59  // assignment operator
60  DtPlane& operator=(const DtPlane& orig);
61 
62  // Coefficients of the plane equation Ax + By + Cz + D = 0.
63  virtual double a() const;
64  virtual double b() const;
65  virtual double c() const;
66  virtual double d() const;
67 
68  // compute the vector normal to the plane.
69  virtual const DtVector normal() const;
70 
71  // determine if chord intersects the plane; time specifies the
72  // parametric value along the chord.
73  virtual bool intersects(const DtChord& chord, double& time) const;
74 
75  // print the contents of the object
76  virtual void dump() const;
77 
78  // compute the distance of a point p to the plane.
79  double distanceToPlane(const DtPoint& p) const;
80 
81  // \return point on the plane closest to the specified point.
82  DtPoint closestPointOnPlane(const DtPoint& p) const;
83 
84 protected:
85 
86  // The plane is specified by the equation Ax + By + Cz + D = 0.
87  double myA;
88  double myB;
89  double myC;
90  double myD;
91 
92 };
93 
94 #endif

Document ID: Generated on Mon Apr 8 19:24:01 EDT 2013 from SVN revision 125877
Copyright © 2005-2013 VT MÄK. All Rights Reserved (www.mak.com)