POV-Ray : Newsgroups : povray.advanced-users : Truck and trailer : Re: Truck and trailer Server Time
29 Jul 2024 16:29:21 EDT (-0400)
  Re: Truck and trailer  
From: J  Diehl
Date: 3 Sep 2002 18:30:05
Message: <web.3d753744a31ba4aafed4f2250@news.povray.org>
I already thought about a link-offset (and some other things, see below) and
I’ll give you a fast solution you can try. (I had no time to simulate
yet, but this will follow)

You remember this part in the driveTo-macro:

//get the new position of the pole
#declare d=sqrt(dx*dx+dy*dy);
#declare tomove=d-Length[Pole];
#declare PosX[Pole]=PosX[Pole]+dx/d*tomove;
#declare PosY[Pole]=PosY[Pole]+dy/d*tomove;

In the last two lines we first normalize the d-vector (divide it by ist
length to get legth=1) and then multiply it by our distance to move. A link
with LinkDist units behind the axis (positive value) can be computed
similar. So add the following two lines:

#declare LinkPosX[Pole]=PosX[Pole]-dx/d*LinkDist[Pole]
#declare LinkPosY[Pole]=PosY[Pole]-dy/d*LinkDist[Pole]

This should give us the absolute coordinates of the Link after moved.

When the driveTo macro is called for your trailer, just tell it to follow
LinkPosX/Y instead of PosX/Y - that should fit the problem.

(You will have to add the new Array definitions outside this macro before
running)

Coordinate system of the new model:
Length gives us the distance from rotating point (origin of the truck model)
to the front link. LinkDist is the distance to the back link. The whole
length of this special 'pole' will be Length+LinkDist.
For your pulling truck, define Length and LinkDist with the same value
(every the half of the truck’s length), and it will rotate around ist
center. Putting no axle or wheels at the defined axle (origin), but
somewhere else in the front and back means that the wheels will squeeze
when driving around. Hurts my ears a bit ;-)

The model is still very idealistic. A very interesting thing i.e. will be
how far every wheel rotates to draw realistic rolling rims when steering. I
already have a solution in my head - coming soon.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.