#pragma once #include "cgp/cgp.hpp" using namespace cgp; struct chain { // Particles: std::vector<vec3> p; std::vector<vec3> v; std::vector<vec3> f_spring; std::vector<vec3> f_weight; std::vector<vec3> f_damping; std::vector<vec3> f; mesh_drawable particle_sphere; curve_drawable segment; float L0; // Rest-length of spring int n; //length of chain void initialize(); void simulation_step(float dt, vec3 bird_pos); vec3 spring_force(vec3 const& p_i, vec3 const& p_j, float L0, float K); };