-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Area of a triangle #399
Area of a triangle #399
Conversation
src/GShark/Core/Trigonometry.cs
Outdated
/// <returns>The area of the triangle.</returns> | ||
public static double AreaOfTriangle(PolyLine polyLine) | ||
{ | ||
var pts = polyLine.ControlPointLocations; |
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.
Shouldn't we do some check on the number of vertices for the polyline?
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 assumed that if you calculate a triangle's area, you are passing a Polyline
composed of 4 points.
We may not need this overload method.
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 is still valid to keep it, as long as we introduce a check on the number of control points, and that first and last point are coincident (or polyline is closed)
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.
This method should be more specific given the name. It should take 3 points as parameters only. Using the vector based method for the area it shouldn't require any collinearity or coplanarity checks.
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'll remove this overload for now.
@d3ssy @cesarecaoduro ready to be merged. |
What type of PR is this? (check all applicable)
Description
This PR added the faction to calculate the area of a triangle.
Related Tickets & Documents
This PR closes #398
Added tests?
Added to documentation?