#include "waves.hpp"

bool PosWaves::cmpPosWaves(const Point3d& other){
	return ((abs(this->x - other.x) < 1.0) && (abs(this->y - other.z) < 1.0));
}


int PosWaves::update(const Point3d& other, double el, float vwl = 1.0){
	if(cmpPosWaves(other)){
		this->x = other.x; this->y = other.z;
		if(el > (this->tStart + (this->wl*2)/PWSP)) this->tStart = el;
		this->wl = vwl;
		return 2;
	}
	// Utilisé pour connaitre les emplacements libres dans un vecteur de vagues
	return (el > (this->tStart + this->wl*2/PWSP));
}

int PosWaves::checkErase(double el){
	return (el > (this->tStart + this->wl*2/PWSP));
}

void PosWaves::print(){
	std::cerr << "{" << x << "," << y << "," << tStart << "," << wl << "}" << std::endl;
}
