Struct bbecs::data_types::point::Point [−][src]
Expand description
Point that stores a f32 x and y with methods for manipulating the point. Uses Vector math for the methods
Fields
x: f32
y: f32
Implementations
impl Point
[src]
impl Point
[src]pub fn new(x: f32, y: f32) -> Self
[src]
pub fn to_array(&self) -> [f32; 2]
[src]
pub fn to_array(&self) -> [f32; 2]
[src]Creates an array of the point with x being the first element, and y being the second. This is mostly useful for working with ggez points as they can cast from arrays.
use bbecs::data_types::point::Point; let location = Point::new(15.0, 7.0); assert_eq!(location.to_array(), [15.0, 7.0]);
pub fn add(&mut self, other: &Point)
[src]
pub fn add(&mut self, other: &Point)
[src]Adds another point to the one being called, mutating itself
use bbecs::data_types::point::Point; let mut location = Point::new(0.0, 0.0); let velocity = Point::new(1.0, 2.0); location.add(&velocity); assert_eq!(location, Point::new(1.0, 2.0));
pub fn to_perpendicular_left(&self) -> Self
[src]
pub fn to_perpendicular_left(&self) -> Self
[src]Create a new Point that is perpendicular to the self pointing towards the left
use bbecs::data_types::point::Point; let velocity = Point::new(10.0, 25.0); let left_velocity = velocity.to_perpendicular_left(); assert_eq!(left_velocity, Point::new(25.0, -10.0));
pub fn to_perpendicular_right(&self) -> Self
[src]
pub fn to_perpendicular_right(&self) -> Self
[src]Create a new Point that is perpendicular to the self pointing towards the right
use bbecs::data_types::point::Point; let velocity = Point::new(10.0, 25.0); let right_velocity = velocity.to_perpendicular_right(); assert_eq!(right_velocity, Point::new(-25.0, 10.0));
pub fn multiply_scalar(&mut self, scalar: f32)
[src]
pub fn multiply_scalar(&mut self, scalar: f32)
[src]Multiplies the x and y by a scalar (single f32) and mutates itself
use bbecs::data_types::point::Point; let mut point = Point::new(1.0, 2.0); point.multiply_scalar(10.0); assert_eq!(point, Point::new(10.0, 20.0));
pub fn distance_to(&self, other: &Self) -> f32
[src]
pub fn rotation(&self) -> f32
[src]
pub fn clamp(&mut self, max: f32, min: f32)
[src]
Trait Implementations
impl AddAssign<Point> for Point
[src]
impl AddAssign<Point> for Point
[src]fn add_assign(&mut self, rhs: Self)
[src]
fn add_assign(&mut self, rhs: Self)
[src]Performs the +=
operation. Read more
impl CastComponents<Point> for ComponentData
[src]
impl CastComponents<Point> for ComponentData
[src]impl ResourceCast<Point> for Resource
[src]
impl ResourceCast<Point> for Resource
[src]impl WorldMethods<Point> for World
[src]
impl WorldMethods<Point> for World
[src]fn with_component(&mut self, name: &str, data: Point) -> Result<&mut Self>
[src]
fn add_resource(&mut self, name: String, data: Point)
[src]
impl Copy for Point
[src]
impl StructuralPartialEq for Point
[src]
Auto Trait Implementations
impl RefUnwindSafe for Point
impl Send for Point
impl Sync for Point
impl Unpin for Point
impl UnwindSafe for Point
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<T> Same<T> for T
impl<T> Same<T> for T
type Output = T
type Output = T
Should always be Self
impl<T> SetParameter for T
impl<T> SetParameter for T
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
T: Parameter<Self>,
Sets value
as a parameter of self
.
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SP where
SS: SubsetOf<SP>,
pub fn to_subset(&self) -> Option<SS>
pub fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct self
from the equivalent element of its
superset. Read more
pub fn is_in_subset(&self) -> bool
pub fn is_in_subset(&self) -> bool
Checks if self
is actually part of its subset T
(and can be converted to it).
pub unsafe fn to_subset_unchecked(&self) -> SS
pub unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
pub fn from_subset(element: &SS) -> SP
pub fn from_subset(element: &SS) -> SP
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
[src]type Owned = T
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn to_owned(&self) -> T
[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)
[src]
pub fn clone_into(&self, target: &mut T)
[src]🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,