(rect Rect, p Point, eps float64)
| 885 | //////////////////////////////////////////////////////////////// |
| 886 | |
| 887 | func cohenSutherlandOutcode(rect Rect, p Point, eps float64) int { |
| 888 | code := 0b0000 |
| 889 | if p.X < rect.X0-eps { |
| 890 | code |= 0b0001 // left |
| 891 | } else if rect.X1+eps < p.X { |
| 892 | code |= 0b0010 // right |
| 893 | } |
| 894 | if p.Y < rect.Y0-eps { |
| 895 | code |= 0b0100 // bottom |
| 896 | } else if rect.Y1+eps < p.Y { |
| 897 | code |= 0b1000 // top |
| 898 | } |
| 899 | return code |
| 900 | } |
| 901 | |
| 902 | // return whether line is inside the rectangle, either entirely or partially. |
| 903 | func cohenSutherlandLineClip(rect Rect, a, b Point, eps float64) (Point, Point, bool, bool) { |
no outgoing calls
no test coverage detected