mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-23 01:21:42 +00:00
[wpimath] Rename FindNearestPoint() to Nearest() (#7513)
This is easier to type and follows the naming of Pose2d::Nearest(). Since Ellipse2d and Rectangle2d were added for the 2025 season, we don't need to add deprecation notices.
This commit is contained in:
@@ -154,7 +154,7 @@ class WPILIB_DLLEXPORT Ellipse2d {
|
||||
* @return The distance (0, if the point is contained by the ellipse)
|
||||
*/
|
||||
units::meter_t Distance(const Translation2d& point) const {
|
||||
return FindNearestPoint(point).Distance(point);
|
||||
return Nearest(point).Distance(point);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -164,7 +164,7 @@ class WPILIB_DLLEXPORT Ellipse2d {
|
||||
* @return A new point that is nearest to {@code point} and contained in the
|
||||
* ellipse.
|
||||
*/
|
||||
Translation2d FindNearestPoint(const Translation2d& point) const;
|
||||
Translation2d Nearest(const Translation2d& point) const;
|
||||
|
||||
/**
|
||||
* Checks equality between this Ellipse2d and another object.
|
||||
|
||||
@@ -155,7 +155,7 @@ class WPILIB_DLLEXPORT Rectangle2d {
|
||||
* @return The distance (0, if the point is contained by the rectangle)
|
||||
*/
|
||||
constexpr units::meter_t Distance(const Translation2d& point) const {
|
||||
return FindNearestPoint(point).Distance(point);
|
||||
return Nearest(point).Distance(point);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +165,7 @@ class WPILIB_DLLEXPORT Rectangle2d {
|
||||
* @return A new point that is nearest to {@code point} and contained in the
|
||||
* rectangle.
|
||||
*/
|
||||
constexpr Translation2d FindNearestPoint(const Translation2d& point) const {
|
||||
constexpr Translation2d Nearest(const Translation2d& point) const {
|
||||
// Check if already in rectangle
|
||||
if (Contains(point)) {
|
||||
return point;
|
||||
|
||||
Reference in New Issue
Block a user