My Project
Loading...
Searching...
No Matches
CShapeEllipsoid.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 CShapeEllipsoidH
46#define CShapeEllipsoidH
47//------------------------------------------------------------------------------
49#include "materials/CMaterial.h"
51//------------------------------------------------------------------------------
52#ifdef C_USE_OPENGL
53#ifdef MACOSX
54#include "OpenGL/glu.h"
55#else
56#include "GL/glu.h"
57#endif
58#endif
59//------------------------------------------------------------------------------
60
61//------------------------------------------------------------------------------
62namespace chai3d {
63//------------------------------------------------------------------------------
64
65//==============================================================================
72//==============================================================================
73
74//==============================================================================
85//==============================================================================
87{
88 //--------------------------------------------------------------------------
89 // CONSTRUCTOR & DESTRUCTOR:
90 //--------------------------------------------------------------------------
91
92public:
93
95 cShapeEllipsoid(const double& a_radiusX,
96 const double& a_radiusY,
97 const double& a_radiusZ,
98 cMaterialPtr a_material = cMaterialPtr());
99
101 virtual ~cShapeEllipsoid();
102
103
104 //--------------------------------------------------------------------------
105 // PUBLIC METHODS:
106 //--------------------------------------------------------------------------
107
108public:
109
111 virtual std::string getClassName() { return ("ShapeEllipsoid"); }
112
114 cShapeEllipsoid* copy(const bool a_duplicateMaterialData = false,
115 const bool a_duplicateTextureData = false,
116 const bool a_duplicateMeshData = false,
117 const bool a_buildCollisionDetector = false);
118
120 void setRadii(const double& a_radiusX, const double& a_radiusY, const double& a_radiusZ);
121
123 void setRadiusX(const double& a_radiusX);
124
126 inline double getRadiusX() const { return (m_radiusX); }
127
129 void setRadiusY(const double& a_radiusY);
130
132 inline double getRadiusY() const { return (m_radiusY); }
133
135 void setRadiusZ(const double& a_radiusZ);
136
138 inline double getRadiusZ() const { return (m_radiusZ); }
139
140
141 //--------------------------------------------------------------------------
142 // PROTECTED METHODS:
143 //--------------------------------------------------------------------------
144
145protected:
146
148 virtual void render(cRenderOptions& a_options);
149
151 virtual void updateBoundaryBox();
152
154 virtual void scaleObject(const double& a_scaleFactor);
155
157 virtual void computeLocalInteraction(const cVector3d& a_toolPos,
158 const cVector3d& a_toolVel,
159 const unsigned int a_IDN);
160
162 virtual bool computeOtherCollisionDetection(cVector3d& a_segmentPointA,
163 cVector3d& a_segmentPointB,
164 cCollisionRecorder& a_recorder,
165 cCollisionSettings& a_settings);
166
167
168 //-----------------------------------------------------------------------
169 // PROTECTED METHODS:
170 //-----------------------------------------------------------------------
171
172protected:
173
176 const bool a_duplicateMaterialData,
177 const bool a_duplicateTextureData,
178 const bool a_duplicateMeshData,
179 const bool a_buildCollisionDetector);
180
181
182 //--------------------------------------------------------------------------
183 // PROTECTED MEMBERS:
184 //--------------------------------------------------------------------------
185
186protected:
187
189 double m_radiusX;
190
192 double m_radiusY;
193
195 double m_radiusZ;
196
198 GLUquadricObj *m_quadric;
199};
200
201//------------------------------------------------------------------------------
202} // namespace chai3d
203//------------------------------------------------------------------------------
204
205//------------------------------------------------------------------------------
206#endif
207//------------------------------------------------------------------------------
Implements a base class for all objects.
Implements material properties.
Implements 2D textures.
This class implements a collision detection recorder that stores all collision events that are report...
Definition CCollisionBasics.h:186
This class implements a base class for all 2D or 3D objects in CHAI3D.
Definition CGenericObject.h:113
This class implements a 3D shape ellipsoid.
Definition CShapeEllipsoid.h:87
GLUquadricObj * m_quadric
rendering object.
Definition CShapeEllipsoid.h:198
virtual void updateBoundaryBox()
This method updates the boundary box of this object.
Definition CShapeEllipsoid.cpp:407
double m_radiusZ
Radius of ellipsoid along z axis.
Definition CShapeEllipsoid.h:195
virtual void scaleObject(const double &a_scaleFactor)
This method scales the size of this object with given scale factor.
Definition CShapeEllipsoid.cpp:421
void setRadiusX(const double &a_radiusX)
This method sets the radius of the ellipsoid along the x axis.
Definition CShapeEllipsoid.cpp:215
double getRadiusY() const
This method returns the radius of the ellipsoid along the y axis.
Definition CShapeEllipsoid.h:132
double getRadiusZ() const
This method returns the radius of the ellipsoid along the z axis.
Definition CShapeEllipsoid.h:138
void setRadiusZ(const double &a_radiusZ)
This method sets the radius of the ellipsoid along the z axis.
Definition CShapeEllipsoid.cpp:255
virtual bool computeOtherCollisionDetection(cVector3d &a_segmentPointA, cVector3d &a_segmentPointB, cCollisionRecorder &a_recorder, cCollisionSettings &a_settings)
This method computes collisions between a segment and this object.
Definition CShapeEllipsoid.cpp:454
virtual ~cShapeEllipsoid()
Destructor of cShapeEllipsoid.
Definition CShapeEllipsoid.cpp:108
double m_radiusY
Radius of ellipsoid along y axis.
Definition CShapeEllipsoid.h:192
double m_radiusX
Radius of ellipsoid along x axis.
Definition CShapeEllipsoid.h:189
cShapeEllipsoid * copy(const bool a_duplicateMaterialData=false, const bool a_duplicateTextureData=false, const bool a_duplicateMeshData=false, const bool a_buildCollisionDetector=false)
This method creates a copy of itself.
Definition CShapeEllipsoid.cpp:129
virtual void render(cRenderOptions &a_options)
This method renders this object graphically using OpenGL.
Definition CShapeEllipsoid.cpp:275
virtual std::string getClassName()
This method returns the name of the object class.
Definition CShapeEllipsoid.h:111
void setRadii(const double &a_radiusX, const double &a_radiusY, const double &a_radiusZ)
This method sets the radis of the ellipsoid along the x, y, and z axes.
Definition CShapeEllipsoid.cpp:193
void setRadiusY(const double &a_radiusY)
This method sets the radius of the ellipsoid along the y axis.
Definition CShapeEllipsoid.cpp:235
double getRadiusX() const
This method returns the radius of the ellipsoid along the x axis.
Definition CShapeEllipsoid.h:126
virtual void computeLocalInteraction(const cVector3d &a_toolPos, const cVector3d &a_toolVel, const unsigned int a_IDN)
This method updates the geometric relationship between the tool and the current object.
Definition CShapeEllipsoid.cpp:358
void copyShapeEllipsoidProperties(cShapeEllipsoid *a_obj, const bool a_duplicateMaterialData, const bool a_duplicateTextureData, const bool a_duplicateMeshData, const bool a_buildCollisionDetector)
This method copies all properties of this object to another.
Definition CShapeEllipsoid.cpp:163
Definition CAudioBuffer.cpp:57
std::shared_ptr< cMaterial > cMaterialPtr
Definition CMaterial.h:69
This structure stores the collision settings that are passed to a collision detector when querying fo...
Definition CCollisionBasics.h:243
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