pub struct Vec2<T>(pub T, pub T);
Expand description
2点間のユークリッド距離を求める
\|\boldsymbol{a} - \boldsymbol{b}\| = \sqrt{(a_x - b_x)^2 + (a_y - b_y)^2}
ノルムを求める
\|\boldsymbol{a}\| = \sqrt{a_x^2 + a_y^2}
法線ベクトル
(90度回転させたベクトル)
を求める
原点周りに $\theta
$ 回転させた点を求める
2つのベクトルのドット積を求める
\boldsymbol{a}\cdot\boldsymbol{b} = a_x b_x + a_y b_y
ノルムの2乗を求める
\|\boldsymbol{a}\|^2 = a_x^2 + a_y^2
ベクトル同士の距離の2乗を求める
\|\boldsymbol{a} - \boldsymbol{b}\|^2 = (a_x - b_x)^2 + (a_y - b_y)^2
クロス積を求める
\boldsymbol{a} \times \boldsymbol{b} = a_x b_y - a_y b_x
The resulting type after applying the +
operator.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
The resulting type after applying the /
operator.
The resulting type after applying the *
operator.
The resulting type after applying the -
operator.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
The resulting type after applying the -
operator.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.