pub struct Arc {
pub center: Point,
pub radius: f64,
pub start: f64,
pub sweep: f64,
}Expand description
A circular arc: center + radius·(cos θ, sin θ) for θ = start + sweep·t, t ∈ [0, 1].
sweep > 0 is counter-clockwise. |sweep| ≤ 2π.
Fields§
§center: PointCenter.
radius: f64Radius (> 0).
start: f64Start angle in radians.
sweep: f64Signed sweep in radians.
Implementations§
Source§impl Arc
impl Arc
Sourcepub fn new(
center: Point,
radius: f64,
start: f64,
sweep: f64,
) -> GeoResult<Self>
pub fn new( center: Point, radius: f64, start: f64, sweep: f64, ) -> GeoResult<Self>
Create a validated arc.
Sourcepub fn from_three_points(a: Point, m: Point, b: Point) -> GeoResult<Self>
pub fn from_three_points(a: Point, m: Point, b: Point) -> GeoResult<Self>
Arc through three points a → m → b.
Sourcepub fn from_bulge(p0: Point, p1: Point, bulge: f64) -> GeoResult<Self>
pub fn from_bulge(p0: Point, p1: Point, bulge: f64) -> GeoResult<Self>
Arc between p0 and p1 with DXF-style bulge (tan(sweep/4), positive = CCW).
Sourcepub fn start_point(self) -> Point
pub fn start_point(self) -> Point
Start point.
Sourcepub fn tangent_at(self, t: f64) -> Vector
pub fn tangent_at(self, t: f64) -> Vector
Unit tangent at t in the direction of travel.
Sourcepub fn param_of_angle(self, a: f64, eps: f64) -> Option<f64>
pub fn param_of_angle(self, a: f64, eps: f64) -> Option<f64>
Parameter for absolute angle a if it lies on the arc (with eps radians slack).
Sourcepub fn distance_to_point(self, p: Point) -> f64
pub fn distance_to_point(self, p: Point) -> f64
Distance from p to the arc.
Sourcepub fn flatten_into(self, tol: f64, out: &mut Vec<Point>)
pub fn flatten_into(self, tol: f64, out: &mut Vec<Point>)
Append a polyline approximation (excluding the start point) to out.
Trait Implementations§
impl Copy for Arc
Source§impl<'de> Deserialize<'de> for Arc
impl<'de> Deserialize<'de> for Arc
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Arc
Auto Trait Implementations§
impl Freeze for Arc
impl RefUnwindSafe for Arc
impl Send for Arc
impl Sync for Arc
impl Unpin for Arc
impl UnsafeUnpin for Arc
impl UnwindSafe for Arc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more