|
#include "StdAfx.h"
#include "Ball.h"
#include "Simulator.h"
#include "BounceWall.h"
#include "BounceBalls.h"
CBall::CBall( CSimulator *sim, double radius, double time, osg::Vec3d pos, osg::Vec3d vel )
: situation( sim, time, pos, vel )
{
this->radius = radius;
for( int i=0; i<3; ++i )
{
bounces[i] = new CBounceWall(this,i);
sim->Add( bounces[i] );
}
}
CBall::~CBall(void)
{
}
CSimulator *CBall::Simulator()
{
return situation.Simulator();
}
void CBall::PredictChanges()
{
double t = situation.GetBaseTime();
for( int i=0; i<3; ++i )
bounces[i]->PredictCollisionBetweenBallAndWall( t );
for( Colliders::iterator it = colliders.begin();
it != colliders.end(); ++it )
(*it)->PredictCollisionBetweenBalls( t );
}
void CBall::AddCollider( CBounceBalls *collider )
{
colliders.push_back( collider );
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I develop rail signalling simulation technology at EDM where I use C++ and C#, but also love to dabble in functional programming languages such as Clean and Cat.