-
Notifications
You must be signed in to change notification settings - Fork 121
Polygon Orientation Property and Area Calculation #415
Conversation
@santis19 thanks for raising this issue with the coordinates. I never liked the hacky way we dealt with it (pretty much just ignored it). The modeling code will need to know the orientation of the polygon (horizontal or vertical). And it doesn't make sense to use "x" and "y" for vertices coordinates in vertical polygons. So I think the best would be to have two classes: Also remember that x->north and y->east. |
@leouieda, I was thinking the Polygon class without any specific application, just like a geometrical element independent of how it will be used. If on the other hand we take into account our purposes, the Polygon class is intended to be used in the forward gravity calculations through the Talwani method. |
The only other place I think of a horizontal polygon being useful is for the You're right, we can have just the vertical polygon. It could be the default |
I've modified the
Furthermore, I've seen that |
0174768
to
0e740b4
Compare
@leouieda I've noticed that if we adequate Maybe just for the Square case we can define a vertical one and an horizontal one. The first one intended to be just a particular case of Polygon, while the other one will be intended to work with the I did't get into the |
@santis19 Square is used in the forward modeling for I'd say, leave Square as it is right now (being horizontal) and add the PolygonHorizontal class. Open an issue for the Square problem and we'll work on it in a separate PR. |
e6fd003
to
0e740b4
Compare
@leouieda I've added two new classes:
With this definition of |
@santis19 sounds great! There doesn't seem to be any problem with srtomo. I'll update your branch so that you stop getting these failures on TravisCI. After that, this is good to merge. |
On this PR I divide the Polygon improvements with the ones made in Moulder on #411 .
I've cleaned up the code in a more Pythonic way, adding properties, property setters decorators and private methods.
In summary, this PR adds:
I've founded out that the Polygon orientation (clockwise or counterclockwise) depends on the direction of the cartesian axes on which it is defined.
For example, in a x, z system (with x->Right and z->Down, as we assume in talwani.gz), a clockwise Polygon has a negative area, so the code interprets it correctly as clockwise.
On the other hand, in a regular cartesian x, y system (with x->Right, y->Up), a clockwise Polygon has positive area, but the code will interpret it as a counterclockwise Polygon.
In the following scripts I intent to show this behaviour:
I can conclude that a positive area implies that the Polygon orientation follows the same right-hand rule than the axes. If area is negative, the Polygon orientation is contrary to the right-hand rule applied to the axes (hope you understand this conclusion).
Therefore the clockwise or counterclockwise orientation is defined by the pair of axes we use.
Should we stick to only one type of axes or give the option to choose between a right or left handed axes?
What's the best way to do this?
Checklist:
doc/install.rst
,environment.yml
,ci/requirements.txt
.cd doc; make
locally)doc/contributors.rst
(leave for last to avoid conflicts)