<commit_before>define([
	"floom/material",
	"floom/particle",
	"floom/group",
	"floom/node",
	"floom/obstacle",
	"floom/simulator",
	"floom/system"
], function(
	Material,
	Particle,
	Group,
	Node,
	Obstacle,
	Simulator,
	System
) {
	var Spring = function(particle1, particle2, restLength) {
		this.particle1 = particle1;
		this.particle2 = particle2;
		this.restLength = restLength;
		this.currentDistance = 0;
	};
	
	Spring.prototype.update = function() {
		this.currentDistance = this.particle1.position
			.sub(this.particle2.length)
			.length();
	};
	
	Spring.prototype.contains = function(particle) {
		return this.particle1 === particle || this.particle2 === particle;
	};
	
	return Spring;
});
<commit_msg>added first implementation to solve a Spring<commit_after>define([
	"floom/material",
	"floom/particle",
	"floom/group",
	"floom/node",
	"floom/obstacle",
	"floom/simulator",
	"floom/system"
], function(
	Material,
	Particle,
	Group,
	Node,
	Obstacle,
	Simulator,
	System
) {
	var Spring = function(particle1, particle2, restLength) {
		this.particle1 = particle1;
		this.particle2 = particle2;
		this.restLength = restLength;
		this.currentDistance = 0;
	};
	
	Spring.prototype.update = function() {
		this.currentDistance = this.particle1.position
			.sub(this.particle2.position)
			.length();
	};
	
	Spring.prototype.solve = function() {
		var p2position = this.particle2.position;
		var p1position = this.particle1.position;
		var rij = p2position.sub(p1position);
		rij.mulFloatSelf(1 / this.currentDistance);
		var D = this.particle1.material.springK * (this.restLength - this.currentDistance);
		rij.mulFloatSelf(D * 0.5);
		p1position.subSelf(rij);
		p2position.addSelf(rij);
	};
	
	Spring.prototype.contains = function(particle) {
		return this.particle1 === particle || this.particle2 === particle;
	};
	
	Spring.prototype.draw = function(renderer) {
		renderer.drawPolyline([
   		    this.particle1.position,
   		    this.particle2.position
   		]);
		
	};
	
	return Spring;
});

{'fraction_non_alphanumeric': 0.13577894235350166, 'fraction_numerical': 0.01715102429728442, 'mean_word_length': 3.3121149897330597, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6301279', 'n_tokens_mistral': 802, 'n_tokens_neox': 712, 'n_words': 121}