Ray-casting algorithm: Difference between revisions

Updated D entry
(Updated D entry)
Line 596:
}
 
bool contains(in Figure poly, in Point p) pure nothrow @safe @nogc {
static bool raySegI(in Point p, in Edge edge) pure nothrow {
pure nothrow @safe @nogc {
enum double epsilon = 0.00001;
with (edge) {
Line 620 ⟶ 621:
}
 
return poly.edges.count!(e => raySegI(p, e))() % 2;
}
 
Line 643 ⟶ 644:
{{ 3.0, 10.0}, { 0.0, 5.0}}, {{ 0.0, 5.0}, { 3.0, 0.0}}]}
];
 
immutable Point[] testPoints = [{ 5, 5}, {5, 8}, {-10, 5}, {0, 5},
{10, 5}, {8, 5}, { 10, 10}];