Commit 7e46707a authored by Alexis Girault's avatar Alexis Girault
Browse files

ENH: Implement base for CollidingObject

parent 576028d7
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#include "imstkCollidingObject.h"
namespace imstk {
std::shared_ptr<Geometry>
CollidingObject::getCollidingGeometry() const
{
return m_collidingGeometry;
}
void
CollidingObject::setCollidingGeometry(std::shared_ptr<Geometry> geometry)
{
m_collidingGeometry = geometry;
}
}
/*=========================================================================
Library: iMSTK
Copyright (c) Kitware, Inc. & Center for Modeling, Simulation,
& Imaging in Medicine, Rensselaer Polytechnic Institute.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef imstkCollidingObject_h
#define imstkCollidingObject_h
#include <memory>
#include "imstkSceneObject.h"
namespace imstk {
class Geometry;
class GeometryMap;
class CollidingObject : public SceneObject
{
public:
CollidingObject(std::string name) : SceneObject(name)
{
m_type = Type::Static;
}
~CollidingObject() = default;
std::shared_ptr<Geometry> getCollidingGeometry() const;
void setCollidingGeometry(std::shared_ptr<Geometry> geometry);
protected:
std::shared_ptr<Geometry> m_collidingGeometry; ///> Geometry for collisions
std::shared_ptr<GeometryMap> m_collidingToVisualMap; ///> Maps transformations to visual geometry
};
using StaticObject = CollidingObject;
}
#endif // ifndef imstkCollidingObject_h
......@@ -21,6 +21,8 @@
#include "imstkSceneObject.h"
#include "imstkGeometry.h"
namespace imstk {
std::shared_ptr<Geometry>
SceneObject::getVisualGeometry() const
......@@ -29,17 +31,23 @@ SceneObject::getVisualGeometry() const
}
void
SceneObject::setVisualGeometry(std::shared_ptr<Geometry>geometry)
SceneObject::setVisualGeometry(std::shared_ptr<Geometry> geometry)
{
m_visualGeometry = geometry;
}
const SceneObjectType&
const SceneObject::Type&
SceneObject::getType() const
{
return m_type;
}
void
SceneObject::setType(Type type)
{
m_type = type;
}
const std::string&
SceneObject::getName() const
{
......
......@@ -24,38 +24,41 @@
#include <memory>
#include "imstkGeometry.h"
namespace imstk {
enum class SceneObjectType
{
Visual,
Static,
VirtualCoupled,
Rigid,
Deformable
};
class Geometry;
class SceneObject
{
public:
enum class Type
{
Visual,
Static,
VirtualCoupled,
Rigid,
Deformable
};
SceneObject(std::string name) : m_name(name) {}
~SceneObject() = default;
const SceneObjectType & getType() const;
const Type& getType() const;
const std::string & getName() const;
void setName(std::string name);
const std::string& getName() const;
void setName(std::string name);
std::shared_ptr<Geometry>getVisualGeometry() const;
void setVisualGeometry(std::shared_ptr<Geometry>geometry);
std::shared_ptr<Geometry> getVisualGeometry() const;
void setVisualGeometry(std::shared_ptr<Geometry> geometry);
protected:
SceneObjectType m_type = SceneObjectType::Visual;
std::string m_name;
void setType(Type type);
Type m_type = Type::Visual;
std::string m_name;
std::shared_ptr<Geometry> m_visualGeometry; ///> Geometry for rendering
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment