<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>Hi Steve,<br><br>I thought 32 should be used without rounding.<br>If direct == path, we don't have to encode curve data,<br>so the ratio should always be < 32.<br><br>Anyhow, none of the formulas I tried shows no error<br>when using NodCheck on Garmin maps.<br><br>Gerd<br><br><div>> From: steve@parabola.me.uk<br>> Date: Wed, 12 Feb 2014 16:40:27 +0000<br>> To: mkgmap-dev@lists.mkgmap.org.uk<br>> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes<br>> <br>> <br>> <br>> .<br>> >How sure are you about these threshold values in NodCheck?<br>> > double v = 30.0;<br>> > int calcRatio = (int) Math.round(v * direct / path) & 0x1f;<br>> > if (calcRatio > 26)<br>> > calcRatio = 0;<br>> <br>> 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.<br>> The Max value of the ratio is 1, so 31 would never overflow the 5 bits.<br>> <br>> 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.<br>> <br>> ><br>> ><br>> >Hi Steve,<br>> ><br>> >yes, I just found this as well. The remaining errors all have ratio =<br>> >7, looking at this now.<br>> ><br>> >Gerd<br>> ><br>> >> Date: Wed, 12 Feb 2014 13:37:43 +0000<br>> >> From: steve@parabola.me.uk<br>> >> To: mkgmap-dev@lists.mkgmap.org.uk<br>> >> Subject: Re: [mkgmap-dev] [Patch v1] curve bytes<br>> >> <br>> >> On 12/02/14 10:46, Gerd Petermann wrote:<br>> >> > @@ -80,22 +88,27 @@<br>> >> >                 this.roadDef = roadDef;<br>> >> >                 this.source = source;<br>> >> >                 this.dest = dest;<br>> >> > -                this.initialHeading = initialHeading;<br>> >> > -                this.finalHeading = finalHeading;<br>> >> > -                this.length = convertMeters(length);<br>> >> > +                this.initialHeading = (float) initialBearing;<br>> >> > +                this.finalHeading = (float) finalBearing;<br>> >> > +                this.directHeading = (float) directBearing;<br>> >> > +                this.length = convertMeters(length);<br>> >> >                 this.curveEnabled = curveEnabled;<br>> >> >                 this.pointsHash = pointsHash;<br>> >> > +                int encodedDirectLength =<br>> >convertMeters(source.getCoord().distance(dest.getCoord()));<br>> >> > +                <br>> >> > +                lengthRatio = (byte) ((int)Math.round(32.0 * encodedDirectLength<br>> >/ length) & 0x1f);<br>> >> <br>> >> This (above) should use this.length, not length<br>> >>                 <br>> >> > +                haveCurve = curveEnabled && lengthRatio > 0;<br>> >> >         }<br>> >> <br>> >> That fix makes leaves me with just a small number of ratio errors.<br>> >> <br>> >> ..Steve<br>> >> _______________________________________________<br>> >> mkgmap-dev mailing list<br>> >> mkgmap-dev@lists.mkgmap.org.uk<br>> >> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev<br>> >                                            <br>> ><br>> >_______________________________________________<br>> >mkgmap-dev mailing list<br>> >mkgmap-dev@lists.mkgmap.org.uk<br>> >http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev                                            <br>> ><br>> >------------------------------------------------------------------------<br>> ><br>> >_______________________________________________<br>> >mkgmap-dev mailing list<br>> >mkgmap-dev@lists.mkgmap.org.uk<br>> >http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev<br>> <br>> _______________________________________________<br>> mkgmap-dev mailing list<br>> mkgmap-dev@lists.mkgmap.org.uk<br>> http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev<br></div>                                            </div></body>
</html>