| 215 | //------------------------------------------------------------------------------ |
| 216 | |
| 217 | bool IntersectPoint(TEdge &edge1, TEdge &edge2, IntPoint &ip) |
| 218 | { |
| 219 | double b1, b2; |
| 220 | if (SlopesEqual(edge1, edge2)) return false; |
| 221 | else if (edge1.dx == 0) |
| 222 | { |
| 223 | ip.X = edge1.xbot; |
| 224 | if (edge2.dx == horizontal) |
| 225 | { |
| 226 | ip.Y = edge2.ybot; |
| 227 | } else |
| 228 | { |
| 229 | b2 = edge2.ybot - (edge2.xbot/edge2.dx); |
| 230 | ip.Y = Round(ip.X/edge2.dx + b2); |
| 231 | } |
| 232 | } |
| 233 | else if (edge2.dx == 0) |
| 234 | { |
| 235 | ip.X = edge2.xbot; |
| 236 | if (edge1.dx == horizontal) |
| 237 | { |
| 238 | ip.Y = edge1.ybot; |
| 239 | } else |
| 240 | { |
| 241 | b1 = edge1.ybot - (edge1.xbot/edge1.dx); |
| 242 | ip.Y = Round(ip.X/edge1.dx + b1); |
| 243 | } |
| 244 | } else |
| 245 | { |
| 246 | b1 = edge1.xbot - edge1.ybot * edge1.dx; |
| 247 | b2 = edge2.xbot - edge2.ybot * edge2.dx; |
| 248 | b2 = (b2-b1)/(edge1.dx - edge2.dx); |
| 249 | ip.Y = Round(b2); |
| 250 | ip.X = Round(edge1.dx * b2 + b1); |
| 251 | } |
| 252 | |
| 253 | return |
| 254 | //can be *so close* to the top of one edge that the rounded Y equals one ytop ... |
| 255 | (ip.Y == edge1.ytop && ip.Y >= edge2.ytop && edge1.tmpX > edge2.tmpX) || |
| 256 | (ip.Y == edge2.ytop && ip.Y >= edge1.ytop && edge1.tmpX > edge2.tmpX) || |
| 257 | (ip.Y > edge1.ytop && ip.Y > edge2.ytop); |
| 258 | } |
| 259 | //------------------------------------------------------------------------------ |
| 260 | |
| 261 | void ReversePolyPtLinks(PolyPt &pp) |
no test coverage detected