MCPcopy Index your code
hub / github.com/tdewolff/canvas / cohenSutherlandOutcode

Function cohenSutherlandOutcode

util.go:887–900  ·  view source on GitHub ↗
(rect Rect, p Point, eps float64)

Source from the content-addressed store, hash-verified

885////////////////////////////////////////////////////////////////
886
887func 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.
903func cohenSutherlandLineClip(rect Rect, a, b Point, eps float64) (Point, Point, bool, bool) {

Callers 3

FastClipMethod · 0.85
ContainsPointMethod · 0.85
cohenSutherlandLineClipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected