Mercurial > projects > doodle
comparison doodle/tk/geometry.d @ 40:1f97022e5c6d
Checkpoint. Development continues...
author | daveb |
---|---|
date | Mon, 12 Apr 2010 14:01:54 +0930 |
parents | c2f11e1d7470 |
children | f2e4e1d29b98 |
comparison
equal
deleted
inserted
replaced
39:b6c34f1fc7f3 | 40:1f97022e5c6d |
---|---|
269 | 269 |
270 private { | 270 private { |
271 // This is a commmon building block for intersection of lines and segments | 271 // This is a commmon building block for intersection of lines and segments |
272 // Two lines "a" and "b" are defined by two points each . | 272 // Two lines "a" and "b" are defined by two points each . |
273 // "ua" and "ub" define the intersection as a fraction along | 273 // "ua" and "ub" define the intersection as a fraction along |
274 // the two respetive line segments (FIXME this comment sucks) | 274 // the two respective line segments (FIXME this comment sucks) |
275 // Influenced by http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ | 275 // Influenced by http://ozviz.wasp.uwa.edu.au/~pbourke/geometry/lineline2d/ |
276 bool compute_intersection(in Point pa1, in Point pa2, out double ua, | 276 bool compute_intersection(in Point pa1, in Point pa2, out double ua, |
277 in Point pb1, in Point pb2, out double ub) { | 277 in Point pb1, in Point pb2, out double ub) { |
278 double den = (pb2.y - pb1.y) * (pa2.x - pa1.x) - (pb2.x - pb1.x) * (pa2.y - pa1.y); | 278 double den = (pb2.y - pb1.y) * (pa2.x - pa1.x) - (pb2.x - pb1.x) * (pa2.y - pa1.y); |
279 | 279 |