32 lines
547 B
C++
Executable File
32 lines
547 B
C++
Executable File
#ifndef P3_H
|
|
#define P3_H
|
|
|
|
struct P3 {
|
|
|
|
double x;
|
|
double y;
|
|
double z;
|
|
|
|
P3() : x(0), y(0), z(0) {;}
|
|
P3(const double x, const double y, const double z) : x(x), y(y), z(z) {;}
|
|
|
|
P3 operator - (const P3& o) const {
|
|
return P3(x-o.x, y-o.y, z-o.z);
|
|
}
|
|
|
|
P3 operator + (const P3& o) const {
|
|
return P3(x+o.x, y+o.y, z+o.z);
|
|
}
|
|
|
|
P3 operator * (const double v) const {
|
|
return P3(x*v, y*v, z*v);
|
|
}
|
|
|
|
double getLength(const double floorHeight_cm) const {
|
|
return std::sqrt(x*x + y*y + z*floorHeight_cm*z*floorHeight_cm);
|
|
}
|
|
|
|
};
|
|
|
|
#endif // P3_H
|