Files
hexapod-robot/2016-ssc32-processing-port/Hexapod_NEW/Vector.h
T
mangavalk be287b066e Give the 2014, 2016 and 2019 robot sketches their own sketch folder
The Arduino IDE needs the folder name to match the .ino: HexapodRobot/, Hexapod_NEW/ and Hexapod_Teensy/. References in 2026-current/CLAUDE.md updated.
2026-10-25 17:31:44 +01:00

67 lines
1.1 KiB
C++

// Version 1
#ifndef Servo_H
#define Servo_H
class Vector
{
public:
float x, y, z;
Vector(float X, float Y, float Z)
{
x = X;
y = Y;
z = Z;
}
void Init(float X, float Y, float Z)
{
x = X;
y = Y;
z = Z;
}
Vector()
{
}
Vector Lerp(Vector start, Vector end, float percent)
{
Vector _new = (start + ((end - start) * percent));
x = _new.x;
y = _new.y;
z = _new.z;
return _new;
}
Vector operator + (const Vector other)
{
Vector _new = Vector();
_new.x = x + other.x;
_new.y = y + other.y;
_new.z = z + other.z;
return _new;
}
Vector operator - (const Vector other)
{
Vector _new = Vector();
_new.x = x - other.x;
_new.y = y - other.y;
_new.z = z - other.z;
return _new;
}
Vector operator * (const float other)
{
Vector _new = Vector(x * other, y * other, z * other);
return _new;
}
String Print()
{
return String(x) + " " + String(y) + " " + String(z);
}
};
#endif