Struct cognitive_qualia::defs::Position
[−]
[src]
#[repr(C)]pub struct Position { pub x: isize, pub y: isize, }
Type defining position, point coordinates or 2D vector.
Fields
x: isize
y: isize
Methods
impl Position
[src]
fn new(x: isize, y: isize) -> Self
Position
constructor.
fn is_zero(&self) -> bool
Check if Position
points at (0,0).
fn is_inside(&self, area: &Area) -> bool
Check if position is inside given area.
fn scaled(&self, scale: f32) -> Self
Return new position scaled by given factor.
fn opposite(&self) -> Self
Returns opposite position (with negated coordinates).
fn casted(&self, area: &Area) -> Self
Return new position casted into given area.
- if self
if inside area - return copy of self
- if self
if outside area - return closes point inside area
Trait Implementations
impl Clone for Position
[src]
fn clone(&self) -> Position
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for Position
[src]
impl Debug for Position
[src]
impl Eq for Position
[src]
impl PartialEq for Position
[src]
fn eq(&self, __arg_0: &Position) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Position) -> bool
This method tests for !=
.
impl Default for Position
[src]
impl Add for Position
[src]
type Output = Position
The resulting type after applying the +
operator
fn add(self, other: Position) -> Position
The method for the +
operator