Posts: 1,632
Threads: 127
Joined: Oct 2006
Reputation:
8
Ok guys, I have stumbled on something and would like some mathematical help.
It is about object placement. I have all object positions, but the track is in the wrong place.
What I want to come up with is a bit of calculating which gives me the right position for all objects.
X-axis movement is not a problem
Y-axis movement is not a problem
Z-axis movement is not a problem
but then it happens you have to rotate an object...
Can anybody help with a formula which determines the correct position of object B compared to object A if object A is for instance rotated 25 degrees?
I am looking for the bright minds of this board (and already have someone in mind to answer my question

)
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)
Posts: 1,356
Threads: 67
Joined: Nov 2006
Reputation:
31
Sander,
As for me I rarely use math while placing the objects. I usually load group of object to some place near the track, create 3do file and than move/rotate this object in 3doedit. When I'm happy with objectc placement I write all this data in tso file. Than add new objects and so on. This is way I always work.
Maths:
Normal state: ObjA (Xa, Ya, Za) ObjB(Xb1, Yb1, Zb1)
Rotation 25 deg:
Object A and B both use Zrot = 25
ObjA (Xa, Ya, Za) remains the same
ObjB (Xb2, Yb2, Zb2)
Xb2=(Xb1-Xa) x Cos(25) + Xa
Yb2=(Xb1-Xa) x Sin(25) + Yb1
This for objects that have same Y coordinate. So do you really need all thi calculations?
Posts: 273
Threads: 7
Joined: Nov 2006
Reputation:
2
I do not understand the exact details of your problem, but here is the basic transformation for rotation. Let us assume xb1,yb1 are the coordinates before, xb2 and yb2 are the coordinates after B is rotated around the Z axis by an angle 'a' (a>0 means it is rotated in the direction from the X axis towards the Y axis).
Then:
xb2 = xb1*cos(a) - yb1*sin(a)
yb2 = xb1*sin(a) + yb1*cos(a)
If I understand the problem right, you first move the objects, so that the origin of the objects system is the same as the origin of the track system. Then rotate all of the points of the objects around the Z axis by the above formula.
Born in 1979 - the same year as Bourdais, Raikkonen, Champcar and Dakar.
Posts: 490
Threads: 13
Joined: Oct 2006
Reputation:
6
combine objA.3do and objB.3do into objC.3do, center of rotation same as objA's. rotate objC.3do. screw the math.
Posts: 306
Threads: 93
Joined: Oct 2006
Reputation:
1
"screw the math."
No! Better not. Who knows what thing will be created...
Posts: 1,632
Threads: 127
Joined: Oct 2006
Reputation:
8
A friend is working on a little program which uses the inserts.txt from 3doedit, a few parameters like rotation, x, y and z change and then spits out an inserts.txt with the new correct coordinates after the objects are moved and rotated.
@ CTB, combining is not an option if you're looking at adding about 120 objects to a track. It kills draw.
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)
Posts: 1,632
Threads: 127
Joined: Oct 2006
Reputation:
8
Ok, I just noticed, there are only 100 object left, after I cut a few out. Getting those Rfactor things is sometimes harder than I hoped.
IIRS Driver Champion (2005-2007, 2010-2014)
IIRS Team Champion (2004-2014)