Type Definition cp_library_rs::geometry::basic::Point

source ·
pub type Point = Vec2<f64>;
Expand description

点(2次元平面)

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.
source§

impl PartialEq<Vec2<f64>> for Point

source§

fn eq(&self, other: &Self) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.