-
Notifications
You must be signed in to change notification settings - Fork 16
Add furthestTime #5
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
Open
jabiertxof
wants to merge
2
commits into
inkscape:master
Choose a base branch
from
jabiertxof:furthestTime
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -265,6 +265,33 @@ class Curve | |
| return allNearestTimes(p, i.min(), i.max()); | ||
| } | ||
|
|
||
| /** @brief Compute a time value at which the curve comes closest to a specified point. | ||
|
||
| * The first value with the smallest distance is returned if there are multiple such points. | ||
| * @param p Query point | ||
| * @param a Minimum time value to consider | ||
| * @param b Maximum time value to consider; \f$a < b\f$ | ||
| * @return \f$q \in [a, b]: ||\mathbf{C}(q) - \mathbf{p}|| = | ||
| \inf(\{r \in \mathbb{R} : ||\mathbf{C}(r) - \mathbf{p}||\})\f$ */ | ||
| virtual Coord furthestTime( Point const& p, Coord a = 0, Coord b = 1 ) const; | ||
|
|
||
| /** @brief A version that takes an Interval. */ | ||
| Coord furthestTime(Point const &p, Interval const &i) const { | ||
| return furthestTime(p, i.min(), i.max()); | ||
| } | ||
|
|
||
| /** @brief Compute time values at which the curve comes closest to a specified point. | ||
|
||
| * @param p Query point | ||
| * @param a Minimum time value to consider | ||
| * @param b Maximum time value to consider; \f$a < b\f$ | ||
| * @return Vector of points closest and equally far away from the query point */ | ||
| virtual std::vector<Coord> allFurthestTimes( Point const& p, Coord from = 0, | ||
| Coord to = 1 ) const; | ||
|
|
||
| /** @brief A version that takes an Interval. */ | ||
| std::vector<Coord> allFurthestTimes(Point const &p, Interval const &i) { | ||
| return allFurthestTimes(p, i.min(), i.max()); | ||
| } | ||
|
|
||
| /** @brief Compute the arc length of this curve. | ||
| * For a curve \f$\mathbf{C}(t) = (C_x(t), C_y(t))\f$, arc length is defined for 2D curves as | ||
| * \f[ \ell = \int_{0}^{1} \sqrt { [C_x'(t)]^2 + [C_y'(t)]^2 }\, \text{d}t \f] | ||
|
|
@@ -346,6 +373,11 @@ Coord nearest_time(Point const& p, Curve const& c) { | |
| return c.nearestTime(p); | ||
| } | ||
|
|
||
| inline | ||
| Coord furthest_time(Point const& p, Curve const& c) { | ||
| return c.furthestTime(p); | ||
| } | ||
|
|
||
| // for make benefit glorious library of Boost Pointer Container | ||
| inline | ||
| Curve *new_clone(Curve const &c) { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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 can return anything between 0 and 3 * M_PI. It should return something within the range [0, 2 * M_PI) instead - the class Angle can be used for this.