Open Inventor Reference
SbPlaneProjector.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * Further, this software is distributed without any warranty that it is
16  * free of the rightful claim of any third person regarding infringement
17  * or the like. Any license provided herein, whether implied or
18  * otherwise, applies only to this software file. Patent licenses, if
19  * any, provided herein do not apply to combinations of this program with
20  * other software, or any other product whatsoever.
21  *
22  * You should have received a copy of the GNU Lesser General Public
23  * License along with this library; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27  * Mountain View, CA 94043, or:
28  *
29  * http://www.sgi.com
30  *
31  * For further information regarding this notice, see:
32  *
33  * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34  *
35  */
36 
37 
38 /*
39  * Copyright (C) 1990,91,92 Silicon Graphics, Inc.
40  *
41  _______________________________________________________________________
42  ______________ S I L I C O N G R A P H I C S I N C . ____________
43  |
44  | $Revision: 1.1.1.1 $
45  |
46  | Description:
47  | This file contains the definition of the SbPlaneProjector
48  | class. This projects the mouse onto a plane. If orientToEye
49  | is set to TRUE, the plane will be oriented to the eye.
50  |
51  | Author(s) : Howard Look, Paul Isaacs
52  |
53  ______________ S I L I C O N G R A P H I C S I N C . ____________
54  _______________________________________________________________________
55  */
56 
57 #ifndef _SB_PLANE_PROJECTOR_
58 #define _SB_PLANE_PROJECTOR_
59 
61 
64 
77 
79 {
80  public:
81 
84  SbPlaneProjector(bool orient = FALSE);
85 
87  SbPlaneProjector(const SbPlane &plane,
88  bool orient = FALSE);
89 
92 
95  virtual SbProjector * copy() const;
96 
101  virtual SbVec3f project(const SbVec2f &point);
102 
104  void setPlane(const SbPlane &plane);
105 
107  const SbPlane & getPlane() const { return plane; }
108 
115  void setOrientToEye(bool orientToEye);
117  bool isOrientToEye() const { return orientToEye; }
118 
120  virtual SbVec3f getVector(const SbVec2f &mousePosition1,
121  const SbVec2f &mousePosition2);
122 
131  virtual SbVec3f getVector(const SbVec2f &mousePosition);
132 
134  void setStartPosition(const SbVec2f &mousePosition)
135  { lastPoint = project(mousePosition); }
136 
138  void setStartPosition(const SbVec3f &point)
139  { lastPoint = point; }
140  protected:
141 
143  bool orientToEye;
144  bool needSetup;
146 
148 
149  void setupPlane();
150 };
151 
152 #endif /* _SB_PLANE_PROJECTOR_ */
#define FALSE
Definition: SbBasic.h:79
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition: SbSystem.h:81
Plane projector.
void setOrientToEye(bool orientToEye)
Set whether the projector should be oriented towards the eye.
bool isOrientToEye() const
Get whether the projector should be oriented towards the eye.
void setStartPosition(const SbVec3f &point)
Set the initial position from a point on the projector.
SbVec3f lastPoint
Cached last point.
virtual SbVec3f getVector(const SbVec2f &mousePosition)
Get a vector given the current mouse point.
const SbPlane & getPlane() const
Set and get the plane to use.
virtual SbVec3f project(const SbVec2f &point)
Apply the projector using the given point, returning the point in three dimensions that it projects t...
bool orientToEye
TRUE is plane should be oriented to eye.
virtual SbVec3f getVector(const SbVec2f &mousePosition1, const SbVec2f &mousePosition2)
Get a vector on this plane given two normalized mouse points.
void setPlane(const SbPlane &plane)
Set and get the plane to use.
virtual SbProjector * copy() const
Returns an instance that is a copy of this instance.
SbPlaneProjector(const SbPlane &plane, bool orient=FALSE)
Constructor that takes a plane.
SbPlane nonOrientPlane
Non-EyeOriented plane.
void setStartPosition(const SbVec2f &mousePosition)
Set the initial mouse position.
bool needSetup
Set TRUE when plane or orientToEye changes.
SbPlaneProjector(bool orient=FALSE)
Constructor.
void setupPlane()
Sets up plane orientation, if necessary.
~SbPlaneProjector()
Destructor.
Oriented plane in 3D.
Definition: SbLinear.h:1360
Base class for representing projectors.
Definition: SbProjector.h:87
virtual SbVec3f project(const SbVec2f &point)=0
Apply the projector using the given point, returning the point in three dimensions that it projects t...
2D vector class.
Definition: SbLinear.h:246
3D vector class.
Definition: SbLinear.h:120