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

Inflate Geometry #67

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Inflate Geometry #67

wants to merge 5 commits into from

Conversation

Mhorse2471
Copy link

Added Inflate Geometry module to pathing modules.

@Mhorse2471
Copy link
Author

Conversion between LLA and XYZ (in both directions) is inaccurate. Not sure by how much. This conversion is not as simple as it is made to be in the function, and a more complex conversion method must be looked into to ensure accuracy.

Copy link
Contributor

@AaronWang04 AaronWang04 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall code format and quality looks good. unit tests would help greatly to verify and profile the performance of the module

import numpy as np


def inflate_polygon(vertices: np.ndarray, scale_distance: int) -> np.ndarray:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be a list, makes it easier for users of the class

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're referring to the input and output vertices of the function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both input and output, mb should have clarified. you can use the waypoint class that we have in modules because that one has both lonlat and altitude

np.ndarray: List of the offset vertices
"""
# Referance radius for altitude (Radius of earth = 6371 km):
r_ref = 6371 * (10**3)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this method may create too much inaccuracy. can we write some unit tests to test the results? also just to verify that it still works well in the event we refactor repo

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you referring to the inflation method as a whole, or just the method of converting between LLA and XYZ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just this method of converting LLA and XYZ, but dont worry about it for now, we should make unit tests and see the results


def inflate_polygon(vertices: np.ndarray, scale_distance: int) -> np.ndarray:
"""
Given a list of vertices representing a polygon geometry, offset the vertices such that the perpendicular
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this handle both convex and concave geometry? could there be invalid inputs (waypoints that seem ok but isnt actually valid geeometry and will mess up the code). if so we should try and detect and return empty?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that you mention it, I don't believe that it'll work with concave geometry. Some additional features will need to be added for it to work with concave.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, you should change comment to "a convex polygon geometry"

# Referance radius for altitude (Radius of earth = 6371 km):
r_ref = 6371 * (10**3)

# Convert LLA coordinates from degrees to radians:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

with LLA, does it work in 3d? or does it just keep the same altitude for waypoints but expand the latlon

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it works in 3D, so altitude will be expanded.

@Mhorse2471
Copy link
Author

The latest commit contains a new file called inflate_geo. This file contains a function that uses a completely different method for inflating the polygon that allows for convex geometry. Tests are included to check for valid input. There are two other functions in the file that are also used for testing. As of now, only 2D geometry can be handled.

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