Skip to content

SP5: Coordinates needs Distance(Coordinates pt) #2791

@swharden

Description

@swharden

https://github.com/ScottPlot/ScottPlot/blob/main/src/ScottPlot5/ScottPlot5/Coordinates.cs could use a method to determine the distance from another point

for performance a DistanceSquared may be helpful too

something like:

public double DistanceSquared(Coordinates pt)
{
    double dX = Math.Abs(X - pt.X);
    double dY = Math.Abs(Y - pt.Y);
    return dX * dX + dY * dY;
}

public double DistanceSquared(Coordinates pt)
{
    return Math.Sqrt(DistanceSquared(pt));
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Good First IssueThis issue has limited complexity and may be a good start for new contributorsHelp WantedScott won't do this soon, but PRs from the community are welcome!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions