[vtkusers] IntPtr for ActiViz.Net

zlf jxdw_zlf at yahoo.com.cn
Wed Nov 2 10:21:05 EDT 2011


I ran the code below. It seems that the result is incorrect. I believe x/y/z
should be different from 100/100/100.

Code:
        vtkTransform transform = new vtkTransform();
        transform.Translate(300, 30, 10);
        transform.RotateWXYZ(30, 30, 30, 30);
        transform.Update();

        vtkMatrix4x4 matrix = transform.GetMatrix();

        Console.WriteLine(matrix);

        double[] ZOOT = new double[] { 100, 100, 100 };

        int s = Marshal.SizeOf(ZOOT[0]) * ZOOT.Length;
        System.IntPtr p = Marshal.AllocHGlobal(s);
        Marshal.Copy(ZOOT, 0, p, ZOOT.Length);
        double[] ret = matrix.MultiplyDoublePoint(p);
        Console.WriteLine(string.Format("x:{0} y:{1} z:{2}", ret[0], ret[1],
ret[2]));

Result:
vtkMatrix4x4 (05562FE8)
  Debug: Off
  Modified Time: 15
  Reference Count: 2
  Registered Events: (none)
  Elements:
    0.910684 -0.244017 0.333333 300
    0.333333 0.910684 -0.244017 30
    -0.244017 0.333333 0.910684 10
    0 0 0 1


x:100 y:100 z:100

Thanks

--
View this message in context: http://vtk.1045678.n5.nabble.com/IntPtr-for-ActiViz-Net-tp4759068p4958187.html
Sent from the VTK - Users mailing list archive at Nabble.com.



More information about the vtkusers mailing list