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

Refactor Polyline #339

Merged
merged 6 commits into from
Sep 7, 2021
Merged

Refactor Polyline #339

merged 6 commits into from
Sep 7, 2021

Conversation

sonomirco
Copy link
Collaborator

What type of PR is this? (check all applicable)

  • ♻️ Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 👷 Optimization
  • 📝 Documentation Update
  • 🔖 Release
  • 🚩 Other

Description

This PR refactors Polyline removing unnecessary methods, and implementing some required by ICurve.

Related Tickets & Documents

This PR closes #302

Added tests?

  • 👍 yes
  • 🙅 no, because they aren't needed
  • 🙋 no, because I need help

Added to documentation?

  • 📓 docs
  • 🙅 no documentation needed

@sonomirco sonomirco added the refactor 🧰 Pull requests that perform maintenance on the project but add no features or bug fixes. label Sep 7, 2021
@sonomirco sonomirco self-assigned this Sep 7, 2021
@@ -49,7 +48,7 @@ public Polyline(IList<Point3> vertices)
/// <summary>
/// Gets the middle point of the polyline.
/// </summary>
public Point3 MidPoint => PointAt(0.5);
public Point3 MidPoint => PointAtLength(0.5, true);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Doesn't make sense to be point at length and use a value between 0 and 1.
Maybe would be more clear to name it PointAtNormalizedLength

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So NormalizedLengthAt answers this comment.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Effectively you are returning a point at a normalized length or a point at a "geometrical" length.
From a method called NormalizedLengthAt, I am expecting a length value given a normalized parameter.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not a problem to change the name in normalizedLengthAt

/// <summary>
/// Evaluates the point on the polyline at the given parameter. The integer part of the parameter indicates the index of the segment.
/// </summary>
/// <param name="t">Evaluate parameter. Parameter should be between 0.0 and segments count.</param>
Copy link
Collaborator

Choose a reason for hiding this comment

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

To me using the parameter this way doesn't really make sense. I know is mathematically or geometrically correct but I would prefer to see always a length or a normalized length (0..1), regardless of the type of curve we are working on.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

NormalizedLengthAt solve this problem.

@cesarecaoduro cesarecaoduro merged commit 5869281 into develop Sep 7, 2021
@sonomirco sonomirco deleted the dev/mibi/refactor-polyline branch September 9, 2021 09:42
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
refactor 🧰 Pull requests that perform maintenance on the project but add no features or bug fixes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Polyline
2 participants