[Patch v1] curve bytes

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

[Patch v1] curve bytes

Gerd Petermann
Hi all,

attached is a patch for the high-prec branch.
It tries to encode the curve bytes as suggested by Steve
in the display docu nod.txt.

I don't see big effects in MapSource, but maybe so called active routing
works better with this?

@Steve: Please have a look at it.

Gerd

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

curvebytes-v1.patch (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Steve Ratcliffe
On 12/02/14 10:46, Gerd Petermann wrote:
> I don't see big effects in MapSource, but maybe so called active routing
> works better with this?
>
> @Steve: Please have a look at it.

The direct bearing now looks good.

The distance ratio is still showing a lot of errors in the checker.
Looks like even completely straight roads with two nodes
are getting curve data.

High values of lengthRatio mean that the road is almost straight, and
so have curve is more likely to depend on lengthRatio < some-value.

I don't however know the triggers for adding curve and for making
it two bytes instead of one.

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Steve Ratcliffe
In reply to this post by Gerd Petermann
On 12/02/14 10:46, Gerd Petermann wrote:

> @@ -80,22 +88,27 @@
>   this.roadDef = roadDef;
>   this.source = source;
>   this.dest = dest;
> - this.initialHeading = initialHeading;
> - this.finalHeading = finalHeading;
> - this.length = convertMeters(length);
> + this.initialHeading = (float) initialBearing;
> + this.finalHeading = (float) finalBearing;
> + this.directHeading = (float) directBearing;
> + this.length = convertMeters(length);
>   this.curveEnabled = curveEnabled;
>   this.pointsHash = pointsHash;
> + int encodedDirectLength = convertMeters(source.getCoord().distance(dest.getCoord()));
> +
> + lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength / length) & 0x1f);

This (above) should use this.length, not length
               
> + haveCurve = curveEnabled && lengthRatio > 0;
>   }

That fix makes leaves me with just a small number of ratio errors.

..Steve
_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Gerd Petermann
Hi Steve,

yes,  I just found this as well. The remaining errors all have ratio = 7, looking at this now.

Gerd

> Date: Wed, 12 Feb 2014 13:37:43 +0000

> From: [hidden email]
> To: [hidden email]
> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes
>
> On 12/02/14 10:46, Gerd Petermann wrote:
> > @@ -80,22 +88,27 @@
> > this.roadDef = roadDef;
> > this.source = source;
> > this.dest = dest;
> > - this.initialHeading = initialHeading;
> > - this.finalHeading = finalHeading;
> > - this.length = convertMeters(length);
> > + this.initialHeading = (float) initialBearing;
> > + this.finalHeading = (float) finalBearing;
> > + this.directHeading = (float) directBearing;
> > + this.length = convertMeters(length);
> > this.curveEnabled = curveEnabled;
> > this.pointsHash = pointsHash;
> > + int encodedDirectLength = convertMeters(source.getCoord().distance(dest.getCoord()));
> > +
> > + lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength / length) & 0x1f);
>
> This (above) should use this.length, not length
>
> > + haveCurve = curveEnabled && lengthRatio > 0;
> > }
>
> That fix makes leaves me with just a small number of ratio errors.
>
> ..Steve
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Gerd Petermann
Hi Steve,

the major error was caused by a last minute change, another one by wrong masking.
Please check attached v2 of the patch. I still see error messages regarding ratio and
bearing, but they may be caused by the different precisions.
How sure are you about these threshold values in NodCheck?
            double v = 30.0;
            int calcRatio = (int) Math.round(v * direct / path) & 0x1f;
            if (calcRatio > 26)
                calcRatio = 0;

Gerd


From: [hidden email]
To: [hidden email]
Date: Wed, 12 Feb 2014 14:39:21 +0100
Subject: Re: [mkgmap-dev] [Patch v1] curve bytes

Hi Steve,

yes,  I just found this as well. The remaining errors all have ratio = 7, looking at this now.

Gerd

> Date: Wed, 12 Feb 2014 13:37:43 +0000

> From: [hidden email]
> To: [hidden email]
> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes
>
> On 12/02/14 10:46, Gerd Petermann wrote:
> > @@ -80,22 +88,27 @@
> > this.roadDef = roadDef;
> > this.source = source;
> > this.dest = dest;
> > - this.initialHeading = initialHeading;
> > - this.finalHeading = finalHeading;
> > - this.length = convertMeters(length);
> > + this.initialHeading = (float) initialBearing;
> > + this.finalHeading = (float) finalBearing;
> > + this.directHeading = (float) directBearing;
> > + this.length = convertMeters(length);
> > this.curveEnabled = curveEnabled;
> > this.pointsHash = pointsHash;
> > + int encodedDirectLength = convertMeters(source.getCoord().distance(dest.getCoord()));
> > +
> > + lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength / length) & 0x1f);
>
> This (above) should use this.length, not length
>
> > + haveCurve = curveEnabled && lengthRatio > 0;
> > }
>
> That fix makes leaves me with just a small number of ratio errors.
>
> ..Steve
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________ mkgmap-dev mailing list [hidden email] http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

curvebytes-v2.patch (16K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Steve Ratcliffe


.
>How sure are you about these threshold values in NodCheck?
>            double v = 30.0;
>            int calcRatio = (int) Math.round(v * direct / path) & 0x1f;
>            if (calcRatio > 26)
>                calcRatio = 0;

I found v=32 gave a good match and 30 a better one , but thinking about it, away from the computer, I guess that 31 is the logical value to use.
The Max value of the ratio is 1, so 31 would never overflow the 5 bits.

There does seem to be a cap on the Max value seen, although it may be variable.  I suspect it doesn't matter that much.

>
>
>Hi Steve,
>
>yes,  I just found this as well. The remaining errors all have ratio =
>7, looking at this now.
>
>Gerd
>
>> Date: Wed, 12 Feb 2014 13:37:43 +0000
>> From: [hidden email]
>> To: [hidden email]
>> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes
>>
>> On 12/02/14 10:46, Gerd Petermann wrote:
>> > @@ -80,22 +88,27 @@
>> >   this.roadDef = roadDef;
>> >   this.source = source;
>> >   this.dest = dest;
>> > - this.initialHeading = initialHeading;
>> > - this.finalHeading = finalHeading;
>> > - this.length = convertMeters(length);
>> > + this.initialHeading = (float) initialBearing;
>> > + this.finalHeading = (float) finalBearing;
>> > + this.directHeading = (float) directBearing;
>> > + this.length = convertMeters(length);
>> >   this.curveEnabled = curveEnabled;
>> >   this.pointsHash = pointsHash;
>> > + int encodedDirectLength =
>convertMeters(source.getCoord().distance(dest.getCoord()));
>> > +
>> > + lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength
>/ length) & 0x1f);
>>
>> This (above) should use this.length, not length
>>
>> > + haveCurve = curveEnabled && lengthRatio > 0;
>> >   }
>>
>> That fix makes leaves me with just a small number of ratio errors.
>>
>> ..Steve
>> _______________________________________________
>> mkgmap-dev mailing list
>> [hidden email]
>> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>    
>
>_______________________________________________
>mkgmap-dev mailing list
>[hidden email]
>http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev     
>
>------------------------------------------------------------------------
>
>_______________________________________________
>mkgmap-dev mailing list
>[hidden email]
>http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Reply | Threaded
Open this post in threaded view
|

Re: [Patch v1] curve bytes

Gerd Petermann
Hi Steve,

I thought 32 should be used without rounding.
If direct == path, we don't have to encode curve data,
so the ratio should always be < 32.

Anyhow, none of the formulas I tried shows no error
when using  NodCheck on Garmin maps.

Gerd

> From: [hidden email]

> Date: Wed, 12 Feb 2014 16:40:27 +0000
> To: [hidden email]
> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes
>
>
>
> .
> >How sure are you about these threshold values in NodCheck?
> > double v = 30.0;
> > int calcRatio = (int) Math.round(v * direct / path) & 0x1f;
> > if (calcRatio > 26)
> > calcRatio = 0;
>
> I found v=32 gave a good match and 30 a better one , but thinking about it, away from the computer, I guess that 31 is the logical value to use.
> The Max value of the ratio is 1, so 31 would never overflow the 5 bits.
>
> There does seem to be a cap on the Max value seen, although it may be variable. I suspect it doesn't matter that much.
>
> >
> >
> >Hi Steve,
> >
> >yes, I just found this as well. The remaining errors all have ratio =
> >7, looking at this now.
> >
> >Gerd
> >
> >> Date: Wed, 12 Feb 2014 13:37:43 +0000
> >> From: [hidden email]
> >> To: [hidden email]
> >> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes
> >>
> >> On 12/02/14 10:46, Gerd Petermann wrote:
> >> > @@ -80,22 +88,27 @@
> >> > this.roadDef = roadDef;
> >> > this.source = source;
> >> > this.dest = dest;
> >> > - this.initialHeading = initialHeading;
> >> > - this.finalHeading = finalHeading;
> >> > - this.length = convertMeters(length);
> >> > + this.initialHeading = (float) initialBearing;
> >> > + this.finalHeading = (float) finalBearing;
> >> > + this.directHeading = (float) directBearing;
> >> > + this.length = convertMeters(length);
> >> > this.curveEnabled = curveEnabled;
> >> > this.pointsHash = pointsHash;
> >> > + int encodedDirectLength =
> >convertMeters(source.getCoord().distance(dest.getCoord()));
> >> > +
> >> > + lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength
> >/ length) & 0x1f);
> >>
> >> This (above) should use this.length, not length
> >>
> >> > + haveCurve = curveEnabled && lengthRatio > 0;
> >> > }
> >>
> >> That fix makes leaves me with just a small number of ratio errors.
> >>
> >> ..Steve
> >> _______________________________________________
> >> mkgmap-dev mailing list
> >> [hidden email]
> >> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> >
> >
> >_______________________________________________
> >mkgmap-dev mailing list
> >[hidden email]
> >http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >mkgmap-dev mailing list
> >[hidden email]
> >http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
>
> _______________________________________________
> mkgmap-dev mailing list
> [hidden email]
> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

_______________________________________________
mkgmap-dev mailing list
[hidden email]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev