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

Function correctIntersection

path_intersection_util.go:162–184  ·  view source on GitHub ↗
(z, aMin, aMax, bMin, bMax Point)

Source from the content-addressed store, hash-verified

160}
161
162func correctIntersection(z, aMin, aMax, bMin, bMax Point) Point {
163 if z.X < aMin.X {
164 z.X = aMin.X
165 } else if aMax.X < z.X {
166 z.X = aMax.X
167 }
168 if z.X < bMin.X {
169 z.X = bMin.X
170 } else if bMax.X < z.X {
171 z.X = bMax.X
172 }
173 if z.Y < aMin.Y {
174 z.Y = aMin.Y
175 } else if aMax.Y < z.Y {
176 z.Y = aMax.Y
177 }
178 if z.Y < bMin.Y {
179 z.Y = bMin.Y
180 } else if bMax.Y < z.Y {
181 z.Y = bMax.Y
182 }
183 return z
184}
185
186// F. Antonio, "Faster Line Segment Intersection", Graphics Gems III, 1992
187func intersectionLineLineBentleyOttmann(zs []Point, a0, a1, b0, b1 Point) []Point {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected