Skip to main content

Shape

Struct Shape 

Source
pub struct Shape {
Show 22 fields pub id: i32, pub body_id: i32, pub prev_shape_id: i32, pub next_shape_id: i32, pub sensor_index: i32, pub material: SurfaceMaterial, pub density: f32, pub aabb_margin: f32, pub aabb: Aabb, pub fat_aabb: Aabb, pub local_centroid: Vec2, pub proxy_key: i32, pub filter: Filter, pub user_data: u64, pub geometry: ShapeGeometry, pub generation: u16, pub enable_sensor_events: bool, pub enable_contact_events: bool, pub enable_custom_filtering: bool, pub enable_hit_events: bool, pub enable_pre_solve_events: bool, pub enlarged_aabb: bool,
}
Expand description

Internal shape. (b2Shape)

The C struct stores a b2ShapeType type tag plus a union of the concrete geometries; the Rust port stores the tagged ShapeGeometry enum, and Shape::shape_type recovers the tag.

Fields§

§id: i32§body_id: i32§prev_shape_id: i32§next_shape_id: i32§sensor_index: i32§material: SurfaceMaterial§density: f32§aabb_margin: f32§aabb: Aabb§fat_aabb: Aabb§local_centroid: Vec2§proxy_key: i32§filter: Filter§user_data: u64§geometry: ShapeGeometry

The shape geometry (C: type tag + union).

§generation: u16§enable_sensor_events: bool§enable_contact_events: bool§enable_custom_filtering: bool§enable_hit_events: bool§enable_pre_solve_events: bool§enlarged_aabb: bool

Implementations§

Source§

impl Shape

Source

pub fn shape_type(&self) -> ShapeType

The shape type tag. (C: shape->type)

Source

pub fn radius(&self) -> f32

(static inline b2GetShapeRadius)

Trait Implementations§

Source§

impl Clone for Shape

Source§

fn clone(&self) -> Shape

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Shape

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Shape

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Shape

§

impl RefUnwindSafe for Shape

§

impl Send for Shape

§

impl Sync for Shape

§

impl Unpin for Shape

§

impl UnsafeUnpin for Shape

§

impl UnwindSafe for Shape

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.