Page MenuHomec4science

matpoint.cpp
No OneTemporary

File Metadata

Created
Thu, Dec 5, 04:24

matpoint.cpp

#include "matpoint.h"
MatPoint::MatPoint( sid_t sid,
double mass,
const Vector& loc,
const std::string label,
const struct render_s *flags) : Shape(sid, label, flags)
{
this->particle = new Particle(mass, loc);
}
MatPoint::MatPoint( sid_t sid,
const Particle& particle,
const std::string label,
const struct render_s *flags) : Shape(sid, label, flags)
{
this->particle = new Particle(particle);
}
MatPoint::~MatPoint()
{
delete this->particle;
}
double MatPoint::mass() const
{
return particle->mass;
}
const Vector& MatPoint::speed() const
{
return particle->speed;
}
const Vector& MatPoint::position() const
{
return particle->position;
}
Particle MatPoint::getParticle() const
{
return *(this->particle);
}
void MatPoint::setPosition(const Vector& pos)
{
this->particle->position = pos;
}
void MatPoint::move(const Vector& delta)
{
this->particle->position += delta;
}
void MatPoint::setSpeed(const Vector& speed)
{
this->particle->speed = speed;
}
void MatPoint::setMass(double mass)
{
this->particle->mass = mass;
}

Event Timeline