Struct Point_

Source
#[repr(C)]
pub struct Point_<T> { pub x: T, pub y: T, }
Expand description

Fields§

§x: T§y: T

Implementations§

Source§

impl<T> Point_<T>

Source

pub const fn new(x: T, y: T) -> Self

Source

pub fn from_vec2(vec: VecN<T, 2>) -> Self

Source

pub fn from_size(sz: Size_<T>) -> Self

Source

pub fn cross(self, pt: Point_<T>) -> f64
where f64: From<T>,

Source

pub fn dot(self, pt: Point_<T>) -> T
where T: NumOps,

Source

pub fn ddot(self, pt: Point_<T>) -> f64
where f64: From<T>,

Source

pub fn inside(self, rect: Rect_<T>) -> bool
where T: PartialOrd + Add<Output = T> + Copy,

Source

pub fn norm(self) -> f64
where f64: From<T>,

Source

pub fn to<D: NumCast>(self) -> Option<Point_<D>>
where T: ToPrimitive,

Cast Point to the other coord type

Source

pub fn to_vec2(self) -> VecN<T, 2>

Trait Implementations§

Source§

impl<P, R> Add<Point_<P>> for Rect_<R>
where Self: AddAssign<Point_<P>>,

Source§

type Output = Rect_<R>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Point_<P>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for Point_<T>
where Self: AddAssign,

Source§

type Output = Point_<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<P, R: AddAssign<P>> AddAssign<Point_<P>> for Rect_<R>

Source§

fn add_assign(&mut self, rhs: Point_<P>)

Performs the += operation. Read more
Source§

impl<T: AddAssign> AddAssign for Point_<T>

Source§

fn add_assign(&mut self, rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Point_<T>

Source§

fn clone(&self) -> Point_<T>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T: DataType> DataType for Point_<T>

Source§

fn opencv_depth() -> i32

The shape of bytes occupied by the single layer/channel of the element. E.g. for an 8-bit BGR image it’s CV_8U because a single channel for a pixel is unsigned 8 bits. You should use one of the depth constants for this like CV_8U, CV_8S, CV_32F, etc.
Source§

fn opencv_channels() -> i32

Amount of layers/channels per element. E.g. for an 8-bit BGR image it’s 3 because one pixel consists of 3 channels: B, G and R.
Source§

fn opencv_type() -> i32

OpenCV value for this type as produced by CV_MAKETYPE() function
Source§

impl<T: Debug> Debug for Point_<T>

Source§

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

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

impl<T: Default> Default for Point_<T>

Source§

fn default() -> Point_<T>

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

impl<T> Div<T> for Point_<T>
where Self: DivAssign<T>,

Source§

type Output = Point_<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T: DivAssign + Copy> DivAssign<T> for Point_<T>

Source§

fn div_assign(&mut self, rhs: T)

Performs the /= operation. Read more
Source§

impl<T> From<(T, T)> for Point_<T>

Source§

fn from(s: (T, T)) -> Self

Converts to this type from the input type.
Source§

impl<T: Zero> From<Point_<T>> for Point3_<T>

Source§

fn from(s: Point_<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Point_<T>> for Size_<T>

Source§

fn from(s: Point_<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<Size_<T>> for Point_<T>

Source§

fn from(s: Size_<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<VecN<T, 2>> for Point_<T>

Source§

fn from(s: VecN<T, 2>) -> Self

Converts to this type from the input type.
Source§

impl<T> Mul<T> for Point_<T>
where Self: MulAssign<T>,

Source§

type Output = Point_<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T: MulAssign + Copy> MulAssign<T> for Point_<T>

Source§

fn mul_assign(&mut self, rhs: T)

Performs the *= operation. Read more
Source§

impl<T: PartialEq> PartialEq for Point_<T>

Source§

fn eq(&self, other: &Point_<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T: PartialOrd> PartialOrd for Point_<T>

Source§

fn partial_cmp(&self, other: &Point_<T>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<P, R> Sub<Point_<P>> for Rect_<R>
where Self: SubAssign<Point_<P>>,

Source§

type Output = Rect_<R>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Point_<P>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for Point_<T>
where Self: SubAssign,

Source§

type Output = Point_<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<P, R: SubAssign<P>> SubAssign<Point_<P>> for Rect_<R>

Source§

fn sub_assign(&mut self, rhs: Point_<P>)

Performs the -= operation. Read more
Source§

impl<T: SubAssign> SubAssign for Point_<T>

Source§

fn sub_assign(&mut self, rhs: Self)

Performs the -= operation. Read more
Source§

impl<T: Copy> Copy for Point_<T>

Source§

impl<T: Eq> Eq for Point_<T>

Source§

impl<T> StructuralPartialEq for Point_<T>

Auto Trait Implementations§

§

impl<T> Freeze for Point_<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Point_<T>
where T: RefUnwindSafe,

§

impl<T> Send for Point_<T>
where T: Send,

§

impl<T> Sync for Point_<T>
where T: Sync,

§

impl<T> Unpin for Point_<T>
where T: Unpin,

§

impl<T> UnwindSafe for Point_<T>
where T: UnwindSafe,

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.