-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#2412 - User can't correctly save (or make a layout) to RDF/RXN reaction several products or with separate positioned molecules #2717
base: master
Are you sure you want to change the base?
Conversation
@@ -822,5 +824,234 @@ namespace indigo | |||
float _d; | |||
}; | |||
|
|||
inline bool isPointInPolygon(const Vec2f& p, const std::vector<Vec2f>& poly) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need more comments.
Also no need to calculate x if both vertices has x > px
So I suggest something like
inline bool isPointInPolygon(const Vec2f& p, const std::vector<Vec2f>& poly)
{
// Ray casting algorithm
bool in = false;
for (size_t i = 0, n = poly.size(); i < n; ++i)
{
size_t j = (i + 1) % n;
if (((poly[i].y > p.y) != (poly[j].y > p.y)) && // point y between vertices and
(((p.x > poly[i].x) && (p.x < poly[j].x)) || // both vertices are at right of point or edge is at right of point
(p.x < (poly[i].x + (p.y - poly[i].y) * (poly[j].x - poly[i].x) / (poly[j].y - poly[i].y))))) // py < (py-y0)*dx/dy
in = !in;
}
return in;
}
return std::abs(area) * 0.5f; | ||
} | ||
|
||
inline bool isInside(const Vec2f& edgeStart, const Vec2f& edgeEnd, const Vec2f& point) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be named isNormalNegative, and comment about "check sign of normal to (edgeStart,edgeEnd),(edgeStart,point)" will be usefull
add tests where actual undefined component (> 2 bonds). Save to rxn, save to ket (should be still saved) Add 1 for on reactant side, 1 on catalyst and 1 on product, also one for pathway reaction |
Generic request
#1234 – issue name