1 (edited by danielesuppo 2019-05-16 16:13:50)

Topic: Weird issue with DistanceBetweenPoints

Hello, I'm using 
OnlineMapsUtils.DistanceBetweenPoints(Vector2     point1,  Vector2 point2)

to calculate the distance between some Vector2 longitude/latitude points.

It work fine for most of my values, but unexpectedly it fail on a couple of points, because it return a Nan value.
I've tried using doubles instead of Vector2 and it return a totally weird value.

I really don't know why, please can you check the picture in attachment and help me to understand what's going on?
Many thanks!

Post's attachments

Attachment icon error.jpg 72.57 kb, 54 downloads since 2019-05-16 

Re: Weird issue with DistanceBetweenPoints

Hello.

Thank you for the bug report.
The problem has been fixed.
In the next version this will work correctly.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Weird issue with DistanceBetweenPoints

Great!
Do you know when you will release the new version with this bug corrected?

Re: Weird issue with DistanceBetweenPoints

1-2 weeks.

This bug does not require the immediate release of a fix, because you can easily check for NaN on your side.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

Re: Weird issue with DistanceBetweenPoints

Yes, but unfortunatley I rely on DistanceBetweenPoints for some maths.
Anyway I'll wait, maybe if you have a minor update just for this bug it would be really appreciated smile

Re: Weird issue with DistanceBetweenPoints

Open the DistanceBetweenPoints method you are using.
At the end of the method there will be a check for NaN for Y.
Add the same check for X.
Example for a method using Vector2:

public static Vector2 DistanceBetweenPoints(Vector2 point1, Vector2 point2)
{
    // ...
    if (float.IsNaN(sizeX)) sizeX = 0; // <--- ADD THIS
    if (float.IsNaN(sizeY)) sizeY = 0;
    return new Vector2(sizeX, sizeY);
}

The same logic for the other methods.
Just copy-paste the check line for Y and replace Y to X.

Kind Regards,
Infinity Code Team.

Boost your productivity a lot and immediately using Ultimate Editor Enhancer. Trial and non-commerce versions available.

7 (edited by danielesuppo 2019-05-20 00:56:45)

Re: Weird issue with DistanceBetweenPoints

Many thanks!
It work!
The best support ever!