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