#include "client/math/Ray.h" #include "client/Utils.h" Ray::Ray() : lastLengthAngle(0), lengthAngle(0), lastWidthAngle(0), widthAngle(0) { } void Ray::store() { lastPosition = position; lastLengthAngle = lengthAngle; lastWidthAngle = widthAngle; } void Ray::set(const Vector& position, float lengthAngle, float widthAngle) { this->position = position; this->lengthAngle = lengthAngle; this->widthAngle = widthAngle; } Vector Ray::getPosition(float lag) const { Vector pos(lastPosition); pos.addMul(position, lag).addMul(lastPosition, -lag); return pos; } Vector Ray::getDirection(float lag) const { Vector direction; direction.setAngles(interpolate(lag, lastLengthAngle, lengthAngle), interpolate(lag, lastWidthAngle, widthAngle)); return direction; }