Commit 0d44402f authored by Inge Wallin's avatar Inge Wallin

Make Body inherit Item

Previously Body was a root class and all subclasses of Body inherited both
Item and Body. This seemed strange.
parent 3c723680
...@@ -30,7 +30,7 @@ Legend ...@@ -30,7 +30,7 @@ Legend
* GslSolver * GslSolver
* GslAdaptiveSolver * GslAdaptiveSolver
* Item{world.h} Root class for world items (bodies, forces) * Item{item.h} Root class for world items (bodies, forces)
[world, group, objectErrors, color] [world, group, objectErrors, color]
* NoteImage Image embedded in a Note * NoteImage Image embedded in a Note
...@@ -42,17 +42,18 @@ Legend ...@@ -42,17 +42,18 @@ Legend
* World The root object for everything visible * World The root object for everything visible
[time, timeScale, bodies, forces, joints, solvers...] [time, timeScale, bodies, forces, joints, solvers...]
* Body{world.h} Anything that has dynamic variables that * Body{body.h} Anything that has dynamic variables that
require ODE integration require ODE integration
* Particle(Item, Body) * Particle(Item, Body)
* ChargedParticle * ChargedParticle
* GasParticle * GasParticle
* RigidBody(Item, Body) * RigidBody(Item, Body)
* Disk * Disk
* BasePolygon * BasePolygon
* Box * Box
* Polygon * Polygon
* Plane(Item, Body) Unmovable rigid plane * Plane(Item, Body) Unmovable rigid plane
* Force{world.h} Anything that acts upon bodies changing * Force{world.h} Anything that acts upon bodies changing
derivatives of dynamic variables derivatives of dynamic variables
......
...@@ -28,31 +28,27 @@ ...@@ -28,31 +28,27 @@
#include <vector> // XXX: Replace if Qt is enabled. #include <vector> // XXX: Replace if Qt is enabled.
#include "types.h" #include "types.h"
#include "object.h" #include "item.h"
namespace StepCore namespace StepCore
{ {
//class World;
//class Solver;
//class Item;
//class ItemGroup;
//class CollisionSolver;
//class ConstraintSolver;
/** \ingroup bodies /** \ingroup bodies
* \brief Interface for bodies * \brief Interface for bodies
* *
* Body is anything that has dynamic variables that require ODE integration * Body is anything that has dynamic variables that require ODE integration
*/ */
class Body class Body : public Item
{ {
STEPCORE_OBJECT(Body) STEPCORE_OBJECT(Body)
public: public:
Body(): _variablesOffset(0) {} Body(const QString& name = QString())
: Item(name)
, _variablesOffset(0)
{}
virtual ~Body() {} virtual ~Body() {}
/** Get count of dynamic variables (not including velocities) */ /** Get count of dynamic variables (not including velocities) */
......
...@@ -100,7 +100,7 @@ protected: ...@@ -100,7 +100,7 @@ protected:
/** \ingroup bodies /** \ingroup bodies
* \brief Particle with mass * \brief Particle with mass
*/ */
class Particle: public Item, public Body class Particle: public Body
{ {
STEPCORE_OBJECT(Particle) STEPCORE_OBJECT(Particle)
......
...@@ -141,7 +141,7 @@ protected: ...@@ -141,7 +141,7 @@ protected:
/** \ingroup bodies /** \ingroup bodies
* \brief Rigid body * \brief Rigid body
*/ */
class RigidBody: public Item, public Body class RigidBody: public Body
{ {
STEPCORE_OBJECT(RigidBody) STEPCORE_OBJECT(RigidBody)
...@@ -358,7 +358,7 @@ public: ...@@ -358,7 +358,7 @@ public:
/** \ingroup bodies /** \ingroup bodies
* \brief Unmovable rigid plane * \brief Unmovable rigid plane
*/ */
class Plane: public Item, public Body class Plane: public Body
{ {
STEPCORE_OBJECT(Plane) STEPCORE_OBJECT(Plane)
......
...@@ -21,8 +21,7 @@ ...@@ -21,8 +21,7 @@
#include <stepcore/solver.h> #include <stepcore/solver.h>
#include <stepcore/types.h> #include <stepcore/types.h>
class WorldCopyTestItem: public StepCore::Item, class WorldCopyTestItem: public StepCore::Body,
public StepCore::Body,
public StepCore::Force public StepCore::Force
{ {
STEPCORE_OBJECT(WorldCopyTestItem) STEPCORE_OBJECT(WorldCopyTestItem)
......
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