#pragma once

#include "particle.hpp"
#include "particle_contact.hpp"

namespace physics {

  struct particle_link
  {
    physics::particle * particle[2];

    float current_length() const;

    virtual int fill_contact(particle_contact * contact, int contact_length) const = 0;
  };

  struct particle_cable : particle_link
  {
    float max_length;
    float restitution;

    int fill_contact(particle_contact * contact, int contact_length) const override;
  };

  struct particle_rod : particle_link
  {
    float length;

    int fill_contact(particle_contact * contact, int contact_length) const override;
  };

  struct particle_constraint
  {
    physics::particle * particle;

    vec3 anchor;

    float current_length() const;

    virtual int fill_contact(particle_contact * contact, int contact_length) const = 0;
  };

  struct particle_cable_constraint : particle_constraint
  {
    float max_length;
    float restitution;

    int fill_contact(particle_contact * contact, int contact_length) const override;
  };
}
