pub struct RotatableExtent {
pub origin: PointF,
pub width: f32,
pub height: f32,
pub angle_degrees: f32,
}
Expand description
A view bounding box, described in another view’s coordinate system. Concretely, |RotatableExtent| describes the origin, size, and rotation angle about the origin, for a view’s bounding box.
Note: For describing a view’s bounding box in the view’s own coordinate system, see |AlignedExtent|.
We use “V” to refer to the view being described, and “W” to refer to the view where V is being described.
Note that while |angle| can be arbitrary, typical usage is axis aligned. To find the bounding box of V in W in clockwise order, starting with |origin|, where |angle| is 0, 90, 180, or 270, and using o=origin, w=width, h=height, a=angle: a= 0: (o.x, o.y), (o.x + w, o.y), (o.x + w, o.y + h), (o.x, o.y + h) a= 90: (o.x, o.y), (o.x, o.y - w), (o.x + h, o.y - w), (o.x + h, o.y) a=180: (o.x, o.y), (o.x - w, o.y), (o.x - w, o.y - h), (o.x, o.y - h) a=270: (o.x, o.y), (o.x, o.y + w), (o.x - h, o.y + w), (o.x - h, o.y) A formula based on sin a and cos a is readily obtained, but floating point computation may give only approximate results.
Fields§
§origin: PointF
The origin point of V’s bounding box, in W’s coordinate system.
width: f32
The width of V’s bounding box (along the direction where V’s x axis increases), in W’s coordinate system.
height: f32
The height of V’s bounding box (along the direction where V’s y axis increases), in W’s coordinate system.
angle_degrees: f32
The clockwise rotation about the origin, in degrees.
Trait Implementations§
Source§impl Clone for RotatableExtent
impl Clone for RotatableExtent
Source§fn clone(&self) -> RotatableExtent
fn clone(&self) -> RotatableExtent
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for RotatableExtent
impl Debug for RotatableExtent
Source§impl<D: ResourceDialect> Decode<RotatableExtent, D> for RotatableExtent
impl<D: ResourceDialect> Decode<RotatableExtent, D> for RotatableExtent
Source§impl<D: ResourceDialect> Encode<RotatableExtent, D> for &RotatableExtent
impl<D: ResourceDialect> Encode<RotatableExtent, D> for &RotatableExtent
Source§impl<D: ResourceDialect, T0: Encode<PointF, D>, T1: Encode<f32, D>, T2: Encode<f32, D>, T3: Encode<f32, D>> Encode<RotatableExtent, D> for (T0, T1, T2, T3)
impl<D: ResourceDialect, T0: Encode<PointF, D>, T1: Encode<f32, D>, T2: Encode<f32, D>, T3: Encode<f32, D>> Encode<RotatableExtent, D> for (T0, T1, T2, T3)
Source§impl PartialEq for RotatableExtent
impl PartialEq for RotatableExtent
Source§impl TypeMarker for RotatableExtent
impl TypeMarker for RotatableExtent
Source§type Owned = RotatableExtent
type Owned = RotatableExtent
Source§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
Source§fn inline_size(_context: Context) -> usize
fn inline_size(_context: Context) -> usize
inline_align
.§fn encode_is_copy() -> bool
fn encode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and encoding requires no validation. When true, we can optimize
encoding arrays and vectors of Self::Owned
to a single memcpy. Read more§fn decode_is_copy() -> bool
fn decode_is_copy() -> bool
Self::Owned
matches the FIDL wire
format and decoding requires no validation. When true, we can optimize
decoding arrays and vectors of Self::Owned
to a single memcpy.Source§impl ValueTypeMarker for RotatableExtent
impl ValueTypeMarker for RotatableExtent
Source§type Borrowed<'a> = &'a RotatableExtent
type Borrowed<'a> = &'a RotatableExtent
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more