Skip to main content

Path64

Struct Path64 

Source
pub struct Path64(/* private fields */);
Expand description

Integer grid polyline / polygon ring (Path64), backed by Vec<Point64>.

整数坐标折线或闭合轮廓(Path64),内部为 Vec<Point64>

§Geometry helpers / 几何辅组

Clipper-related methods (simplify, area, …) are on the same Path64 type in clipper64/mod.rs (re-exported at the crate root).

与 Clipper 相关的方法(simplifyarea 等)在同一 Path64 上于 clipper64/mod.rs 中实现(并在 crate 根再导出)。

Implementations§

Source§

impl Path64

Source

pub fn from_vec(points: Vec<Point64>) -> Self

From owned Vec of points. / 由点向量构造。

Source

pub fn new(points: impl Into<Vec<Point64>>) -> Self

From anything that becomes Vec (e.g. vec![…]). / 由 Into<Vec> 构造。

Source

pub fn as_slice(&self) -> &[Point64]

Source

pub fn as_mut_slice(&mut self) -> &mut [Point64]

Source

pub fn iter(&self) -> Iter<'_, Point64>

Source

pub fn iter_mut(&mut self) -> IterMut<'_, Point64>

Source

pub fn is_empty(&self) -> bool

Source

pub fn len(&self) -> usize

Source

pub fn get_point(&self, index: usize) -> Point64

Copy of vertex index. / 拷贝下标 index 的顶点。

Source

pub fn add_point(&mut self, point: Point64)

Source

pub fn translate(&self, dx: i64, dy: i64) -> Self

Translate by integer deltas. / 整数平移。

Source

pub fn scale(&self, sx: f64, sy: f64) -> Self

Scale coordinates (sx/sy0 treated as 1). / 缩放(0 视为 1)。

Source§

impl Path64

Source

pub fn simplify(&self, epsilon: f64, is_open_path: bool) -> LazyPaths64

Simplifies the path (RDP-style via Clipper). is_open_path marks open polylines.

简化路径(Clipper 实现)。is_open_path 表示开放折线。

Source

pub fn point_in_polygon(&self, point: Point64) -> PointInPolygonResult

Tests where point lies relative to this path. / 判断 point 与路径的位置关系。

Source

pub fn to_pathd(&self) -> LazyPathsD

Converts to double paths (LazyPathsD) for ClipperD workflows.

转为双精度路径,便于走 ClipperD 流程。

Source§

impl Path64

Source

pub fn minkowski_sum(&self, pattern: &Path64, is_closed: bool) -> LazyPaths64

Minkowski sum with pattern; is_closed toggles closed semantics.

pattern 的闵可夫斯基和。

Source

pub fn minkowski_diff(&self, pattern: &Path64, is_closed: bool) -> LazyPaths64

Minkowski difference. / 闵可夫斯基差。

Source§

impl Path64

Source

pub fn area(&self) -> f64

Signed area of a closed path. / 闭合路径的有向面积。

Trait Implementations§

Source§

impl Clone for Path64

Source§

fn clone(&self) -> Path64

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Path64

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Path64

Source§

fn default() -> Path64

Returns the “default value” for a type. Read more
Source§

impl FromIterator<Path64> for Paths64

Source§

fn from_iter<T: IntoIterator<Item = Path64>>(iter: T) -> Self

Collect iterator of paths. / 从迭代器收集。

Source§

impl<'a> IntoIterator for &'a Path64

Source§

type Item = &'a P64

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, P64>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl IntoIterator for Path64

Source§

type Item = P64

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<P64>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.