17 #ifndef ASTRA_VECTOR3I_HPP
18 #define ASTRA_VECTOR3I_HPP
22 #include "capi/astra_ctypes.h"
46 ::astra_vector3i_t::x = rhs.x;
47 ::astra_vector3i_t::y = rhs.y;
48 ::astra_vector3i_t::z = rhs.z;
60 inline operator ::astra_vector3i_t*() {
return this; }
61 inline operator const ::astra_vector3i_t*()
const {
return this; }
64 std::int32_t length_squared()
const;
65 std::int32_t dot(
const Vector3i& v)
const;
71 static inline const Vector3i& zero();
80 Vector3i& operator*=(
const std::int32_t rhs);
81 Vector3i& operator/=(
const std::int32_t rhs);
92 inline float Vector3i::length()
const
94 return std::sqrt(
static_cast<float>(x * x + y * y + z * z));
97 inline std::int32_t Vector3i::length_squared()
const
99 return x * x + y * y + z * z;
102 inline std::int32_t Vector3i::dot(
const Vector3i& v)
const
104 return x * v.x + y * v.y + z * v.z;
107 inline Vector3i Vector3i::cross(
const Vector3i& v)
const
110 static_cast<std::int32_t
>(y*v.z - z*v.y),
111 static_cast<std::int32_t
>(z*v.x - x*v.z),
112 static_cast<std::int32_t
>(x*v.y - y*v.x));
115 inline Vector3i Vector3i::normalize(
const Vector3i& v)
117 double length = sqrt(
118 static_cast<float>(v.x*v.x + v.y*v.y + v.z*v.z));
122 return Vector3i(0, 0, 0);
127 static_cast<std::int32_t
>(v.x / length),
128 static_cast<std::int32_t
>(v.y / length),
129 static_cast<std::int32_t
>(v.z / length));
133 inline bool Vector3i::is_zero()
const
136 return *
this == zero;
139 inline Vector3i& Vector3i::operator+=(
const Vector3i& rhs)
141 this->x = this->x + rhs.x;
142 this->y = this->y + rhs.y;
143 this->z = this->z + rhs.z;
147 inline Vector3i& Vector3i::operator-=(
const Vector3i& rhs)
149 this->x = this->x - rhs.x;
150 this->y = this->y - rhs.y;
151 this->z = this->z - rhs.z;
155 inline Vector3i& Vector3i::operator*=(
const std::int32_t rhs)
157 this->x = this->x * rhs;
158 this->y = this->y * rhs;
159 this->z = this->z * rhs;
163 inline Vector3i& Vector3i::operator/=(
const std::int32_t rhs)
165 this->x =
static_cast<std::int32_t
>(this->x / rhs);
166 this->y =
static_cast<std::int32_t
>(this->y / rhs);
167 this->z =
static_cast<std::int32_t
>(this->z / rhs);
171 inline Vector3i Vector3i::operator-()
173 return Vector3i(-this->x, -this->y, -this->z);
176 inline bool operator==(
const Vector3i& lhs,
const Vector3i& rhs)
178 return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z;
181 inline bool operator!=(
const Vector3i& lhs,
const Vector3i& rhs)
183 return !(lhs == rhs);
186 inline Vector3i operator+(
const Vector3i& lhs,
const Vector3i& rhs)
188 return Vector3i(lhs.x + rhs.x, lhs.y + rhs.y, lhs.z + rhs.z);
191 inline Vector3i operator-(
const Vector3i& lhs,
const Vector3i& rhs)
193 return Vector3i(lhs.x - rhs.x, lhs.y - rhs.y, lhs.z - rhs.z);
196 inline Vector3i operator*(
const Vector3i& lhs,
const std::int32_t rhs)
198 return Vector3i(lhs.x * rhs, lhs.y * rhs, lhs.z * rhs);
201 inline Vector3i operator*(
const std::int32_t lhs,
const Vector3i& rhs)
206 inline Vector3i operator/(
const Vector3i& lhs,
const std::int32_t rhs)
209 static_cast<std::int32_t
>(lhs.x / rhs),
210 static_cast<std::int32_t
>(lhs.y / rhs),
211 static_cast<std::int32_t
>(lhs.z / rhs));
214 inline const Vector3i& Vector3i::zero()
216 static Vector3i zero;
bool operator!=(const ImageStreamMode &lhs, const ImageStreamMode &rhs)
compare is ImageStreamMode not equal
Definition: Image.hpp:247
bool operator==(const ImageStreamMode &lhs, const ImageStreamMode &rhs)
compare is ImageStreamMode equal
Definition: Image.hpp:230
Represents a float 3d vector
Definition: Vector3i.hpp:31
Definition: astra_ctypes.h:38