My Project
Loading...
Searching...
No Matches
CGenericForceAlgorithm.h
Go to the documentation of this file.
1//==============================================================================
2/*
3 Software License Agreement (BSD License)
4 Copyright (c) 2003-2024, CHAI3D
5 (www.chai3d.org)
6
7 All rights reserved.
8
9 Redistribution and use in source and binary forms, with or without
10 modification, are permitted provided that the following conditions
11 are met:
12
13 * Redistributions of source code must retain the above copyright
14 notice, this list of conditions and the following disclaimer.
15
16 * Redistributions in binary form must reproduce the above
17 copyright notice, this list of conditions and the following
18 disclaimer in the documentation and/or other materials provided
19 with the distribution.
20
21 * Neither the name of CHAI3D nor the names of its contributors may
22 be used to endorse or promote products derived from this software
23 without specific prior written permission.
24
25 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
26 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
27 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
28 FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
29 COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
30 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
31 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
32 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
33 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
34 LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
35 ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37
38 \author <http://www.chai3d.org>
39 \author Francois Conti
40 \version 3.3.0
41*/
42//==============================================================================
43
44//------------------------------------------------------------------------------
45#ifndef CGenericForceAlgorithmH
46#define CGenericForceAlgorithmH
47//------------------------------------------------------------------------------
48#include "math/CVector3d.h"
50//------------------------------------------------------------------------------
51#include <vector>
52//------------------------------------------------------------------------------
53
54//------------------------------------------------------------------------------
55namespace chai3d {
56//------------------------------------------------------------------------------
57
58//------------------------------------------------------------------------------
59class cWorld;
60//------------------------------------------------------------------------------
61
62//==============================================================================
69//==============================================================================
70
71//==============================================================================
83//==============================================================================
85{
86 //--------------------------------------------------------------------------
87 // CONSTRUCTOR & DESTRUCTOR:
88 //--------------------------------------------------------------------------
89
90public:
91
94
97
98
99 //--------------------------------------------------------------------------
100 // PUBLIC METHODS:
101 //--------------------------------------------------------------------------
102
103public:
104
106 cWorld* getWorld() { return (m_world); }
107
109 virtual void initialize(cWorld* a_world, const cVector3d& a_initialPos) {};
110
112 virtual cVector3d computeForces(const cVector3d& a_toolPos, const cVector3d& a_toolVel)
113 { return (cVector3d(0.0, 0.0, 0.0)); }
114
115 // This method enables or disables graphic rendering of the force rendering algorithm.
116 void setShowEnabled(bool a_showEnabled) { m_showEnabled = a_showEnabled; }
117
118 // This method returns __true__ if the graphic rendering mode is enabled, __false__ otherwise.
119 bool getShowEnabled() { return (m_showEnabled); }
120
121
122 //--------------------------------------------------------------------------
123 // PROTECTED METHODS - GRAPHICS
124 //--------------------------------------------------------------------------
125
126protected:
127
129 virtual void render(cRenderOptions& a_options) {}
130
131
132 //--------------------------------------------------------------------------
133 // PROTECTED MEMBERS:
134 //--------------------------------------------------------------------------
135
136protected:
137
140
143};
144
145//------------------------------------------------------------------------------
146} // namespace chai3d
147//------------------------------------------------------------------------------
148
149//------------------------------------------------------------------------------
150#endif
151//------------------------------------------------------------------------------
152
Implements a base class for all objects.
Implements a 3D vector.
This class implements a base class for modeling force rendering algorithms.
Definition CGenericForceAlgorithm.h:85
bool getShowEnabled()
Definition CGenericForceAlgorithm.h:119
void setShowEnabled(bool a_showEnabled)
Definition CGenericForceAlgorithm.h:116
virtual ~cGenericForceAlgorithm()
Destructor of cGenericForceAlgorithm.
Definition CGenericForceAlgorithm.h:96
cGenericForceAlgorithm()
Constructor of cGenericForceAlgorithm.
Definition CGenericForceAlgorithm.cpp:57
virtual void render(cRenderOptions &a_options)
This method renders the force algorithm graphically using OpenGL. (For debug purposes)
Definition CGenericForceAlgorithm.h:129
virtual void initialize(cWorld *a_world, const cVector3d &a_initialPos)
This method initializes the algorithm by passing the starting position of the haptic device.
Definition CGenericForceAlgorithm.h:109
cWorld * m_world
Pointer to the world in which the force algorithm operates.
Definition CGenericForceAlgorithm.h:139
cWorld * getWorld()
This method returns a pointer to the world in which the force algorithm is operating.
Definition CGenericForceAlgorithm.h:106
virtual cVector3d computeForces(const cVector3d &a_toolPos, const cVector3d &a_toolVel)
This method computes the next force given the updated position of the haptic device.
Definition CGenericForceAlgorithm.h:112
bool m_showEnabled
If true then the graphic display mode is enabled.
Definition CGenericForceAlgorithm.h:142
This class implements a virtual world.
Definition CWorld.h:93
Definition CAudioBuffer.cpp:57
This structures provide a containers for storing rendering options that are passed through the sceneg...
Definition CRenderOptions.h:83
This class implements a 3D vector.
Definition CVector3d.h:89