Movatterモバイル変換


[0]ホーム

URL:


Loading...
Searching...
No Matches
Vector3.hpp
Go to the documentation of this file.
1
2//
3// SFML - Simple and Fast Multimedia Library
4// Copyright (C) 2007-2025 Laurent Gomila (laurent@sfml-dev.org)
5//
6// This software is provided 'as-is', without any express or implied warranty.
7// In no event will the authors be held liable for any damages arising from the use of this software.
8//
9// Permission is granted to anyone to use this software for any purpose,
10// including commercial applications, and to alter it and redistribute it freely,
11// subject to the following restrictions:
12//
13// 1. The origin of this software must not be misrepresented;
14// you must not claim that you wrote the original software.
15// If you use this software in a product, an acknowledgment
16// in the product documentation would be appreciated but is not required.
17//
18// 2. Altered source versions must be plainly marked as such,
19// and must not be misrepresented as being the original software.
20//
21// 3. This notice may not be removed or altered from any source distribution.
22//
24
25#pragma once
26
28
29
30namespacesf
31{
37template <typename T>
39{
40public:
47constexprVector3() =default;
48
57constexprVector3(Tx, Ty, Tz);
58
63template <typename U>
64constexprexplicitoperatorVector3<U>()const;
65
72 [[nodiscard]]SFML_SYSTEM_API Tlength()const;
73
80 [[nodiscard]]constexpr TlengthSquared()const;
81
89
94 [[nodiscard]]constexpr Tdot(constVector3& rhs)const;
95
100 [[nodiscard]]constexprVector3cross(constVector3& rhs)const;
101
111 [[nodiscard]]constexprVector3componentWiseMul(constVector3& rhs)const;
112
123 [[nodiscard]]constexprVector3componentWiseDiv(constVector3& rhs)const;
124
126// Member data
128 Tx{};
129 Ty{};
130 Tz{};
131};
132
142template <typename T>
143[[nodiscard]]constexprVector3<T>operator-(constVector3<T>& left);
144
158template <typename T>
159constexprVector3<T>&operator+=(Vector3<T>& left,constVector3<T>& right);
160
174template <typename T>
175constexprVector3<T>&operator-=(Vector3<T>& left,constVector3<T>& right);
176
187template <typename T>
188[[nodiscard]]constexprVector3<T>operator+(constVector3<T>& left,constVector3<T>& right);
189
200template <typename T>
201[[nodiscard]]constexprVector3<T>operator-(constVector3<T>& left,constVector3<T>& right);
202
213template <typename T>
214[[nodiscard]]constexprVector3<T>operator*(constVector3<T>& left, T right);
215
226template <typename T>
227[[nodiscard]]constexprVector3<T>operator*(T left,constVector3<T>& right);
228
242template <typename T>
243constexprVector3<T>&operator*=(Vector3<T>& left, T right);
244
255template <typename T>
256[[nodiscard]]constexprVector3<T>operator/(constVector3<T>& left, T right);
257
271template <typename T>
272constexprVector3<T>&operator/=(Vector3<T>& left, T right);
273
286template <typename T>
287[[nodiscard]]constexprbooloperator==(constVector3<T>& left,constVector3<T>& right);
288
301template <typename T>
302[[nodiscard]]constexprbooloperator!=(constVector3<T>& left,constVector3<T>& right);
303
304// Aliases for the most common types
307
308}// namespace sf
309
310#include <SFML/System/Vector3.inl>
311
312
#define SFML_SYSTEM_API
Utility template class for manipulating 3-dimensional vectors.
DefinitionVector3.hpp:39
constexpr Vector3< T > operator/(const Vector3< T > &left, T right)
Overload of binary operator/
constexpr bool operator==(const Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator==
constexpr Vector3 cross(const Vector3 &rhs) const
Cross product of two 3D vectors.
constexpr Vector3< T > & operator/=(Vector3< T > &left, T right)
Overload of binary operator/=
constexpr Vector3 componentWiseDiv(const Vector3 &rhs) const
Component-wise division of *this and rhs.
constexpr T dot(const Vector3 &rhs) const
Dot product of two 3D vectors.
constexpr Vector3< T > & operator-=(Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator-=
constexpr Vector3< T > operator*(T left, const Vector3< T > &right)
Overload of binary operator*
constexpr Vector3< T > operator-(const Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator-
constexpr Vector3< T > & operator+=(Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator+=
constexpr Vector3< T > & operator*=(Vector3< T > &left, T right)
Overload of binary operator*=
constexpr Vector3(T x, T y, T z)
Construct the vector from its coordinates.
constexpr Vector3< T > operator*(const Vector3< T > &left, T right)
Overload of binary operator*
constexpr Vector3 componentWiseMul(const Vector3 &rhs) const
Component-wise multiplication of *this and rhs.
constexpr bool operator!=(const Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator!=
constexpr Vector3< T > operator+(const Vector3< T > &left, const Vector3< T > &right)
Overload of binary operator+
Vector3 normalized() const
Vector with same direction but length 1 (floating-point).
constexpr Vector3()=default
Default constructor.
constexpr T lengthSquared() const
Square of vector's length.
T length() const
Length of the vector (floating-point).
constexpr Vector3< T > operator-(const Vector3< T > &left)
Overload of unary operator-
Vector3< float > Vector3f
DefinitionVector3.hpp:306
Vector3< int > Vector3i
DefinitionVector3.hpp:305

[8]ページ先頭

©2009-2025 Movatter.jp