Type Alias Point

Source
pub type Point = Vec2<f64>;
Expand description

点(2次元平面)

Aliased Type§

pub struct Point(pub f64, pub f64);

Tuple Fields§

§0: f64§1: f64

Implementations§

Source§

impl Point

Source

pub fn dist(&self, other: Self) -> f64

2点間のユークリッド距離を求める

\|\boldsymbol{a} - \boldsymbol{b}\| = \sqrt{(a_x - b_x)^2 + (a_y - b_y)^2}
Source

pub fn norm(&self) -> f64

ノルムを求める

\|\boldsymbol{a}\| = \sqrt{a_x^2 + a_y^2}
Source

pub fn unit(&self) -> Self

同じ向きの単位ベクトルを求める

Source

pub fn normal(&self) -> Self

法線ベクトル (90度回転させたベクトル) を求める

Source

pub fn rotate_o(&self, theta: f64) -> Self

原点周りに $\theta$ 回転させた点を求める

Trait Implementations§

Source§

impl From<(f64, f64)> for Point

Source§

fn from(value: (f64, f64)) -> Self

Converts to this type from the input type.