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

Survey: Adjust grid line direction after polygon clip #3856

Merged
merged 2 commits into from
Jul 26, 2016

Conversation

DonLakeFlyer
Copy link
Contributor

Fix for #3798

const QLineF& line = lineList[i];
QLineF adjustedLine;

if (line.angle() > 180.0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would expect that the flipped lines would have an angle of 180.0°, which means they wouldn't be flipped back.

And if you change it to >=, this statement restricts the choice of grid angles to [0° - 180°), as otherwise the segments are flipped. Instead I would propose to alter the check to something like

if (fmod(fabs(line.angle() - gridAngle), 180.0) >= 90)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not really what this code does. It's just ordering the endpoints of the parallel grid lines (P1, P2) such that the vectors of the lines are all pointing in the same direction. The lines themselves stay the same, only the endpoints are flipped. This way when you connect the turn around from the end of one parallel line to the beginning of the next the connection is always on the edge of the polygon instead of possibly traversing the center of the polygon as shown in the image.

I think it's correct, unless I'm misunderstanding your point.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One more piece of information. The entry point for the survey is still not yet implemented and at this point is arbitrary based on polygon intersection. This endpoint flipping code will affect it as well. But the user themselves really needs control over it. That is NYI at this point. I'm not expecting them to set grid angle to adjust that. Or at least not at this point, since I haven't thought that much about it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I've found a good approach is to let the user set an initial heading via a radial control. That affords them the ability to intuitively optimize fixed wing survey plans for prevailing winds.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But that also says that grid angle also informs initial entry point. I was thinking that wasn't the case, but I can see now how it may be. What's the concensus on that?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's more complex than my simple statement. I'm going to craete a new discussion for this so we an continue there.

Affect on grid is to specific to details of polygon to test
@DonLakeFlyer
Copy link
Contributor Author

Survey area grid entry discussion is here: #3864

@DonLakeFlyer DonLakeFlyer merged commit 7255a8d into mavlink:master Jul 26, 2016
@DonLakeFlyer DonLakeFlyer deleted the GridLineDirection branch September 3, 2016 18:57
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.

3 participants