
I have implemented a scene graph in Haskell and I have a problem. I walk down the scenegraph and at each node I recalculate translation matrix and pass it to each child. Well it seems to be causing a stack overflow and I am lost as to how to resolve the issue without issue a state variable of some kind to hold a "matrix stack" as is common in imperative implementations of scene graphs. When I run the program fromghci I get "drawingcamera" "drawingground" "drawinggroundModel" Matrix4x4 {i1j1 = -4.371139e-8, i1j2 = 0.0, i1j3 = 1.0, i1j4 = -3.9999998, i2j1 = 0.0, i2j2 = 1.0, i2j3 = 0.0, i2j4 = -1.5, i3j1 = -1.0, i3j2 = 0.0, i3j3 = -4.3 71139e-8, i3j4 = 3.0, i4j1 = 0.0, i4j2 = 0.0, i4j3 = 0.0, i4j4 = 1.0} "a model" "classic matrix operation" "drawingcarousel" "drawingcarouselbase" "drawingcarouselbaseModel" Matrix4x4 {i1j1 = -4.371139e-8, i1j2 = 1.0, i1j3 = -4.371139e-8, i1j4 = 0.0, i2j 1 = 0.0, i2j2 = -4.371139e-8, i2j3 = -1.0, i2j4 = 0.0, i3j1 = -1.0, i3j2 = -4.37 1139e-8, i3j3 = 1.9106855e-15, i3j4 = -1.0, i4j1 = 0.0, i4j2 = 0.0, i4j3 = 0.0, i4j4 = 1.0} "classic matrix operation" "drawingcarouselRoof" "drawingcarouselRoofModel" Matrix4x4 {i1j1 = -4.371139e-8, i1j2 = 1.0, i1j3 = -4.371139e-8, i1j4 = 0.0, i2j 1 = 0.0, i2j2 = -4.371139e-8, i2j3 = -1.0, i2j4 = 0.3, i3j1 = -1.0, i3j2 = -4.37 1139e-8, i3j3 = 1.9106855e-15, i3j4 = -1.0, i4j1 = 0.0, i4j2 = 0.0, i4j3 = 0.0, i4j4 = 1.0} "classic matrix operation" "drawingcarouselFloor" "drawingcarouselFloorModel" Matrix4x4 {i1j1 = -4.371139e-8, i1j2 = 1.0, i1j3 = -4.371139e-8, i1j4 = 0.0, i2j 1 = 0.0, i2j2 = -4.371139e-8, i2j3 = -1.0, i2j4 = 0.0, i3j1 = -1.0, i3j2 = -4.37 1139e-8, i3j3 = 1.9106855e-15, i3j4 = -1.0, i4j1 = 0.0, i4j2 = 0.0, i4j3 = 0.0, i4j4 = 1.0} "classic matrix operation" "drawingpolls" "drawingpoll1" "drawingpoll1Model" Matrix4x4 {i1j1 = <interactive>: <<loop>> <interactive>: interrupted As you can see there are only a handful of nodes at this point so I am confused as to why it is happening here, any thoughts?

On Thu, Nov 11, 2010 at 4:58 PM, Ben Christy
I have implemented a scene graph in Haskell and I have a problem. I walk down the scenegraph and at each node I recalculate translation matrix and pass it to each child. Well it seems to be causing a stack overflow and I am lost as to how to resolve the issue without issue a state variable of some kind to hold a "matrix stack" as is common in imperative implementations of scene graphs. When I run the program fromghci I get [snip] Matrix4x4 {i1j1 = <interactive>: <<loop>> <interactive>: interrupted
Check the expression for i1j1 - seems like it boils down to "let x = x in x" -- Dmitry Astapov

It was basically that. I was doing TransformedMatrix = TransformedMatrix *
TransformMatrrix
and should have been doing Transformed Matrix = RotatedMatrix *
TransforrmMatrix
On Thu, Nov 11, 2010 at 10:03 AM, Dmitry Astapov
On Thu, Nov 11, 2010 at 4:58 PM, Ben Christy
wrote: I have implemented a scene graph in Haskell and I have a problem. I walk down the scenegraph and at each node I recalculate translation matrix and pass it to each child. Well it seems to be causing a stack overflow and I am lost as to how to resolve the issue without issue a state variable of some kind to hold a "matrix stack" as is common in imperative implementations of scene graphs. When I run the program fromghci I get [snip] Matrix4x4 {i1j1 = <interactive>: <<loop>> <interactive>: interrupted
Check the expression for i1j1 - seems like it boils down to "let x = x in x"
-- Dmitry Astapov
participants (2)
-
Ben Christy
-
Dmitry Astapov