Struct cp_library_rs::geometry::basic::Segment
source · pub struct Segment(pub Point, pub Point);
Expand description
線分(2次元平面)
Tuple Fields§
§0: Point
§1: Point
Implementations§
source§impl Segment
impl Segment
sourcepub fn has_intersection(&self, other: &Self) -> bool
pub fn has_intersection(&self, other: &Self) -> bool
2つの線分が衝突しているかどうかを判定する
sourcepub fn cross_point(&self, other: &Self) -> Option<Point>
pub fn cross_point(&self, other: &Self) -> Option<Point>
2つの線分の交点を求める
戻り値
- 2つの線分が点
x
で交わるとき → Some(x
) - 2つの線分が交点を持たないとき → None
sourcepub fn dist_point(&self, p: Point) -> f64
pub fn dist_point(&self, p: Point) -> f64
点p
と線分の距離を求める
sourcepub fn dist_segment(&self, other: &Self) -> f64
pub fn dist_segment(&self, other: &Self) -> f64
線分同士の距離を求める