1#ifndef RAYLIB_CPP_INCLUDE_VECTOR3_HPP_
2#define RAYLIB_CPP_INCLUDE_VECTOR3_HPP_
4#ifndef RAYLIB_CPP_NO_MATH
10#include "./raylib.hpp"
11#include "./raymath.hpp"
12#include "./raylib-cpp-utils.hpp"
13#include "./RadiansDegrees.hpp"
21 Vector3(const ::Vector3& vec) : ::Vector3{vec.x, vec.y, vec.z} {}
23 Vector3(
float x,
float y,
float z) : ::Vector3{x, y, z} {}
24 Vector3(
float x,
float y) : ::Vector3{x, y, 0} {}
25 Vector3(
float x) : ::Vector3{x, 0, 0} {}
29 set(ColorToHSV(color));
32 GETTERSETTER(
float, X, x)
33 GETTERSETTER(
float, Y, y)
34 GETTERSETTER(
float, Z, z)
41 bool operator==(const ::Vector3& other)
const {
47 bool operator!=(const ::Vector3& other)
const {
48 return !(*
this == other);
51 std::string ToString()
const {
52 return TextFormat(
"Vector3(%f, %f, %f)", x, y, z);
55 operator std::string()
const {
59#ifndef RAYLIB_CPP_NO_MATH
64 return Vector3Add(*
this, vector3);
71 return Vector3Add(*
this, vector3);
74 Vector3& operator+=(const ::Vector3& vector3) {
75 set(Vector3Add(*
this, vector3));
84 return Vector3Subtract(*
this, vector3);
91 return Vector3Subtract(*
this, vector3);
94 Vector3& operator-=(const ::Vector3& vector3) {
95 set(Vector3Subtract(*
this, vector3));
104 return Vector3Negate(*
this);
111 return Vector3Negate(*
this);
118 return Vector3Multiply(*
this, vector3);
125 return Vector3Multiply(*
this, vector3);
132 set(Vector3Multiply(*
this, vector3));
141 return Vector3Scale(*
this, scaler);
148 return Vector3Scale(*
this, scaler);
155 set(Vector3Scale(*
this, scaler));
164 return Vector3Divide(*
this, vector3);
171 return Vector3Divide(*
this, vector3);
189 return ::Vector3{x / div, y / div, z / div};
214 return Vector3Length(*
this);
221 return Vector3LengthSqr(*
this);
225 return Vector3Normalize(*
this);
228 float DotProduct(const ::Vector3& vector3)
const {
229 return Vector3DotProduct(*
this, vector3);
232 float Distance(const ::Vector3& vector3)
const {
233 return Vector3Distance(*
this, vector3);
236 Vector3 Lerp(const ::Vector3& vector3,
const float amount)
const {
237 return Vector3Lerp(*
this, vector3, amount);
240 Vector3 CrossProduct(const ::Vector3& vector3)
const {
241 return Vector3CrossProduct(*
this, vector3);
244 Vector3 Perpendicular()
const {
245 return Vector3Perpendicular(*
this);
248 Vector3 Project(const ::Vector3& vector3)
const {
249 return Vector3Project(*
this, vector3);
252 Vector3 Reject(const ::Vector3& vector3)
const {
253 return Vector3Reject(*
this, vector3);
256 void OrthoNormalize(::Vector3* vector3) {
257 Vector3OrthoNormalize(
this, vector3);
260 Vector3 Transform(const ::Matrix& matrix)
const {
261 return Vector3Transform(*
this, matrix);
264 Vector3 RotateByQuaternion(const ::Quaternion& quaternion)
const {
265 return Vector3RotateByQuaternion(*
this, quaternion);
268 Vector3 Reflect(const ::Vector3& normal)
const {
269 return Vector3Reflect(*
this, normal);
272 Vector3 Min(const ::Vector3& vector3)
const {
273 return Vector3Min(*
this, vector3);
276 Vector3 Max(const ::Vector3& vector3)
const {
277 return Vector3Max(*
this, vector3);
280 Vector3 Barycenter(const ::Vector3& a, const ::Vector3& b, const ::Vector3& c)
const {
281 return Vector3Barycenter(*
this, a, b, c);
284 static Vector3 Zero() {
285 return Vector3Zero();
288 static Vector3 One() {
292 static inline Vector3 Left() {
296 static inline Vector3 Right() {
300 static inline Vector3 Up() {
304 static inline Vector3 Down() {
308 static inline Vector3 Forward() {
312 static inline Vector3 Back() {
317 void DrawLine3D(const ::Vector3& endPos, ::Color color)
const {
318 ::DrawLine3D(*
this, endPos, color);
321 void DrawPoint3D(::Color color)
const {
322 ::DrawPoint3D(*
this, color);
327 const ::Vector3& rotationAxis,
328 Radian rotationAngle,
330 ::DrawCircle3D(*
this, radius, rotationAxis, rotationAngle, color);
333 void DrawCube(
float width,
float height,
float length, ::Color color)
const {
334 ::DrawCube(*
this, width, height, length, color);
337 void DrawCube(const ::Vector3& size, ::Color color)
const {
338 ::DrawCubeV(*
this, size, color);
341 void DrawCubeWires(
float width,
float height,
float length, ::Color color)
const {
342 ::DrawCubeWires(*
this, width, height, length, color);
345 void DrawCubeWires(const ::Vector3& size, ::Color color)
const {
346 ::DrawCubeWiresV(*
this, size, color);
349 void DrawSphere(
float radius, ::Color color)
const {
350 ::DrawSphere(*
this, radius, color);
353 void DrawSphere(
float radius,
int rings,
int slices, ::Color color)
const {
354 ::DrawSphereEx(*
this, radius, rings, slices, color);
357 void DrawSphereWires(
float radius,
int rings,
int slices, ::Color color)
const {
358 ::DrawSphereWires(*
this, radius, rings, slices, color);
361 void DrawCylinder(
float radiusTop,
float radiusBottom,
float height,
362 int slices, ::Color color)
const {
363 ::DrawCylinder(*
this, radiusTop, radiusBottom, height, slices, color);
366 void DrawCylinderWires(
float radiusTop,
float radiusBottom,
float height,
367 int slices, ::Color color)
const {
368 ::DrawCylinderWires(*
this, radiusTop, radiusBottom, height, slices, color);
371 void DrawPlane(const ::Vector2& size, ::Color color)
const {
372 ::DrawPlane(*
this, size, color);
378 bool CheckCollision(
float radius1, const ::Vector3& center2,
float radius2)
const {
379 return CheckCollisionSpheres(*
this, radius1, center2, radius2);
383 void set(const ::Vector3& vec) {
Vector3 operator/(const ::Vector3 &vector3) const
Divide vector by vector.
Vector3 Negate() const
Negate provided vector (invert direction)
Vector3 operator-() const
Negate provided vector (invert direction)
Vector3 & operator/=(const ::Vector3 &vector3)
Divide vector by vector.
Vector3 operator*(const ::Vector3 &vector3) const
Multiply vector by vector.
Vector3 & operator*=(const float scaler)
Multiply vector by scalar.
Vector3 & operator*=(const ::Vector3 &vector3)
Multiply vector by vector.
Vector3 operator/(const float div) const
Divide a vector by a value.
float LengthSqr() const
Calculate vector square length.
Vector3 operator+(const ::Vector3 &vector3) const
Add two vectors.
Vector3 Add(const ::Vector3 &vector3) const
Add two vectors.
Vector3 Scale(const float scaler) const
Multiply vector by scalar.
float Length() const
Calculate vector length.
Vector3 Divide(const ::Vector3 &vector3) const
Divide vector by vector.
Vector3 Divide(const float div) const
Divide a vector by a value.
Vector3 Subtract(const ::Vector3 &vector3) const
Subtract two vectors.
Vector3 & operator/=(const float div)
Divide a vector by a value.
Vector3 Multiply(const ::Vector3 &vector3) const
Multiply vector by vector.
Vector3 operator-(const ::Vector3 &vector3) const
Subtract two vectors.
bool CheckCollision(float radius1, const ::Vector3 ¢er2, float radius2) const
Detect collision between two spheres.
Vector3 operator*(const float scaler) const
Multiply vector by scalar.