equal
deleted
inserted
replaced
86 pub fn ray_with_dir(self, direction: Point) -> Ray { |
86 pub fn ray_with_dir(self, direction: Point) -> Ray { |
87 Ray::new(self, direction) |
87 Ray::new(self, direction) |
88 } |
88 } |
89 |
89 |
90 #[inline] |
90 #[inline] |
91 pub fn tangent(self) -> i32 { |
91 pub fn tangent_mul(self, x: i32) -> i32 { |
92 self.y / self.x |
92 x * self.y / self.x |
93 } |
93 } |
94 |
94 |
95 #[inline] |
95 #[inline] |
96 pub fn cotangent(self) -> i32 { |
96 pub fn cotangent_mul(self, y: i32) -> i32 { |
97 self.x / self.y |
97 y * self.x / self.y |
98 } |
98 } |
99 |
99 |
100 #[inline] |
100 #[inline] |
101 pub fn to_fppoint(&self) -> FPPoint { |
101 pub fn to_fppoint(&self) -> FPPoint { |
102 FPPoint::new(self.x.into(), self.y.into()) |
102 FPPoint::new(self.x.into(), self.y.into()) |
593 pub fn new(start: Point, direction: Point) -> Ray { |
593 pub fn new(start: Point, direction: Point) -> Ray { |
594 Self { start, direction } |
594 Self { start, direction } |
595 } |
595 } |
596 |
596 |
597 #[inline] |
597 #[inline] |
598 pub fn tangent(&self) -> i32 { |
598 pub fn tangent_mul(&self, x: i32) -> i32 { |
599 self.direction.tangent() |
599 self.direction.tangent_mul(x) |
600 } |
600 } |
601 |
601 |
602 #[inline] |
602 #[inline] |
603 pub fn cotangent(&self) -> i32 { |
603 pub fn cotangent_mul(&self, y: i32) -> i32 { |
604 self.direction.cotangent() |
604 self.direction.cotangent_mul(y) |
605 } |
605 } |
606 |
606 |
607 #[inline] |
607 #[inline] |
608 pub fn orientation(&self, point: Point) -> i32 { |
608 pub fn orientation(&self, point: Point) -> i32 { |
609 (point - self.start).cross(self.direction).signum() |
609 (point - self.start).cross(self.direction).signum() |