pub struct Catenary<T: DualNum<f64>> {
pub a: T,
pub c: T,
pub h: T,
pub s_0: T,
pub s_1: T,
}Expand description
Represents a Catenary curve.
The Catenary curve is defined by the equation: y(x) = a * cosh((x - c) / a) - a + h
where:
ais the parameter that controls the shape of the curve.cis the horizontal shift of the curve.his the vertical shift of the curve.s_0ands_1are linear abscissa of end points (negative on the left of minimum, positive on the right).
Fields§
§a: TThe parameter that controls the shape of the curve.
c: TThe horizontal shift of the curve.
h: TThe vertical shift of the curve.
s_0: TThe linear abscissa of the left endpoint (from min).
s_1: TThe linear abscissa of the right endpoint (from min).
Implementations§
Source§impl<T: DualNum<f64>> Catenary<T>
impl<T: DualNum<f64>> Catenary<T>
Sourcepub fn new(a: T, c: T, h: T, s_0: T, s_1: T) -> Self
pub fn new(a: T, c: T, h: T, s_0: T, s_1: T) -> Self
Creates a new instance of the Catenary structure.
§Arguments
a- The parameter that controls the shape of the curve.c- The horizontal shift of the curve.h- The vertical shift of the curve.s_0- The linear abscissa of the left endpoint (from min).s_1- The linear abscissa of the right endpoint (from min).
Sourcepub fn y_from_abscissa(&self, s: &T) -> T
pub fn y_from_abscissa(&self, s: &T) -> T
Sourcepub fn x_from_abscissa(&self, s: &T) -> T
pub fn x_from_abscissa(&self, s: &T) -> T
Sourcepub fn end_points(&self) -> (Point2<T>, Point2<T>)
pub fn end_points(&self) -> (Point2<T>, Point2<T>)
Returns the end points of the catenary curve.
§Returns
A tuple containing the start and end points of the catenary curve.
Source§impl Catenary<f64>
impl Catenary<f64>
Sourcepub fn from_points_length_init(
p0: &Point2<f64>,
p1: &Point2<f64>,
length: f64,
cat0: &Self,
) -> Option<Self>
pub fn from_points_length_init( p0: &Point2<f64>, p1: &Point2<f64>, length: f64, cat0: &Self, ) -> Option<Self>
Creates a catenary curve from two points and a specified length, and an initial guess
§Arguments
p0- The start point of the catenary curve.p1- The end point of the catenary curve.length- The desired length of the catenary curve.cat0- The initial catenary curve to use as a starting point.
§Returns
An Option containing the catenary curve if it could be created, or None otherwise.
Sourcepub fn from_points_length(
p0: &Point2<f64>,
p1: &Point2<f64>,
length: f64,
) -> Option<Self>
pub fn from_points_length( p0: &Point2<f64>, p1: &Point2<f64>, length: f64, ) -> Option<Self>
Creates a catenary curve from two points and a specified length.
(same as from_points_length_init but without the initial guess)
§Arguments
p0- The start point of the catenary curve.p1- The end point of the catenary curve.length- The desired length of the catenary curve.
§Returns
An Option containing the catenary curve if it could be created, or None otherwise.
Trait Implementations§
Source§impl<'de, T> Deserialize<'de> for Catenary<T>
impl<'de, T> Deserialize<'de> for Catenary<T>
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>,
impl<T: Copy + DualNum<f64>> Copy for Catenary<T>
impl<T: DualNum<f64>> StructuralPartialEq for Catenary<T>
Auto Trait Implementations§
impl<T> Freeze for Catenary<T>where
T: Freeze,
impl<T> RefUnwindSafe for Catenary<T>where
T: RefUnwindSafe,
impl<T> Send for Catenary<T>where
T: Send,
impl<T> Sync for Catenary<T>where
T: Sync,
impl<T> Unpin for Catenary<T>where
T: Unpin,
impl<T> UnwindSafe for Catenary<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.