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

Function angleBetweenExclusive

util.go:112–123  ·  view source on GitHub ↗

angleBetweenExclusive is true when theta is in range (lower,upper) excluding the end points. Angles can be outside the [0,2PI) range.

(theta, lower, upper float64)

Source from the content-addressed store, hash-verified

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 {
113 if upper < lower {
114 // sweep is false, ie direction is along negative angle (clockwise)
115 lower, upper = upper, lower
116 }
117 theta = angleNorm(theta - lower)
118 upper = angleNorm(upper - lower)
119 if 0.0 < theta && theta < upper {
120 return true
121 }
122 return false
123}
124
125// snap "gridsnaps" the floating point to a grid of the given spacing
126func snap(val, spacing float64) float64 {

Callers 2

IntoMethod · 0.85

Calls 1

angleNormFunction · 0.85

Tested by 1