Help with variable radius in curves

Simone Saviolo <[email protected]> Mon, 26 Nov 2018 14:04:12 +0100
Newsgroups gmane.games.torcs.general
Message-ID <CAJJ1XA5Kr9xiTUen-6DYFSug1Mpx0GwBR1SpAtR0P_=PLtmFQQ@mail.gmail.com>
--===============8133580179738832922==
Content-Type: multipart/alternative; boundary="000000000000e0951d057b90f86a"

--000000000000e0951d057b90f86a
Content-Type: text/plain; charset="UTF-8"

Hi everyone!

I'm trying to understand how variable radius curves are implemented in
TORCS. I'm following this file [1]. In my Main Track, I have

<attnum name="profil steps length" unit="m" val="4.0" />
<attstr name="profil" in="linear,spline" val="linear" />

This means that I should not enter the spline branch of the if at line 978,
but the else branch, which sets "steps" at 1. However, this should also
mean that my curve segments have a single step, with the start radius, and
no connection to the end radius. The "radius" variable is in fact changed
and set to the value of end radius at the end of the while loop (line
1280), but then the while exits right away because the number of steps has
been reached.

However, both in the track editor and in the game, the curve segments are
rendered the same way, i.e., with variable radius. The track editor clearly
shows a number of "subsegments", each with (apparently) a different radius.
However, I can't understand how the number of subsegments is determined, as
they don't match either the number of steps calculated in track.cpp (which
should be 1) nor the ratio between the length of the segments and the
profil steps length.

Can anyone please shed some light on this?

Thank you!

Regards,
Simone

[1]
https://sourceforge.net/p/torcs/code/ci/master/tree/torcs/torcs/src/modules/track/track4.cpp

--000000000000e0951d057b90f86a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">Hi everyone!<div><br></div><div>I&#39;m t=
rying to understand how variable radius curves are implemented in TORCS. I&=
#39;m following=C2=A0this file [1]. In my Main Track, I have</div><div><br>=
</div><div>&lt;attnum name=3D&quot;profil steps length&quot; unit=3D&quot;m=
&quot; val=3D&quot;4.0&quot; /&gt;<br></div><div>&lt;attstr name=3D&quot;pr=
ofil&quot; in=3D&quot;linear,spline&quot; val=3D&quot;linear&quot; /&gt;<br=
></div><div><br></div><div>This means that I should not enter the spline br=
anch of the if at line 978, but the else branch, which sets &quot;steps&quo=
t; at 1. However, this should also mean that my curve segments have a singl=
e step, with the start radius, and no connection to the end radius. The &qu=
ot;radius&quot; variable is in fact changed and set to the value of end rad=
ius at the end of the while loop (line 1280), but then the while exits righ=
t away because the number of steps has been reached.=C2=A0</div><div><br></=
div><div>However, both in the track editor and in the game, the curve segme=
nts are rendered the same way, i.e., with variable radius. The track editor=
 clearly shows a number of &quot;subsegments&quot;, each with (apparently) =
a different radius. However, I can&#39;t understand how the number of subse=
gments is determined, as they don&#39;t match either the number of steps ca=
lculated in track.cpp (which should be 1) nor the ratio between the length =
of the segments and the profil steps length.=C2=A0</div><div><br></div><div=
>Can anyone please shed some light on this?</div><div><br></div><div>Thank =
you!</div><div><br></div><div>Regards,</div><div>Simone</div><div><br></div=
><div>[1]=C2=A0<a href=3D"https://sourceforge.net/p/torcs/code/ci/master/tr=
ee/torcs/torcs/src/modules/track/track4.cpp" target=3D"_blank">https://sour=
ceforge.net/p/torcs/code/ci/master/tree/torcs/torcs/src/modules/track/track=
4.cpp</a></div></div></div>

--000000000000e0951d057b90f86a--


--===============8133580179738832922==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8133580179738832922==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Torcs-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/torcs-users

--===============8133580179738832922==--