65 |
T x, y, z; |
T x, y, z; |
66 |
Point3() : x(0), y(0), z(0) { } |
Point3() : x(0), y(0), z(0) { } |
67 |
Point3(T x, T y, T z) : x(x), y(y), z(z) { } |
Point3(T x, T y, T z) : x(x), y(y), z(z) { } |
68 |
Point3(Point<T> &p, T z = 0) : x(p.x), y(p.y), z(z) { } |
Point3(const Point<T> &p, T z = 0) : x(p.x), y(p.y), z(z) { } |
69 |
|
Point3(const Vector3<T> &v) : x(v.x), y(v.y), z(v.z) { } |
70 |
Vector3<T> operator-(const Point3 &p) const { |
Vector3<T> operator-(const Point3 &p) const { |
71 |
return Vector3<T>(x - p.x, y - p.y, z - p.z); } |
return Vector3<T>(x - p.x, y - p.y, z - p.z); } |
72 |
Point3<T> operator+(const Vector3<T> v) |
Point3<T> operator+(const Vector3<T> v) |
120 |
T x, y, z; |
T x, y, z; |
121 |
Vector3() : x(0), y(0), z(0) { } |
Vector3() : x(0), y(0), z(0) { } |
122 |
Vector3(T x, T y, T z) : x(x), y(y), z(z) { } |
Vector3(T x, T y, T z) : x(x), y(y), z(z) { } |
123 |
Vector3(Vector<T> &v, float z) : x(v.x), y(v.y), z(z) { } |
Vector3(const Vector<T> &v, float z) : x(v.x), y(v.y), z(z) { } |
124 |
|
Vector3(const Point3<T> &v) : x(v.x), y(v.y), z(v.z) { } |
125 |
Vector3 operator*(const double &s) const { return Vector3(s * x, s * y, s * z); } ; |
Vector3 operator*(const double &s) const { return Vector3(s * x, s * y, s * z); } ; |
126 |
|
|
127 |
template<class U> const Vector3 &operator*=(const U &s) { x *= s; y *= s; z *= s; |
template<class U> const Vector3 &operator*=(const U &s) { x *= s; y *= s; z *= s; |
145 |
x * v.y - y * v.x |
x * v.y - y * v.x |
146 |
); |
); |
147 |
} |
} |
148 |
|
Vector3 normalized() { return (1/length()) * *this ; } |
149 |
}; |
}; |
150 |
template<class T> Vector3<T> operator*(const double &s, const Vector3<T> &v) { |
template<class T> Vector3<T> operator*(const double &s, const Vector3<T> &v) { |
151 |
return v * s; |
return v * s; |