OpenSiv3D  v0.6.5
C++20 framework for creative coding
s3d::Vector2D< Type > Struct Template Reference

2 次元のベクトル More...

#include <Vector2D.hpp>

Public Types

using value_type = Type
 ベクトルの要素の型 More...
 

Public Member Functions

SIV3D_NODISCARD_CXX20 Vector2D ()=default
 
SIV3D_NODISCARD_CXX20 Vector2D (const Vector2D &)=default
 
constexpr SIV3D_NODISCARD_CXX20 Vector2D (value_type _x, value_type _y) noexcept
 
template<class X , class Y >
constexpr SIV3D_NODISCARD_CXX20 Vector2D (X _x, Y _y) noexcept
 
constexpr SIV3D_NODISCARD_CXX20 Vector2D (Point p) noexcept
 
template<class U >
constexpr SIV3D_NODISCARD_CXX20 Vector2D (const Vector2D< U > &v) noexcept
 
constexpr value_type elem (size_t index) const noexcept
 
value_typegetPointer () noexcept
 
const value_typegetPointer () const noexcept
 
constexpr Vector2Doperator= (const Vector2D &)=default
 
constexpr Vector2D operator+ () const noexcept
 
constexpr Vector2D operator- () const noexcept
 
constexpr Vector2D operator+ (Vector2D v) const noexcept
 
constexpr Vector2D operator- (Vector2D v) const noexcept
 
constexpr Vector2D operator* (value_type s) const noexcept
 
constexpr Vector2D operator* (Vector2D v) const noexcept
 
constexpr Vector2D operator/ (value_type s) const noexcept
 
constexpr Vector2D operator/ (Vector2D v) const noexcept
 
constexpr Vector2Doperator+= (Vector2D v) noexcept
 
constexpr Vector2Doperator-= (Vector2D v) noexcept
 
constexpr Vector2Doperator*= (value_type s) noexcept
 
constexpr Vector2Doperator*= (Vector2D v) noexcept
 
constexpr Vector2Doperator/= (value_type s) noexcept
 
constexpr Vector2Doperator/= (Vector2D v) noexcept
 
constexpr bool epsilonEquals (Vector2D other, value_type epsilon) const noexcept
 指定した別のベクトルとの各成分の差の絶対値が epsilon 以下であるかを返します。 More...
 
constexpr bool hasSameDirection (Vector2D other) const noexcept
 指定した別のベクトルとのなす角が 180 ° 未満であるかを返します。 More...
 
constexpr bool hasOppositeDirection (Vector2D other) const noexcept
 指定した別のベクトルとのなす角が 180 ° より大きいかを返します。 More...
 
constexpr bool isZero () const noexcept
 ゼロベクトルであるかを返します。 More...
 
bool hasNaN () const noexcept
 NaN である成分を持つかを返します。 More...
 
constexpr value_type minComponent () const noexcept
 最小の成分を返します。 More...
 
constexpr value_type maxComponent () const noexcept
 最大の成分を返します。 More...
 
constexpr void clear () noexcept
 各成分を 0 にセットします。 More...
 
constexpr Vector2Dset (value_type _x, value_type _y) noexcept
 各成分を変更します。 More...
 
constexpr Vector2Dset (Vector2D v) noexcept
 ベクトルを変更します。 More...
 
constexpr Vector2D movedBy (value_type _x, value_type _y) const noexcept
 位置ベクトルを移動させた新しいベクトルを返します。 More...
 
constexpr Vector2D movedBy (Vector2D v) const noexcept
 位置ベクトルを移動させた新しいベクトルを返します。 More...
 
constexpr Vector2DmoveBy (value_type _x, value_type _y) noexcept
 位置ベクトルを移動させます。 More...
 
constexpr Vector2DmoveBy (Vector2D v) noexcept
 位置ベクトルを移動させます。 More...
 
Vector2D clamped (const RectF &rect) const noexcept
 
Vector2Dclamp (const RectF &rect) noexcept
 
constexpr value_type dot (Vector2D v) const noexcept
 
constexpr value_type cross (Vector2D v) const noexcept
 
constexpr value_type horizontalAspectRatio () const noexcept
 
value_type length () const noexcept
 ベクトルの大きさ(長さ)を返します。 More...
 
constexpr value_type lengthSq () const noexcept
 ベクトルの大きさ(長さ)の二乗を返します。 More...
 
value_type invLength () const noexcept
 ベクトルの長さの逆数 (1 / length())を返します。 More...
 
constexpr value_type manhattanLength () const noexcept
 原点からこの位置ベクトルまでのマンハッタン距離を返します。 More...
 
constexpr value_type manhattanDistanceFrom (value_type _x, value_type _y) const noexcept
 別の位置ベクトルからのマンハッタン距離を返します。 More...
 
constexpr value_type manhattanDistanceFrom (Vector2D v) const noexcept
 別の位置ベクトルからのマンハッタン距離を返します。 More...
 
value_type distanceFrom (value_type _x, value_type _y) const noexcept
 別の位置ベクトルからの距離を返します。 More...
 
value_type distanceFrom (Vector2D v) const noexcept
 別の位置ベクトルからの距離を返します。 More...
 
constexpr value_type distanceFromSq (value_type _x, value_type _y) const noexcept
 別の位置ベクトルからの距離の二乗を返します。 More...
 
constexpr value_type distanceFromSq (Vector2D v) const noexcept
 別の位置ベクトルからの距離の二乗を返します。 More...
 
Vector2D withLength (value_type _length) const noexcept
 向きが同じで大きさ(長さ)を変更した新しいベクトルを返します。 More...
 
Vector2DsetLength (value_type _length) noexcept
 ベクトルの向きはそのままで、大きさ(長さ)だけを変更します。 More...
 
Vector2D limitLength (value_type maxLength) const noexcept
 向きが同じで大きさ(長さ)を一定の値以下にした新しいベクトルを返します。 More...
 
Vector2DlimitLengthSelf (value_type maxLength) noexcept
 ベクトルの向きはそのままで、大きさ(長さ)を一定の値以下にします More...
 
Vector2D normalized () const noexcept
 正規化した(大きさを 1 にした)ベクトルを返します。 More...
 
Vector2Dnormalize () noexcept
 自身を正規化(大きさを 1 に)します。 More...
 
Vector2D rotated (value_type angle) const noexcept
 
Vector2Drotate (value_type angle) noexcept
 
Vector2D rotatedAt (Vector2D center, value_type angle) const noexcept
 
Vector2DrotateAt (Vector2D center, value_type angle) noexcept
 
value_type getAngle () const noexcept
 
value_type getAngle (Vector2D other) const noexcept
 
constexpr Vector2D getPerpendicularCW () const noexcept
 
constexpr Vector2D getPerpendicularCCW () const noexcept
 
constexpr Vector2D getMidpoint (Vector2D other) const noexcept
 
constexpr Vector2D projection (Vector2D onto) const noexcept
 
Vector2D getPointByAngleAndDistance (value_type angle, value_type distance) const noexcept
 
constexpr Vector2D lerp (Vector2D other, value_type f) const noexcept
 
constexpr Point asPoint () const noexcept
 Vec2 を Point 型に変換します。小数点数以下は切り捨てられます。 More...
 
Circle asCircle (double r) const noexcept
 点を中心とした円を作成します。 More...
 
template<class Shape2DType >
constexpr bool intersects (const Shape2DType &other) const
 
size_t hash () const noexcept
 
constexpr Vector2D xx () const noexcept
 Vector2D{ x, x } を返します。 More...
 
constexpr Vector2D xy () const noexcept
 Vector2D{ x, y } を返します。 More...
 
constexpr Vector2D yx () const noexcept
 Vector2D{ y, x } を返します。 More...
 
constexpr Vector2D yy () const noexcept
 Vector2D{ y, y } を返します。 More...
 
constexpr Vector2D x0 () const noexcept
 Vector2D{ x, 0 } を返します。 More...
 
constexpr Vector2D y0 () const noexcept
 Vector2D{ y, 0 } を返します。 More...
 
constexpr Vector3D< Type > xy0 () const noexcept
 

Static Public Member Functions

static constexpr Vector2D Zero () noexcept
 Vector2D{ 0, 0 } を返します。 More...
 
static constexpr Vector2D One () noexcept
 Vector2D{ 1, 1 } を返します。 More...
 
static constexpr Vector2D All (value_type value=1) noexcept
 Vector2D{ value, value } を返します。 More...
 
static constexpr Vector2D UnitX () noexcept
 Vector2D{ 1, 0 } を返します。 More...
 
static constexpr Vector2D UnitY () noexcept
 Vector2D{ 0, 1 } を返します。 More...
 
static constexpr Vector2D Left (value_type length=1) noexcept
 Vector2D{ -length, 0 } を返します。 More...
 
static constexpr Vector2D Right (value_type length=1) noexcept
 Vector2D{ length, 0 } を返します。 More...
 
static constexpr Vector2D Up (value_type length=1) noexcept
 Vector2D{ 0, -length } を返します。 More...
 
static constexpr Vector2D Down (value_type length=1) noexcept
 Vector2D{ 0, length } を返します。 More...
 
static constexpr Vector2D AnchorCenter () noexcept
 Vector2D{ 0.5, 0.5 } を返します。 More...
 
static constexpr Vector2D AnchorTopLeft () noexcept
 Vector2D{ 0, 0 } を返します。 More...
 
static constexpr Vector2D AnchorTopCenter () noexcept
 Vector2D{ 0.5, 0 } を返します。 More...
 
static constexpr Vector2D AnchorTopRight () noexcept
 Vector2D{ 1, 0 } を返します。 More...
 
static constexpr Vector2D AnchorRightCenter () noexcept
 Vector2D{ 1, 0.5 } を返します。 More...
 
static constexpr Vector2D AnchorBottomRight () noexcept
 Vector2D{ 1, 1 } を返します。 More...
 
static constexpr Vector2D AnchorBottomCenter () noexcept
 Vector2D{ 0.5, 1 } を返します。 More...
 
static constexpr Vector2D AnchorBottomLeft () noexcept
 Vector2D{ 0, 1 } を返します。 More...
 
static constexpr Vector2D AnchorLeftCenter () noexcept
 Vector2D{ 0, 0.5 } を返します。 More...
 
static void _Formatter (FormatData &formatData, const Vector2D &value)
 

Public Attributes

value_type x
 ベクトルの X 成分 More...
 
value_type y
 ベクトルの Y 成分 More...
 

Static Public Attributes

static constexpr size_t Dimension = 2
 ベクトルの次元数 More...
 

Friends

SIV3D_CONCEPT_ARITHMETIC constexpr friend Vector2D operator* (Arithmetic s, Vector2D v) noexcept
 
constexpr friend bool operator== (Vector2D lhs, Vector2D rhs) noexcept
 
constexpr friend bool operator!= (Vector2D lhs, Vector2D rhs) noexcept
 
template<class CharType >
std::basic_ostream< CharType > & operator<< (std::basic_ostream< CharType > &output, const Vector2D &value)
 
template<class CharType >
std::basic_istream< CharType > & operator>> (std::basic_istream< CharType > &input, Vector2D &value)
 
void Formatter (FormatData &formatData, const Vector2D &value)
 

Detailed Description

template<class Type>
struct s3d::Vector2D< Type >

2 次元のベクトル

Template Parameters
Typeベクトルの要素の型

Member Typedef Documentation

◆ value_type

template<class Type >
using s3d::Vector2D< Type >::value_type = Type

ベクトルの要素の型

Constructor & Destructor Documentation

◆ Vector2D() [1/6]

template<class Type >
SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( )
default

◆ Vector2D() [2/6]

template<class Type >
SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( const Vector2D< Type > &  )
default

◆ Vector2D() [3/6]

template<class Type >
constexpr SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( value_type  _x,
value_type  _y 
)
inlineconstexprnoexcept

◆ Vector2D() [4/6]

template<class Type >
template<class X , class Y >
constexpr SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( _x,
_y 
)
constexprnoexcept

◆ Vector2D() [5/6]

template<class Type >
constexpr SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( Point  p)
constexprnoexcept

◆ Vector2D() [6/6]

template<class Type >
template<class U >
constexpr SIV3D_NODISCARD_CXX20 s3d::Vector2D< Type >::Vector2D ( const Vector2D< U > &  v)
constexprnoexcept

Member Function Documentation

◆ _Formatter()

template<class Type >
static void s3d::Vector2D< Type >::_Formatter ( FormatData formatData,
const Vector2D< Type > &  value 
)
static

◆ All()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::All ( value_type  value = 1)
staticconstexprnoexcept

Vector2D{ value, value } を返します。

Parameters
value
Returns
Vector2D{ value, value }

◆ AnchorBottomCenter()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorBottomCenter ( )
staticconstexprnoexcept

Vector2D{ 0.5, 1 } を返します。

Returns
Vector2D{ 0.5, 1 }

◆ AnchorBottomLeft()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorBottomLeft ( )
staticconstexprnoexcept

Vector2D{ 0, 1 } を返します。

Returns
Vector2D{ 0, 1 }

◆ AnchorBottomRight()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorBottomRight ( )
staticconstexprnoexcept

Vector2D{ 1, 1 } を返します。

Returns
Vector2D{ 1, 1 }

◆ AnchorCenter()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorCenter ( )
staticconstexprnoexcept

Vector2D{ 0.5, 0.5 } を返します。

Returns
Vector2D{ 0.5, 0.5 }

◆ AnchorLeftCenter()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorLeftCenter ( )
staticconstexprnoexcept

Vector2D{ 0, 0.5 } を返します。

Returns
Vector2D{ 0, 0.5 }

◆ AnchorRightCenter()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorRightCenter ( )
staticconstexprnoexcept

Vector2D{ 1, 0.5 } を返します。

Returns
Vector2D{ 1, 0.5 }

◆ AnchorTopCenter()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorTopCenter ( )
staticconstexprnoexcept

Vector2D{ 0.5, 0 } を返します。

Returns
Vector2D{ 0.5, 0 }

◆ AnchorTopLeft()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorTopLeft ( )
staticconstexprnoexcept

Vector2D{ 0, 0 } を返します。

Returns
Vector2D{ 0, 0 }

◆ AnchorTopRight()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::AnchorTopRight ( )
staticconstexprnoexcept

Vector2D{ 1, 0 } を返します。

Returns
Vector2D{ 1, 0 }

◆ asCircle()

template<class Type >
Circle s3d::Vector2D< Type >::asCircle ( double  r) const
noexcept

点を中心とした円を作成します。

Parameters
r円の半径
Returns

◆ asPoint()

template<class Type >
constexpr Point s3d::Vector2D< Type >::asPoint ( ) const
constexprnoexcept

Vec2 を Point 型に変換します。小数点数以下は切り捨てられます。

Returns
Point

◆ clamp()

template<class Type >
Vector2D& s3d::Vector2D< Type >::clamp ( const RectF rect)
noexcept

◆ clamped()

template<class Type >
Vector2D s3d::Vector2D< Type >::clamped ( const RectF rect) const
noexcept

◆ clear()

template<class Type >
constexpr void s3d::Vector2D< Type >::clear ( )
constexprnoexcept

各成分を 0 にセットします。

◆ cross()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::cross ( Vector2D< Type >  v) const
constexprnoexcept

◆ distanceFrom() [1/2]

template<class Type >
value_type s3d::Vector2D< Type >::distanceFrom ( value_type  _x,
value_type  _y 
) const
noexcept

別の位置ベクトルからの距離を返します。

Parameters
_x別の位置ベクトルの X 成分
_y別の位置ベクトルの Y 成分
Returns
別の位置ベクトルからの距離

◆ distanceFrom() [2/2]

template<class Type >
value_type s3d::Vector2D< Type >::distanceFrom ( Vector2D< Type >  v) const
noexcept

別の位置ベクトルからの距離を返します。

Parameters
v別の位置ベクトル
Returns
別の位置ベクトルからの距離

◆ distanceFromSq() [1/2]

template<class Type >
constexpr value_type s3d::Vector2D< Type >::distanceFromSq ( value_type  _x,
value_type  _y 
) const
constexprnoexcept

別の位置ベクトルからの距離の二乗を返します。

Parameters
_x別の位置ベクトルの X 成分
_y別の位置ベクトルの Y 成分
Remarks
平方根を計算しないため distanceFrom() より高速です。
Returns
別の位置ベクトルからの距離の二乗

◆ distanceFromSq() [2/2]

template<class Type >
constexpr value_type s3d::Vector2D< Type >::distanceFromSq ( Vector2D< Type >  v) const
constexprnoexcept

別の位置ベクトルからの距離の二乗を返します。

Parameters
v別の位置ベクトル
Remarks
平方根を計算しないため distanceFrom() より高速です。
Returns
別の位置ベクトルからの距離の二乗

◆ dot()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::dot ( Vector2D< Type >  v) const
constexprnoexcept

◆ Down()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::Down ( value_type  length = 1)
staticconstexprnoexcept

Vector2D{ 0, length } を返します。

Returns
Vector2D{ 0, length }

◆ elem()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::elem ( size_t  index) const
constexprnoexcept

◆ epsilonEquals()

template<class Type >
constexpr bool s3d::Vector2D< Type >::epsilonEquals ( Vector2D< Type >  other,
value_type  epsilon 
) const
constexprnoexcept

指定した別のベクトルとの各成分の差の絶対値が epsilon 以下であるかを返します。

Parameters
other別のベクトル
epsilon差の絶対値の許容量
Returns
別のベクトルとの各成分の差の絶対値が epsilon 以下である場合 true, それ以外の場合は false

◆ getAngle() [1/2]

template<class Type >
value_type s3d::Vector2D< Type >::getAngle ( ) const
noexcept

◆ getAngle() [2/2]

template<class Type >
value_type s3d::Vector2D< Type >::getAngle ( Vector2D< Type >  other) const
noexcept

◆ getMidpoint()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::getMidpoint ( Vector2D< Type >  other) const
constexprnoexcept

◆ getPerpendicularCCW()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::getPerpendicularCCW ( ) const
constexprnoexcept

◆ getPerpendicularCW()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::getPerpendicularCW ( ) const
constexprnoexcept

◆ getPointByAngleAndDistance()

template<class Type >
Vector2D s3d::Vector2D< Type >::getPointByAngleAndDistance ( value_type  angle,
value_type  distance 
) const
noexcept

◆ getPointer() [1/2]

template<class Type >
const value_type* s3d::Vector2D< Type >::getPointer ( ) const
noexcept

◆ getPointer() [2/2]

template<class Type >
value_type* s3d::Vector2D< Type >::getPointer ( )
noexcept

◆ hash()

template<class Type >
size_t s3d::Vector2D< Type >::hash ( ) const
noexcept

◆ hasNaN()

template<class Type >
bool s3d::Vector2D< Type >::hasNaN ( ) const
noexcept

NaN である成分を持つかを返します。

Returns
NaN である成分を持つ場合 true, それ以外の場合は false

◆ hasOppositeDirection()

template<class Type >
constexpr bool s3d::Vector2D< Type >::hasOppositeDirection ( Vector2D< Type >  other) const
constexprnoexcept

指定した別のベクトルとのなす角が 180 ° より大きいかを返します。

Parameters
other別のベクトル
Returns
別のベクトルとのなす角が 180 ° より大きい場合 true, それ以外の場合は false

◆ hasSameDirection()

template<class Type >
constexpr bool s3d::Vector2D< Type >::hasSameDirection ( Vector2D< Type >  other) const
constexprnoexcept

指定した別のベクトルとのなす角が 180 ° 未満であるかを返します。

Parameters
other別のベクトル
Returns
別のベクトルとのなす角が 180 ° 未満である場合 true, それ以外の場合は false

◆ horizontalAspectRatio()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::horizontalAspectRatio ( ) const
constexprnoexcept

◆ intersects()

template<class Type >
template<class Shape2DType >
constexpr bool s3d::Vector2D< Type >::intersects ( const Shape2DType &  other) const
constexpr

◆ invLength()

template<class Type >
value_type s3d::Vector2D< Type >::invLength ( ) const
noexcept

ベクトルの長さの逆数 (1 / length())を返します。

Returns
ベクトルの長さの逆数

◆ isZero()

template<class Type >
constexpr bool s3d::Vector2D< Type >::isZero ( ) const
constexprnoexcept

ゼロベクトルであるかを返します。

Returns
ゼロベクトルである場合 true, それ以外の場合は false

◆ Left()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::Left ( value_type  length = 1)
staticconstexprnoexcept

Vector2D{ -length, 0 } を返します。

Parameters
length
Returns
Vector2D{ -length, 0 }

◆ length()

template<class Type >
value_type s3d::Vector2D< Type >::length ( ) const
noexcept

ベクトルの大きさ(長さ)を返します。

Returns
ベクトルの大きさ(長さ)

◆ lengthSq()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::lengthSq ( ) const
constexprnoexcept

ベクトルの大きさ(長さ)の二乗を返します。

Remarks
平方根を計算しないため length() より高速です。
Returns
ベクトルの大きさ(長さ)の二乗

◆ lerp()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::lerp ( Vector2D< Type >  other,
value_type  f 
) const
constexprnoexcept

◆ limitLength()

template<class Type >
Vector2D s3d::Vector2D< Type >::limitLength ( value_type  maxLength) const
noexcept

向きが同じで大きさ(長さ)を一定の値以下にした新しいベクトルを返します。

Parameters
maxLengthベクトルの最大の大きさ(長さ)
Returns
大きさ(長さ)を一定の値以下にした新しいベクトル

◆ limitLengthSelf()

template<class Type >
Vector2D& s3d::Vector2D< Type >::limitLengthSelf ( value_type  maxLength)
noexcept

ベクトルの向きはそのままで、大きさ(長さ)を一定の値以下にします

Parameters
maxLengthベクトルの最大の大きさ(長さ)
Returns
*this

◆ manhattanDistanceFrom() [1/2]

template<class Type >
constexpr value_type s3d::Vector2D< Type >::manhattanDistanceFrom ( value_type  _x,
value_type  _y 
) const
constexprnoexcept

別の位置ベクトルからのマンハッタン距離を返します。

Parameters
_x別の位置ベクトルの X 成分
_y別の位置ベクトルの Y 成分
Returns
別の位置ベクトルからのマンハッタン距離

◆ manhattanDistanceFrom() [2/2]

template<class Type >
constexpr value_type s3d::Vector2D< Type >::manhattanDistanceFrom ( Vector2D< Type >  v) const
constexprnoexcept

別の位置ベクトルからのマンハッタン距離を返します。

Parameters
v別の位置ベクトル
Returns
別の位置ベクトルからのマンハッタン距離

◆ manhattanLength()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::manhattanLength ( ) const
constexprnoexcept

原点からこの位置ベクトルまでのマンハッタン距離を返します。

Returns
原点からのマンハッタン距離

◆ maxComponent()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::maxComponent ( ) const
constexprnoexcept

最大の成分を返します。

Returns
最大の成分

◆ minComponent()

template<class Type >
constexpr value_type s3d::Vector2D< Type >::minComponent ( ) const
constexprnoexcept

最小の成分を返します。

Returns
最小の成分

◆ moveBy() [1/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::moveBy ( value_type  _x,
value_type  _y 
)
constexprnoexcept

位置ベクトルを移動させます。

Parameters
_xX 成分の移動量
_yY 成分の移動量
Returns
*this

◆ moveBy() [2/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::moveBy ( Vector2D< Type >  v)
constexprnoexcept

位置ベクトルを移動させます。

Parameters
v移動量
Returns
*this

◆ movedBy() [1/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::movedBy ( value_type  _x,
value_type  _y 
) const
constexprnoexcept

位置ベクトルを移動させた新しいベクトルを返します。

Parameters
_xX 成分の移動量
_yY 成分の移動量
Returns
移動後の新しいベクトル

◆ movedBy() [2/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::movedBy ( Vector2D< Type >  v) const
constexprnoexcept

位置ベクトルを移動させた新しいベクトルを返します。

Parameters
v移動量
Returns
移動後の新しいベクトル

◆ normalize()

template<class Type >
Vector2D& s3d::Vector2D< Type >::normalize ( )
noexcept

自身を正規化(大きさを 1 に)します。

Returns
*this

◆ normalized()

template<class Type >
Vector2D s3d::Vector2D< Type >::normalized ( ) const
noexcept

正規化した(大きさを 1 にした)ベクトルを返します。

Returns
正規化した(大きさを 1 にした)ベクトル

◆ One()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::One ( )
staticconstexprnoexcept

Vector2D{ 1, 1 } を返します。

Returns
Vector2D{ 1, 1 }

◆ operator*() [1/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator* ( value_type  s) const
constexprnoexcept

◆ operator*() [2/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator* ( Vector2D< Type >  v) const
constexprnoexcept

◆ operator*=() [1/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator*= ( value_type  s)
constexprnoexcept

◆ operator*=() [2/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator*= ( Vector2D< Type >  v)
constexprnoexcept

◆ operator+() [1/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator+ ( ) const
constexprnoexcept

◆ operator+() [2/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator+ ( Vector2D< Type >  v) const
constexprnoexcept

◆ operator+=()

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator+= ( Vector2D< Type >  v)
constexprnoexcept

◆ operator-() [1/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator- ( ) const
constexprnoexcept

◆ operator-() [2/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator- ( Vector2D< Type >  v) const
constexprnoexcept

◆ operator-=()

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator-= ( Vector2D< Type >  v)
constexprnoexcept

◆ operator/() [1/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator/ ( value_type  s) const
constexprnoexcept

◆ operator/() [2/2]

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::operator/ ( Vector2D< Type >  v) const
constexprnoexcept

◆ operator/=() [1/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator/= ( value_type  s)
constexprnoexcept

◆ operator/=() [2/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator/= ( Vector2D< Type >  v)
constexprnoexcept

◆ operator=()

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::operator= ( const Vector2D< Type > &  )
constexprdefault

◆ projection()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::projection ( Vector2D< Type >  onto) const
constexprnoexcept

◆ Right()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::Right ( value_type  length = 1)
staticconstexprnoexcept

Vector2D{ length, 0 } を返します。

Parameters
length
Returns
Vector2D{ length, 0 }

◆ rotate()

template<class Type >
Vector2D& s3d::Vector2D< Type >::rotate ( value_type  angle)
noexcept

◆ rotateAt()

template<class Type >
Vector2D& s3d::Vector2D< Type >::rotateAt ( Vector2D< Type >  center,
value_type  angle 
)
noexcept

◆ rotated()

template<class Type >
Vector2D s3d::Vector2D< Type >::rotated ( value_type  angle) const
noexcept

◆ rotatedAt()

template<class Type >
Vector2D s3d::Vector2D< Type >::rotatedAt ( Vector2D< Type >  center,
value_type  angle 
) const
noexcept

◆ set() [1/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::set ( value_type  _x,
value_type  _y 
)
constexprnoexcept

各成分を変更します。

Parameters
_x新しい X 成分
_y新しい Y 成分
Returns
*this

◆ set() [2/2]

template<class Type >
constexpr Vector2D& s3d::Vector2D< Type >::set ( Vector2D< Type >  v)
constexprnoexcept

ベクトルを変更します。

Parameters
v新しいベクトル
Returns
*this

◆ setLength()

template<class Type >
Vector2D& s3d::Vector2D< Type >::setLength ( value_type  _length)
noexcept

ベクトルの向きはそのままで、大きさ(長さ)だけを変更します。

Parameters
_lengthベクトルの大きさ(長さ)
Remarks
自身がゼロベクトルの場合は何もしません。
Returns
*this

◆ UnitX()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::UnitX ( )
staticconstexprnoexcept

Vector2D{ 1, 0 } を返します。

Returns
Vector2D{ 1, 0 }

◆ UnitY()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::UnitY ( )
staticconstexprnoexcept

Vector2D{ 0, 1 } を返します。

Returns
Vector2D{ 0, 1 }

◆ Up()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::Up ( value_type  length = 1)
staticconstexprnoexcept

Vector2D{ 0, -length } を返します。

Parameters
length
Returns
Vector2D{ 0, -length }

◆ withLength()

template<class Type >
Vector2D s3d::Vector2D< Type >::withLength ( value_type  _length) const
noexcept

向きが同じで大きさ(長さ)を変更した新しいベクトルを返します。

Parameters
_lengthベクトルの大きさ(長さ)
Returns
新しいベクトル。自身がゼロベクトルの場合はゼロベクトル

◆ x0()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::x0 ( ) const
constexprnoexcept

Vector2D{ x, 0 } を返します。

Returns
Vector2D{ x, 0 }

◆ xx()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::xx ( ) const
constexprnoexcept

Vector2D{ x, x } を返します。

Returns
Vector2D{ x, x }

◆ xy()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::xy ( ) const
constexprnoexcept

Vector2D{ x, y } を返します。

Returns
Vector2D{ x, y }

◆ xy0()

template<class Type >
constexpr Vector3D<Type> s3d::Vector2D< Type >::xy0 ( ) const
constexprnoexcept

◆ y0()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::y0 ( ) const
constexprnoexcept

Vector2D{ y, 0 } を返します。

Returns
Vector2D{ y, 0 }

◆ yx()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::yx ( ) const
constexprnoexcept

Vector2D{ y, x } を返します。

Returns
Vector2D{ y, x }

◆ yy()

template<class Type >
constexpr Vector2D s3d::Vector2D< Type >::yy ( ) const
constexprnoexcept

Vector2D{ y, y } を返します。

Returns
Vector2D{ y, y }

◆ Zero()

template<class Type >
static constexpr Vector2D s3d::Vector2D< Type >::Zero ( )
staticconstexprnoexcept

Vector2D{ 0, 0 } を返します。

Returns
Vector2D{ 0, 0 }

Friends And Related Function Documentation

◆ Formatter

template<class Type >
void Formatter ( FormatData formatData,
const Vector2D< Type > &  value 
)
friend

◆ operator!=

template<class Type >
constexpr friend bool operator!= ( Vector2D< Type >  lhs,
Vector2D< Type >  rhs 
)
friend

◆ operator*

template<class Type >
SIV3D_CONCEPT_ARITHMETIC constexpr friend Vector2D operator* ( Arithmetic  s,
Vector2D< Type >  v 
)
friend

◆ operator<<

template<class Type >
template<class CharType >
std::basic_ostream<CharType>& operator<< ( std::basic_ostream< CharType > &  output,
const Vector2D< Type > &  value 
)
friend

◆ operator==

template<class Type >
constexpr friend bool operator== ( Vector2D< Type >  lhs,
Vector2D< Type >  rhs 
)
friend

◆ operator>>

template<class Type >
template<class CharType >
std::basic_istream<CharType>& operator>> ( std::basic_istream< CharType > &  input,
Vector2D< Type > &  value 
)
friend

Member Data Documentation

◆ Dimension

template<class Type >
constexpr size_t s3d::Vector2D< Type >::Dimension = 2
staticconstexpr

ベクトルの次元数

◆ x

template<class Type >
value_type s3d::Vector2D< Type >::x

ベクトルの X 成分

◆ y

template<class Type >
value_type s3d::Vector2D< Type >::y

ベクトルの Y 成分


The documentation for this struct was generated from the following files: