pub struct Triangle { /* private fields */ }Implementations§
Source§impl Triangle
impl Triangle
Sourcepub fn validate_normals(&mut self)
pub fn validate_normals(&mut self)
Validates and flips(where needed) normals
Sourcepub fn update_vert(&mut self, i: usize, nv: Vec2)
pub fn update_vert(&mut self, i: usize, nv: Vec2)
Updates a single vert(and the 2 needed normals as well :D)
WARNING: Does not validate normals
Also i needs to satisfy i <= 2 && i >= 0 (the second is satisfied due to i being a usize tho)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Triangle
impl<'de> Deserialize<'de> for Triangle
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl SAT for Triangle
impl SAT for Triangle
Source§fn get_normals(
&self,
trans: &Transform2D,
) -> Box<dyn Iterator<Item = Vec2> + '_>
fn get_normals( &self, trans: &Transform2D, ) -> Box<dyn Iterator<Item = Vec2> + '_>
Gets the normals to use in the SAT algorithm(should simply be the normals of the edges) Read more
Source§fn project(&self, trans: &Transform2D, normal: Vec2) -> (f32, f32)
fn project(&self, trans: &Transform2D, normal: Vec2) -> (f32, f32)
Gets the projection of the shape on the given normal Read more
Source§fn get_closest_vertex(&self, trans: &Transform2D, vertex: Vec2) -> Vec2
fn get_closest_vertex(&self, trans: &Transform2D, vertex: Vec2) -> Vec2
Gets the closest vertex to the given point, used for SAT vs Special shapes(Circle and Capsule)
Source§fn ray(
&self,
trans: &Transform2D,
ray_origin: Vec2,
ray_cast: Vec2,
) -> Option<f32>
fn ray( &self, trans: &Transform2D, ray_origin: Vec2, ray_cast: Vec2, ) -> Option<f32>
Gets the collision with a ray Read more
Source§fn aabb(&self, trans: &Transform2D) -> Aabb
fn aabb(&self, trans: &Transform2D) -> Aabb
Gets the Axis Aligned Bounding Box of the shape
Auto Trait Implementations§
impl Freeze for Triangle
impl RefUnwindSafe for Triangle
impl Send for Triangle
impl Sync for Triangle
impl Unpin for Triangle
impl UnwindSafe for Triangle
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(
&self,
_images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset>,
) -> U
fn as_bind_group_shader_type( &self, _images: &HashMap<Handle<Image>, <Image as RenderAsset>::PreparedAsset>, ) -> U
Return the
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.