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

Function angleBetween

util.go:101–109  ·  view source on GitHub ↗

angleBetween is true when theta is in range [lower,upper] including the end points. Angles can be outside the [0,2PI) range.

(theta, lower, upper float64)

Source from the content-addressed store, hash-verified

99
100// angleBetween is true when theta is in range [lower,upper] including the end points. Angles can be outside the [0,2PI) range.
101func angleBetween(theta, lower, upper float64) bool {
102 if upper < lower {
103 // sweep is false, ie direction is along negative angle (clockwise)
104 lower, upper = upper, lower
105 }
106 theta = angleNorm(theta - lower + Epsilon)
107 upper = angleNorm(upper - lower + 2.0*Epsilon)
108 return theta <= upper
109}
110
111// angleBetweenExclusive is true when theta is in range (lower,upper) excluding the end points. Angles can be outside the [0,2PI) range.
112func angleBetweenExclusive(theta, lower, upper float64) bool {

Callers 6

TestAngleBetweenFunction · 0.85
BoundsMethod · 0.85
ellipseSplitFunction · 0.85
angleEqualFunction · 0.85
intersectionLineCircleFunction · 0.85
intersectionLineEllipseFunction · 0.85

Calls 1

angleNormFunction · 0.85

Tested by 1

TestAngleBetweenFunction · 0.68