ofxPiMapper fixed for C++17 & oF 12.0
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

121 lines
2.1 KiB

#include "Vec3.h"
namespace ofx {
namespace piMapper {
Vec3::Vec3() : x(0.0f), y(0.0f), z(0.0f) {}
Vec3::Vec3(float ix, float iy, float iz){
x = ix;
y = iy;
z = iz;
}
Vec3::Vec3(glm::vec3 & src){
x = src.x;
y = src.y;
z = src.z;
}
glm::vec3 Vec3::toOf(){
return ofVec3f(x, y, z);
}
std::vector<glm::vec3> Vec3::toOf(std::vector<Vec3> & src){
std::vector<glm::vec3> retVal;
for(auto itm : src){
retVal.push_back(itm.toOf());
}
return retVal;
}
std::vector<Vec3> Vec3::fromOf(std::vector<glm::vec3> & src){
std::vector<Vec3> retVal;
for(auto itm : src){
retVal.push_back(Vec3(itm));
}
return retVal;
}
void Vec3::operator=(const Vec3 & other){
x = other.x;
y = other.y;
z = other.z;
}
void Vec3::operator+=(const Vec3 & other){
x += other.x;
y += other.y;
z += other.z;
}
void Vec3::operator*=(const Vec3 & other){
x *= other.x;
y *= other.y;
z *= other.z;
}
void Vec3::operator*=(float n){
x *= n;
y *= n;
z *= n;
}
void Vec3::operator/=(const Vec3 & other){
x /= other.x;
y /= other.y;
z /= other.z;
}
void Vec3::operator/=(float n){
x /= n;
y /= n;
z /= n;
}
Vec3 Vec3::operator+(const Vec3 & other){
return Vec3(x + other.x, y + other.y, z + other.z);
}
Vec3 Vec3::operator-(){
return Vec3(-x, -y, -z);
}
Vec3 Vec3::operator-(const Vec3 & other){
return Vec3(x - other.x, y - other.y, z - other.z);
}
Vec3 Vec3::operator*(const Vec3 & other){
return Vec3(x * other.x, y * other.y, z * other.z);
}
Vec3 Vec3::operator*(float n){
return Vec3(x * n, y * n, z * n);
}
Vec3 Vec3::operator/(const Vec3 & other){
return Vec3(x / other.x, y / other.y, z / other.z);
}
Vec3 Vec3::operator/(float n){
return Vec3(x / n, y / n, z / n);
}
bool Vec3::operator==(const Vec3 & other){
if(x == other.x && y == other.y && z == other.z){
return true;
}
return false;
}
bool Vec3::operator!=(const Vec3 & other){
if(x != other.x && y != other.y && z != other.z){
return true;
}
return false;
}
} // namespace piMapper
} // namespace ofx