pub struct Arc<T> {
pub s: V<T>,
pub e: V<T>,
pub half: T,
}Expand description
A circular arc from s to e, turning counter-clockwise by 2 * half
(clockwise if negative).
Fields§
§s: V<T>§e: V<T>§half: TImplementations§
Source§impl<T: Scalar> Arc<T>
impl<T: Scalar> Arc<T>
pub fn chord(&self) -> V<T>
pub fn chord_length(&self) -> GeopResult<T>
pub fn chord_mid(&self) -> V<T>
Sourcepub fn left(&self) -> GeopResult<V<T>>
pub fn left(&self) -> GeopResult<V<T>>
Unit normal to the chord, pointing to its left: the side the center is on for a counter-clockwise minor arc.
pub fn curvature(&self) -> GeopResult<T>
Sourcepub fn radius(&self) -> GeopResult<T>
pub fn radius(&self) -> GeopResult<T>
|radius|. Infinite for a straight arc.
Sourcepub fn center(&self) -> GeopResult<V<T>>
pub fn center(&self) -> GeopResult<V<T>>
Center: chord_mid + left * (L / 2) cot(half). Infinitely far for a
straight arc, so only for constraints that are meaningless there
anyway (concentricity, tangency to a circle).
Sourcepub fn arc_mid(&self) -> GeopResult<V<T>>
pub fn arc_mid(&self) -> GeopResult<V<T>>
The point halfway along the arc: chord_mid - left * (L / 2) tan(half / 2).
Sourcepub fn circle_residual(&self, p: V<T>) -> GeopResult<T>
pub fn circle_residual(&self, p: V<T>) -> GeopResult<T>
Signed distance-like residual of p against the arc’s full circle,
finite and smooth for every half including a straight arc.
With q = p - chord_mid, the circle is |q|^2 - 2 d (left . q) - L^2/4 = 0 for d the center’s offset along left. Multiplying by the
curvature k (and using k d = cos(half)) gives
G = k |q|^2 - 2 cos(half) (left . q) - k L^2 / 4, which is a line’s
equation at k = 0. Near the circle G ≈ ±2 dist, so G / 2 is a
distance.
Sourcepub fn tangent_start(&self) -> GeopResult<V<T>>
pub fn tangent_start(&self) -> GeopResult<V<T>>
Unit tangent at s, in the direction of travel.
Sourcepub fn tangent_end(&self) -> GeopResult<V<T>>
pub fn tangent_end(&self) -> GeopResult<V<T>>
Unit tangent at e, in the direction of travel.
Sourcepub fn length(&self) -> GeopResult<T>
pub fn length(&self) -> GeopResult<T>
Arc length L * half / sin(half).