pub struct Radius {
pub x: f64,
pub y: f64,
}Expand description
A radius for either circular or elliptical shapes.
Fields§
§x: f64The radius value on the horizontal axis.
y: f64The radius value on the vertical axis.
Implementations§
Source§impl Radius
impl Radius
Sourcepub const ZERO: Radius
pub const ZERO: Radius
A radius with x and y values set to zero.
You can use Radius::ZERO with RRect or RSuperellipse to have
right-angle corners.
Sourcepub const fn elliptical(x: f64, y: f64) -> Radius
pub const fn elliptical(x: f64, y: f64) -> Radius
Constructs an elliptical radius with the given radii.
Sourcepub fn clamp_values(
&self,
minimum_x: Option<f64>,
minimum_y: Option<f64>,
maximum_x: Option<f64>,
maximum_y: Option<f64>,
) -> Radius
pub fn clamp_values( &self, minimum_x: Option<f64>, minimum_y: Option<f64>, maximum_x: Option<f64>, maximum_y: Option<f64>, ) -> Radius
Returns this Radius, with values clamped to the given min and max
values in each dimension.
The minimum_x and minimum_y values default to f64::NEG_INFINITY,
and the maximum_x and maximum_y values default to f64::INFINITY.
Sourcepub fn truncating_div(&self, operand: f64) -> Radius
pub fn truncating_div(&self, operand: f64) -> Radius
Integer (truncating) division operator.
Returns a radius whose coordinates are the coordinates of this radius
divided by the scalar operand, rounded towards zero.
Sourcepub fn lerp(a: Option<Radius>, b: Option<Radius>, t: f64) -> Option<Radius>
pub fn lerp(a: Option<Radius>, b: Option<Radius>, t: f64) -> Option<Radius>
Linearly interpolate between two radii.
If either is null, this function substitutes Radius::ZERO instead.
The t argument represents position on the timeline, with 0.0 meaning
that the interpolation has not started, returning a (or something
equivalent to a), 1.0 meaning that the interpolation has finished,
returning b (or something equivalent to b), and values in between
meaning that the interpolation is at the relevant point on the timeline
between a and b. The interpolation can be extrapolated beyond 0.0 and
1.0, so negative values and values greater than 1.0 are valid (and can
easily be generated by curves such as Curves.elasticInOut).
Values for t are usually obtained from an Animation<double>, such as
an AnimationController.
Trait Implementations§
Source§impl Add for Radius
Binary addition operator.
impl Add for Radius
Binary addition operator.
impl Copy for Radius
Source§impl Div<f64> for Radius
Division operator.
impl Div<f64> for Radius
Division operator.
Returns a radius whose coordinates are the coordinates of the left-hand-side
operand (a radius) divided by the scalar right-hand-side operand (an f64).
Source§impl Mul<f64> for Radius
Multiplication operator.
impl Mul<f64> for Radius
Multiplication operator.
Returns a radius whose coordinates are the coordinates of the left-hand-side
operand (a radius) multiplied by the scalar right-hand-side operand (an
f64).
Source§impl Neg for Radius
Unary negation operator.
impl Neg for Radius
Unary negation operator.
Returns a Radius with the distances negated.
Radiuses with negative values aren’t geometrically meaningful, but could occur as part of expressions. For example, negating a radius of one pixel and then adding the result to another radius is equivalent to subtracting a radius of one pixel from the other.
Source§impl Rem<f64> for Radius
Modulo (remainder) operator.
impl Rem<f64> for Radius
Modulo (remainder) operator.
Returns a radius whose coordinates are the remainder of dividing the
coordinates of the left-hand-side operand (a radius) by the scalar
right-hand-side operand (an f64).