public static double[] Multiply(vtkLandmarkTransform landMatrix, double[] value) { vtkMatrix4x4 matrix = landMatrix.GetMatrix(); int size = Marshal.SizeOf(typeof(double)) * value.Length; IntPtr pre = Marshal.AllocHGlobal(size); Marshal.Copy(value, 0, pre, value.Length); double[] result = matrix.MultiplyDoublePoint(pre); Marshal.FreeHGlobal(pre); return(result); }
public static double[] Mutiple(vtkMatrix4x4 matrix, double[] value) { value = new double[] { value[0], value[1], value[2], 1 }; int size = Marshal.SizeOf(typeof(double)) * value.Length; IntPtr pre = Marshal.AllocHGlobal(size); Marshal.Copy(value, 0, pre, value.Length); double[] result = matrix.MultiplyDoublePoint(pre); Marshal.FreeHGlobal(pre); return(result); }
public void SetTransform(vtkMatrix4x4 matrix) { vtkTransform transform = vtkTransform.New(); transform.SetMatrix(matrix); //this.lineActor.SetUserTransform(transform); //return; double[] linePoint1 = GetLinePoint1(); double[] linePoint2 = GetLinePoint2(); linePoint1 = xyz1; linePoint2 = xyz2; double[] p1 = matrix.MultiplyDoublePoint(VTKUtil.ConvertTo4P(linePoint1)); double[] p2 = matrix.MultiplyDoublePoint(VTKUtil.ConvertTo4P(linePoint2)); line.SetPoint1(p1[0], p1[1], p1[2]); line.SetPoint2(p2[0], p2[1], p2[2]); }