Struct Point2D Copy item path Source pub struct Point2D {
pub x: f64 ,
pub y: f64 ,
}Expand description 计算两个点之间的欧几里德距离。
§ 返回值
两点之间的欧几里德距离。
use rs_math::graphical::point_2d::Point2D;
let point1 = Point2D { x: 1.0 , y: 2.0 };
let point2 = Point2D { x: 4.0 , y: 6.0 };
let distance = point1.distance_between_points(point2);
绕原点逆时针旋转点。
§ 返回值
旋转后的点的坐标。
use rs_math::graphical::point_2d::Point2D;
let point = Point2D { x: 3.0 , y: 4.0 };
let rotated_point = point.rotate(std::f64::consts::FRAC_PI_2);
计算点到另一点的欧几里德距离。
§ 返回值
两点之间的欧几里德距离。
use rs_math::graphical::point_2d::Point2D;
let point1 = Point2D { x: 1.0 , y: 2.0 };
let point2 = Point2D { x: 4.0 , y: 6.0 };
let distance = point1.distance_to(& point2);
将两个点的坐标相加,得到新的点。
p1: 第一个点的坐标。
p2: 第二个点的坐标。
§ 返回值
两点坐标相加后得到的新点。
use rs_math::graphical::point_2d::Point2D;
let point1 = Point2D { x: 1.0 , y: 2.0 };
let point2 = Point2D { x: 3.0 , y: 4.0 };
let result = Point2D::add_points(& point1, & point2);
Performs copy-assignment from
source.
Read more Formats the value using the given formatter.
Read more Tests for self and other values to be equal, and is used by ==.
Tests for !=. The default implementation is almost always sufficient,
and should not be overridden without very good reason.
Immutably borrows from an owned value.
Read more Mutably borrows from an owned value.
Read more 🔬 This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from
self to
dest.
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.