Hi Mistrel,
I am still experimenting with math capabilities in PureGDK.
I am not sure if this is a problem between the chair and the keyboard (ME)
, or if this is indeed a problem in PureGDK.
The problem is with the dbHermiteVector functions. (vector 2, 3, and 4)
In dbPro, the result is a vector of the same type as the inputs.
In pureGDK, the result is documented to be a matrix4.
I have tried both ways, and get the same error regardless.
The error is...
Quote: "Invalid Memory Access. (write error at address 0)"
Below is the code. It is obviously just an experiment with built in interpolation functions.
If I am simply doing something wrong (which is likely), advice is appreciated. Or perhaps I found a bug.
Thanks,
Dave
screenWidth.i = 800
screenHeight.i = 600
OpenWindow(0, 0, 0, screenWidth, screenHeight, \"PureGDK Project\", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
hDBWnd = OpenDBWnd(WindowID(0), 0, 0, screenWidth, screenHeight)
dbSyncRate(60)
Define p1.v2
Define p2.v2
Define p3.v2
Define p4.v2
Define pR.v2
Define pM.m4
Procedure linearInterpolate(*pR.v2, *p1.v2, *p2.v2, subD.i)
For x.i = 1 To subD
s.f = x/subD
dbLinearInterpolateVector2(*pR, *p1, *p2, s)
dbDot(*pR\\x, *pR\\y)
Next x
EndProcedure
Procedure catmullRomInterpolate(*pR.v2, *p1.v2, *p2.v2, *p3.v2, *p4.v2, subD.i)
For x.i = 1 To subD
s.f = x/subD
dbCatmullRomVector2(*pR, *p1, *p2, *p3, *p4, s)
dbDot(*pR\\x, *pR\\y)
Next x
EndProcedure
Procedure hermiteInterpolateV(*pR.v2, *p1.v2, *p2.v2, *p3.v2, *p4.v2, subD.i)
For x.i = 1 To subD
s.f = x/subD
dbHermiteVector2(*pR, *p1, *p2, *p3, *p4, s)
dbDot(*pR\\x, *pR\\y)
Next x
EndProcedure
Procedure hermiteInterpolateM(*pM.m4, *p1.v2, *p2.v2, *p3.v2, *p4.v2, subD.i)
For x.i = 1 To subD
s.f = x/subD
dbHermiteVector2(*pM, *p1, *p2, *p3, *p4, s)
dbDot(*pM\\x1, *pM\\y1)
Next x
EndProcedure
p1.v2\\x = 100
p1.v2\\y = 100
p2.v2\\x = 300
p2.v2\\y = 100
p3.v2\\x = 500
p3.v2\\y = 500
p4.v2\\x = 700
p4.v2\\y = 500
dbDot(p1.v2\\x, p1.v2\\y)
dbDot(p2.v2\\x, p2.v2\\y)
dbDot(p3.v2\\x, p3.v2\\y)
dbDot(p4.v2\\x, p4.v2\\y)
subD.i = 100
linearInterpolate(@pR.v2, @p1.v2, @p2.v2, subD)
; catmullRomInterpolate(@pR.v2, @p1.v2, @p2.v2, @p3.v2, @p4.v2, subD.i)
hermiteInterpolateV(@pM.m4, @p1.v2, @p2.v2, @p3.v2, @p4.v2, subD.i)
; hermiteInterpolateM(@pM.m4, @p1.v2, @p2.v2, @p3.v2, @p4.v2, subD.i)
linearInterpolate(@pR.v2, @p3.v2, @p4.v2, subD)
Repeat
If dbEscapeKey() = 1 Or WaitWindowEvent(1) = #PB_Event_CloseWindow
Break
EndIf
dbSync()
ForEver
End