123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- use crate::Point;
- use std::ops::{Sub, SubAssign};
- use num::Integer;
- /*
- P - T
- P - (T, T)
- P - P
- P - &P
- P - &mP
- &P - T
- &P - (T, T)
- &P - P
- &P - &P
- &P - &mP
- &mP - T
- &mP - (T, T)
- &mP - P
- &mP - &P
- &mP - &mP
- P -= T
- P -= (T, T)
- P -= P
- P -= &P
- P -= &mP
- */
- impl<T: Integer + Copy> Sub<T> for Point<T> {
- type Output = Self;
- fn sub(self, rhs: T) -> Self::Output {
- Self::from((self.x-rhs, self.y-rhs))
- }
- }
- impl<T: Integer> Sub<(T, T)> for Point<T> {
- type Output = Self;
- fn sub(self, rhs: (T, T)) -> Self::Output {
- Self::from((self.x-rhs.0, self.y-rhs.1))
- }
- }
- impl<T: Integer> Sub<Point<T>> for Point<T> {
- type Output = Self;
- fn sub(self, rhs: Point<T>) -> Self::Output {
- Self::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&Point<T>> for Point<T> {
- type Output = Self;
- fn sub(self, rhs: &Point<T>) -> Self::Output {
- Self::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&mut Point<T>> for Point<T> {
- type Output = Self;
- fn sub(self, rhs: &mut Point<T>) -> Self::Output {
- Self::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<T> for &Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: T) -> Self::Output {
- Point::from((self.x-rhs, self.y-rhs))
- }
- }
- impl<T: Integer + Copy> Sub<(T, T)> for &Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: (T, T)) -> Self::Output {
- Point::from((self.x-rhs.0, self.y-rhs.1))
- }
- }
- impl<T: Integer + Copy> Sub<Point<T>> for &Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&Point<T>> for &Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: &Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&mut Point<T>> for &Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: &mut Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<T> for &mut Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: T) -> Self::Output {
- Point::from((self.x-rhs, self.y-rhs))
- }
- }
- impl<T: Integer + Copy> Sub<(T, T)> for &mut Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: (T, T)) -> Self::Output {
- Point::from((self.x-rhs.0, self.y-rhs.1))
- }
- }
- impl<T: Integer + Copy> Sub<Point<T>> for &mut Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&Point<T>> for &mut Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: &Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + Copy> Sub<&mut Point<T>> for &mut Point<T> {
- type Output = Point<T>;
- fn sub(self, rhs: &mut Point<T>) -> Self::Output {
- Point::from((self.x-rhs.x, self.y-rhs.y))
- }
- }
- impl<T: Integer + SubAssign + Copy> SubAssign<T> for Point<T> {
- fn sub_assign(&mut self, rhs: T) {
- self.x -= rhs;
- self.y -= rhs;
- }
- }
- impl<T: Integer + SubAssign> SubAssign<(T, T)> for Point<T> {
- fn sub_assign(&mut self, rhs: (T, T)) {
- self.x -= rhs.0;
- self.y -= rhs.1;
- }
- }
- impl<T: Integer + SubAssign + Copy> SubAssign<Point<T>> for Point<T> {
- fn sub_assign(&mut self, rhs: Point<T>) {
- self.x -= rhs.x;
- self.y -= rhs.y;
- }
- }
- impl<T: Integer + SubAssign + Copy> SubAssign<&Point<T>> for Point<T> {
- fn sub_assign(&mut self, rhs: &Point<T>) {
- self.x -= rhs.x;
- self.y -= rhs.y;
- }
- }
- impl<T: Integer + SubAssign + Copy> SubAssign<&mut Point<T>> for Point<T> {
- fn sub_assign(&mut self, rhs: &mut Point<T>) {
- self.x -= rhs.x;
- self.y -= rhs.y;
- }
- }
|