Last active
November 28, 2017 12:48
-
-
Save vuchl/491ec6b547f3f2e9168ac52c842549d2 to your computer and use it in GitHub Desktop.
SetPathPoints from Octave to mocked PC-Crash library
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pkg load windows | |
pkg load io | |
function SetPathPoints (sCar, SNrOfPoints, Points) | |
endfunction | |
vorlauf = 72 | |
for B1 = 3.25 | |
for B2 = 3.25 | |
for F = 1 | |
for a = 75 | |
rad = (a / 360) * (2 * pi) | |
s = (B1 * cos(rad) + B2) / sin(rad) | |
t = ((B1 * cos(rad) + B2) / sin(rad) + B1 * sin(rad)) | |
x0 = 0 | |
y0 = 0 | |
x1 = -s * cos(rad) | |
y1 = s * sin(rad) | |
x2 = -(s + vorlauf) * cos(rad) | |
y2 = (s + vorlauf) * sin(rad) | |
x3 = -t | |
y3 = 0 | |
x4 = -t - vorlauf | |
y4 = 0 | |
P0 = [x0, y0] | |
P1 = [x1, y1] | |
P2 = [x2, y2] | |
P3 = [x3, y3] | |
P4 = [x4, y4] | |
PathPoints = {P0, P1, P2, P3, P4} | |
endfor | |
endfor | |
endfor | |
endfor | |
PCCApp = actxserver('PCCrash.Document') | |
golf = strcat(pwd, '\golf4_06r.enc') | |
PCCApp.LoadCarDefinition(0, golf) | |
PCCApp.SetParameterDouble(0, 155, x4) | |
PCCApp.SetParameterDouble(0, 156, y4) | |
# probier mal | |
PCCApp.SetPathPoints(0, 1, P0) | |
PCCApp.SetPathPoints(1, 1, P1) | |
PCCApp.SetPathPoints(2, 1, P2) | |
PCCApp.SetPathPoints(3, 1, P3) | |
PCCApp.SetPathPoints(4, 1, P4) | |
# oder | |
PCCApp.SetPathPoints(0, 2, P0) | |
PCCApp.SetPathPoints(1, 2, P1) | |
PCCApp.SetPathPoints(2, 2, P2) | |
PCCApp.SetPathPoints(3, 2, P3) | |
PCCApp.SetPathPoints(4, 2, P4) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment