- changed title to Rectangle.inside with negative coordinates does not work
Rectangle.inside does not work with non-ordered vertices
Issue #83
open
r = Rectangle(Point(0,0),Point(-1,-1))
r.inside(Point(-0.5,-0.5))
This returns False but should be True. Here's a fix,
bool Rectangle::inside(dolfin::Point p) const
{
double ba_x = b.x() - a.x();
double ba_y = b.y() - a.y();
double pa_x = (p.x() - a.x())*ba_x/std::abs(ba_x);
double pa_y = (p.y() - a.y())*ba_y/std::abs(ba_y);
return pa_x >= 0.0 && pa_x <= 1.0 && pa_y >= 0.0 and pa_y <= 1.0;
}
Comments (8)
-
reporter -
reporter - edited description
-
reporter - changed title to Rectangle.inside does not work with non-ordered vertices
-
reporter - edited description
-
Ref issue #83. Allow constructor of Rectangle and Box to take any two corners that span the rectangle/box.
→ <<cset a5ae88f009aa>>
-
reporter - changed status to resolved
-
- changed status to open
Failing test commented out at 856f617988f9233d29f4e56ccd1f38874a7a9d0c
-
Thanks. I will fix the test tonight.
- Log in to comment