Skip to content

Instantly share code, notes, and snippets.

@Ben1980
Created March 5, 2019 20:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Ben1980/76ed5a74ffb3156b1a85469a7b6a7df9 to your computer and use it in GitHub Desktop.
Save Ben1980/76ed5a74ffb3156b1a85469a7b6a7df9 to your computer and use it in GitHub Desktop.
class ParticleBuilder {
public:
ParticleBuilder() : mMass(0) {}
ParticleBuilder & position(const Vector2D &position);
ParticleBuilder & velocity(const Vector2D &velocity);
ParticleBuilder & acceleration(const Vector2D &acceleration);
ParticleBuilder & mass(double mass);
Particle build() const;
std::vector<Particle> build(size_t numberOfParticles);
private:
double mMass;
Vector2D mAcceleration;
Vector2D mVelocity;
Vector2D mPosition;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment