From 0e963ea4bb288db1bfc3b867cec668fde8757ccd Mon Sep 17 00:00:00 2001
From: Raphael Luz <luz@ivt.tugraz.at>
Date: Tue, 9 Apr 2013 11:19:07 +0200
Subject: [PATCH] Release VECTO 1.2 [FIXED] - Fixed error in FC interpolation
 (invalid extrapolation errors caused by rounding errors) - Bugfix: Cycle was
 cut by one second (as usual in Vehicle Mode)

---
 VECTO Changelog.txt   |  6 +++---
 VECTO/MODcalc/cMOD.vb |  2 +-
 VECTO/cDelaunayMap.vb | 21 ++++++++++++---------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/VECTO Changelog.txt b/VECTO Changelog.txt
index eafc789ccc..63b8440298 100644
--- a/VECTO Changelog.txt	
+++ b/VECTO Changelog.txt	
@@ -2,12 +2,12 @@ VECTO ?.? (future release)
 - Eco-Roll & Over-/Under-Speed
 - Gearbox Rules must be set when loading .gbx file to aviod invalid settings (e.g. AT with Skip Gears)
 
-VECTO 1.1 x (current source - next release)
-
+VECTO 1.2 x (current source - next release)
 
 VECTO 1.2
 - Bugfix: When opening the Gearbox Editor the Gear Shift Settings (e.g. Skip Gears) were not valid for MT
-
+- Fixed error in FC interpolation (invalid extrapolation errors caused by rounding errors)
+- Bugfix: Cycle was cut by one second (as usual in Vehicle Mode)
 
 VECTO 1.1 beta 4
 - Engine Start/Stop implemented
diff --git a/VECTO/MODcalc/cMOD.vb b/VECTO/MODcalc/cMOD.vb
index bef66ad4b7..32ed16c3be 100644
--- a/VECTO/MODcalc/cMOD.vb
+++ b/VECTO/MODcalc/cMOD.vb
@@ -270,7 +270,7 @@ Public Class cMOD
         Dim L As List(Of Double)
 
         'Zykluslänge definieren: Gleiche Länge wie Zyklus (nicht reduziert weil keine "Zwischensekunden") |@@| Define Cycle-length: Same length as Cycle (not reduced because no "interim seconds")
-        tDim = DRI.tDim - 1
+        tDim = DRI.tDim
 
         'Here the actual cycle is read:
         Vh.EngCylceInit()
diff --git a/VECTO/cDelaunayMap.vb b/VECTO/cDelaunayMap.vb
index c68f02e3cd..e30874864a 100644
--- a/VECTO/cDelaunayMap.vb
+++ b/VECTO/cDelaunayMap.vb
@@ -48,14 +48,17 @@ Public Class cDelaunayMap
 
 
 
-        '#If DEBUG Then
-        '        Debug.Print("x,y,z,x,y,z")
-        '        For Each tr In lDT
-        '            Debug.Print(tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z)
-        '            Debug.Print(tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z)
-        '            Debug.Print(tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z)
-        '        Next
-        '#End If
+#If DEBUG Then
+        Dim i As Int16
+        Debug.Print("#,x1,y1,z1,x2,y2,z2")
+        i = -1
+        For Each tr In lDT
+            i += 1
+            Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z)
+            Debug.Print(i & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z & "," & tr.P2.X & "," & tr.P2.Y & "," & tr.P2.Z)
+            Debug.Print(i & "," & tr.P1.X & "," & tr.P1.Y & "," & tr.P1.Z & "," & tr.P3.X & "," & tr.P3.Y & "," & tr.P3.Z)
+        Next
+#End If
 
 
 
@@ -216,7 +219,7 @@ Public Class cDelaunayMap
         v = (dot00 * dot12 - dot01 * dot02) * invDenom
 
         ' Check if point is in triangle
-        Return (u >= 0) And (v >= 0) And (u + v <= 1.00000000001)
+        Return (u >= -0.000001) And (v >= -0.000001) And (u + v <= 1.000001)
 
     End Function
 
-- 
GitLab