Struct RotatableExtent
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§
§impl Clone for RotatableExtent
impl Clone for RotatableExtent
§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 more§impl Debug for RotatableExtent
impl Debug for RotatableExtent
§impl<D> Decode<RotatableExtent, D> for RotatableExtentwhere
D: ResourceDialect,
impl<D> Decode<RotatableExtent, D> for RotatableExtentwhere
D: ResourceDialect,
§fn new_empty() -> RotatableExtent
fn new_empty() -> RotatableExtent
Self
. The specific value does not matter,
since it will be overwritten by decode
.§impl<D> Encode<RotatableExtent, D> for &RotatableExtentwhere
D: ResourceDialect,
impl<D> Encode<RotatableExtent, D> for &RotatableExtentwhere
D: ResourceDialect,
§impl PartialEq for RotatableExtent
impl PartialEq for RotatableExtent
§impl TypeMarker for RotatableExtent
impl TypeMarker for RotatableExtent
§type Owned = RotatableExtent
type Owned = RotatableExtent
§fn inline_align(_context: Context) -> usize
fn inline_align(_context: Context) -> usize
§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.§impl ValueTypeMarker for RotatableExtent
impl ValueTypeMarker for RotatableExtent
§type Borrowed<'a> = &'a RotatableExtent
type Borrowed<'a> = &'a RotatableExtent
Encode<Self>
type cheaply obtainable from &Self::Owned
. There are three cases: Read more§fn borrow(
value: &<RotatableExtent as TypeMarker>::Owned,
) -> <RotatableExtent as ValueTypeMarker>::Borrowed<'_>
fn borrow( value: &<RotatableExtent as TypeMarker>::Owned, ) -> <RotatableExtent as ValueTypeMarker>::Borrowed<'_>
&Self::Owned
to Self::Borrowed
.