Author Topic: NoLimits 2 - World-Formula  (Read 2678 times)

0 Members and 1 Guest are viewing this topic.

Offline Theo Gottwald

  • Administrator
  • Hero Member
  • *****
  • Posts: 928
  • User-Rate: +30/-4
    • it-berater
NoLimits 2 - World-Formula
« on: December 24, 2015, 11:48:09 AM »
These formulas are for NoLimits 2, see here:

Mathematisches Track Design mit NoLimits 2

Code: [Select]
// Weltformel
// Das hier ist die Länge und gewissermaßen auch die Form
// nachskalieren geht unten
// Ist auch Anzahl der Vertices
  Len=25

// Anzahl der Sinuskurven
  updown=1.9

// Verschiebt t ein wenig nach links
// so bekommen wir einen schönen Anstieg und Abfall
// 1-6
  Begin=0
  ModL=0

// Das ergibt die verschiedenen Formen
// 0-32
  ModX=2
  ModY=0
  ModZ=1

// 0,1
  ModB=2
  VertRoll=0

// Hier kann man alles noch Mal nachverschieben
OffsetX=0
OffsetY=0
OffsetZ=0

// Hier kann man alles noch Mal nachskalieren
ScaleX=1
ScaleY=1
ScaleZ=1

// Dynamic Scale - vergrößert oder verkleiner nach hinten
// 0-8
DX=0
DY=0
DZ=0

  radius = Len/2

  angle = 180*updown 
  var=angle / 180 * pi
  it=1-t

   mit=min(t,it)
   mat=max(t,it)


Switch (DX) {
  case [1] {DXF=t/2+0.5} 
  case [2] {DXF=t/4+0.75} 
  case [3] {DXF=it/8+0.875}
  case [4] {DXF=it/2+0.5} 
  case [5] {DXF=it/4+0.25} 
  case [6] {DXF=it/8+0.875} 
  case [7] {DXF=t+0.1} 
  case [8] {DXF=t+0.5} 
  case [9] {DXF=it+0.2} 
  case [10] {DXF=it+0.3} 
  else {DXF=1} 
}

Switch (DY) {
  case [1] {DYF=t/2+0.5} 
  case [2] {DYF=t/4+0.75} 
  case [3] {DYF=it/8+0.875}
  case [4] {DYF=it/2+0.5} 
  case [5] {DYF=it/4+0.35} 
  case [6] {DYF=it/8+0.875} 
  case [7] {DYF=t+0.1} 
  case [8] {DYF=t+0.5} 
  case [9] {DYF=it+0.2} 
  case [10] {DYF=it+0.3} 
  else {DYF=1} 
}

Switch (DZ) {
  case [1] {DZF=t/2+0.5} 
  case [2] {DZF=t/4+0.75} 
  case [3] {DZF=it/8+0.875}
  case [4] {DZF=it/2+0.5} 
  case [5] {DZF=it/4+0.35} 
  case [6] {DZF=it/8+0.875} 
  case [7] {DZF=t+0.1} 
  case [8] {DZF=t+0.5} 
  case [9] {DZF=it+0.2} 
  case [10] {DZF=it+0.3} 
  else {DZF=1} 
}

Switch (Begin) {
case [1] {s=(t+0.1)*0.9}
case [2] {s=(t-0.5)*2}
case [3] {s=(t-0.25)*1.5}
case [4] {s=(t-0.75)*3}
case [5] {s=(t-0.75)*5}
case [6] {s=(t-0.75)*6}
else {s=t}
}

Switch (ModL) {
case [1] {f=log(abs(t+0.0000000001)/Len)}
case [2] {f=log(abs(t+0.0000000001)/16)}
case [3] {f=log(abs(t+0.0000000001)/8)}
case [4] {f=log(abs(t+0.0000000001)/4)}
else {f=1}
}

  rad = s * var
  irad=(it)*var

  arad=min(rad,irad)
  brad=max(rad,irad)

Switch (ModX) {
 case [1] {x = radius*cos(rad)}
 case [2] {x = radius*sin(rad)}
 case [3] {x = radius*cos(irad)}
 case [4] {x = radius*sin(irad)}
 case [5] {x = radius*cos(rad)*2}
 case [6] {x = radius*sin(rad)*2}
 case [7] {x = radius*cos(irad)*2}
 case [8] {x = radius*sin(irad)*2}
 case [9] {x = arad*t*2}
 case [10] {x = brad*t}
 case [11] {x = brad*t*2}
 case [12] {x = brad*t*4}
 case [13] {x = brad*t*8}
 case [14] {x = brad*t*16}
 case [15] {x = brad*t*32}
 case [16] {x = arad*t}
 case [17] {x = arad*t*2}
 case [18] {x = arad*t*4}
 case [19] {x = arad*t*8}
 case [20] {x = brad*t+f}
 case [21] {x = arad*t+f}
 case [22] {x = radius*cos(rad)+f}
 case [23] {x = radius*sin(rad)+f}
 case [24] {x = radius*cos(irad)+f}
 case [25] {x = radius*sin(irad)+f}
 case [26] {x = rad*t+f}
 case [27] {x = var*t+f}
 case [28] {x=t*Len}
 case [29] {x=it*Len}
 case [30] {x=t*Len/2}
 case [31] {x=it*Len/2}
 case [32] {x = radius*t}
 else {x=1}
 }

Switch (ModY) {
 case [1] {y = radius*cos(rad)}
 case [2] {y = radius*sin(rad)}
 case [3] {y = radius*cos(irad)}
 case [4] {y = radius*sin(irad)}
 case [5] {y = radius*cos(rad)*2}
 case [6] {y = radius*sin(rad)*2}
 case [7] {y = radius*cos(irad)*2}
 case [8] {y = radius*sin(irad)*2}
 case [9] {y = arad*t*2}
 case [10] {y = brad*t}
 case [11] {y = brad*t*2}
 case [12] {y = brad*t*4}
 case [13] {y = brad*t*8}
 case [14] {y = brad*t*16}
 case [15] {y = brad*t*32}
 case [16] {y = arad*t}
 case [17] {y = arad*t*2}
 case [18] {y = arad*t*4}
 case [19] {y = arad*t*8}
 case [20] {y = brad*t+f}
 case [21] {y = arad*t+f}
 case [22] {y = radius*cos(rad)+f}
 case [23] {y = radius*sin(rad)+f}
 case [24] {y = radius*cos(irad)+f}
 case [25] {y = radius*sin(irad)+f}
 case [26] {y = rad*t+f}
 case [27] {y = var*t+f}
 case [28] {y=t*Len}
 case [29] {y=it*Len}
 case [30] {y=t*Len/2}
 case [31] {y=it*Len/2}
 case [32] {y = radius*t}
 else {y=1}
 }

Switch (ModZ) {
 case [1] {z = radius*cos(rad)}
 case [2] {z = radius*sin(rad)}
 case [3] {z = radius*cos(irad)}
 case [4] {z = radius*sin(irad)}
 case [5] {z = radius*cos(rad)*2}
 case [6] {z = radius*sin(rad)*2}
 case [7] {z = radius*cos(irad)*2}
 case [8] {z = radius*sin(irad)*2}
 case [9] {z = arad*t*2}
 case [10] {z = brad*t}
 case [11] {z = brad*t*2}
 case [12] {z = brad*t*4}
 case [13] {z = brad*t*8}
 case [14] {z = brad*t*16}
 case [15] {z = brad*t*32}
 case [16] {z = arad*t}
 case [17] {z = arad*t*2}
 case [18] {z = arad*t*4}
 case [19] {z = arad*t*8}
 case [20] {z = brad*t+f}
 case [21] {z = arad*t+f}
 case [22] {z = radius*cos(rad)+f}
 case [23] {z = radius*sin(rad)+f}
 case [24] {z = radius*cos(irad)+f}
 case [25] {z = radius*sin(irad)+f}
 case [26] {z = rad*t+f}
 case [27] {z = var*t+f}
 case [28] {z=t*Len}
 case [29] {z=it*Len}
 case [30] {z=t*Len/2}
 case [31] {z=it*Len/2}
 case [32] {z =radius*t}
else {z=1}
 }
   

 Switch (ModB)  {
// Rechts Bank
 case [1] {B = sin(brad-rad)}
 case [2] {B = sin(mat*180)}
 case [3] {B = sin(brad+mit)}
// Links Bank
 case [4] {B = cos(brad-rad)}
 case [5] {B = sin(mat*180)}
 case [6] {B = sin(brad+mit)}
// rechts -> Gerade
 case [7] {B = 1-(1/(t+.00000001))}
// Gerade -> Rechts
 case [8] {B = 1-(1/(it+.00000001))}

// Links -> Gerade
 case [9] {B = 2-(1/(it+.00000001))}
// Gerade -> Links
 case [10] {B = 2-(1/(t+.00000001))}
 // Rechts nach gerade
 case [11] {B = log(abs(t+.000001))}
// Gerade nach rechts
 case [12] {B = log(it+.000001)}
 else {B=0}
 } 

x=x*ScaleX*DXF
y=y*ScaleY*DYF
z=z*ScaleZ*DZF

x=x+OffsetX
y=y+OffsetY
z=z+OffsetZ


##############################

Code: [Select]
################################
// Erster Anstieg
################################
  Len=50
  radius = Len/2
  updown=0.5
  angle = 180*updown
 
  var=angle / 180 * pi

// Verschiebt t ein wenig nach links
// so bekommen wir einen schönen Anstieg und Abfall
 s=(t-0.5)*2 

  rad = s * var
  irad=(1-t)*var

  arad=min(rad,irad)
  brad=max(rad,irad)
   
  x = 0
  z = t*radius*2
  y = radius * sin(rad)

  B=0
  VertRoll=0
#######################
Code: [Select]
################################
// Kurviger Anstieg
################################
// Kurviger Anstieg
  Len=50
  radius = Len/2
  updown=0.5
  angle = 180*updown
 
  var=angle / 180 * pi

// Verschiebt t ein wenig nach links
// so bekommen wir einen schönen Anstieg und Abfall
 s=(t-0.5)*2 

  rad = s * var
  irad=(1-t)*var

  arad=min(rad,irad)
  brad=max(rad,irad)
 
  // Form der Kurve hier definieren sin/cos/rad etc.
  x = radius * cos(rad)
  z = t*radius*2
  y = radius * sin(rad)

  B=0
  VertRoll=0
########################

Lift-Hill-Formula

Code: [Select]
// Lift-Hill
BOTTOM_RADIUS = 6
TOP_RADIUS = 6
DEGREES = 35
END_DEGREES = 90
LENGTH = 10

z = 0
b = 0
switch (t) {
    case [ 0, 0.25 ] {
        angle = t * 4 * DEGREES * (pi / 180)
        x = sin(angle) * BOTTOM_RADIUS
        y = -cos(angle) * BOTTOM_RADIUS
    }
    case [ 0.25, 0.75 ] {
        angle = DEGREES * (pi / 180)
        myt = (t - 0.25) * 2
        x = sin(angle) * BOTTOM_RADIUS + (cos(angle) * myt * LENGTH)
        y = -cos(angle) * BOTTOM_RADIUS + (sin(angle) * myt * LENGTH)
    }
    case [ 0.75, 1 ] {
        angle = DEGREES * (pi / 180)
        angle2 = END_DEGREES * (pi / 180)
        x = sin(angle) * BOTTOM_RADIUS + (cos(angle) * LENGTH)
        y = -cos(angle) * BOTTOM_RADIUS + (sin(angle) * LENGTH)
        centerX = x + sin(angle) * TOP_RADIUS
        centerY = y - cos(angle) * TOP_RADIUS
        myt = (t - 0.75) * 4
        x = centerX + sin(pi + angle - angle2 * myt) * TOP_RADIUS
        y = centerY - cos(pi + angle - angle2 * myt) * TOP_RADIUS
    }
}