Skip to content
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

Support rotated rectangles #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

informaniac
Copy link
Contributor

Hello, it is me again.

I added support for arbitrary rotated rectangular Geofences. This is done by homomorphically calculating the perpendicular projection of the point onto two non-opposing borders and comparing whether the length of the resulting vectors are not longer than the respective borders are. Mathematical proof can be found in this paper under section IV-Implementation.

To be more consistent with the mathematical descriptions in the paper I used a small vector class, which is a little bloated from other things that were tested with it.
The prefix e_ indicates a homomorphically encrypted value.

With this it should be possible to evaluate triangles (taking a detour) by combining two rectangular Geofences.

added calculations for arbitrary rotated rectangular geofences
added tests for the rotated geofence in the python-client
@mapmeld
Copy link
Contributor

mapmeld commented Oct 21, 2018

Thanks for sending this arXiv paper! It's good to see some research into this

Instead of a test using the same geobox, could your example use a rotated shape? That way we can be sure to have coordinates x1,y1 to x4,y4 in the right places

@informaniac
Copy link
Contributor Author

Glad to help. I am working on it. Usually, this should not be much of a problem but somehow I managed to run into strange behaviour of my evaluation when the point was outside the geofence. This could take a while as I am prone to interchange latitudes and longitudes...

@mapmeld
Copy link
Contributor

mapmeld commented Dec 6, 2018

hi ! I was just remembering this. Any luck on tests? Would be happy to add it in.

@informaniac
Copy link
Contributor Author

hi. lately, i did not have too much time on my hands to test this. currently there seems to be the need to make a monte carlo simulation to picture the shape of the geofence by evaluating random coordinates near and inside of it.

It seems that the Geofences that I used for my first practical Proof of Concept worked because of their low rotation angle. Also, when I tested it, I left the Geofence to the left side. The coordinates that i could not evaluate correctly were outside to the right of the Geofence.
If you want to test something, i could update the PR or my branch to include the current coordinates of this new (nearly 45 degree rotated) Geofence and add some testing coordinates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants