Ejemplo n.º 1
0
 /// <summary>
 /// Converts a <see cref="Fusee.Math.Core.double4x4"/> to an Array of double values in the somewhat awkward Cinema 4D Matrix layout.
 /// This is a 3 rows, 4 columns matrix stored as column vectors with the "offset" vector first (although internally the C4D Matrix arithmetics
 /// is rather row major order oriented). Anyway, the layout of the resulting array will be [m14, m24, m34, m11, m21, m31, m12, m22, m32, m13, m23, m33].
 /// The "projection part" of the original 4x4 matrix is ignored.
 /// </summary>
 /// <param name="value">The matrix value to convert.</param>
 /// <returns>A double array containing 12 double values in the Cinema 4D matrix layout described above.</returns>
 public static double[] double4x4ToArrayDoubleC4DLayout(Fusee.Math.Core.double4x4 value)
 {
     return(new double[] { value.M14, value.M24, value.M34,
                           value.M11, value.M21, value.M31,
                           value.M12, value.M22, value.M32,
                           value.M13, value.M23, value.M33 });
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Converts a <see cref="Fusee.Math.Core.double4x4"/> to an Array of floats. The row major order storage of the
 /// original matrix is kept. This way the returned array can be used in environments taking row major order matrices
 /// (e.g. OpenGL). Use ToArray[]ColOrder for converting the original matrix to environments taking column major order
 /// matrices (like e.g. DirectX).
 /// </summary>
 /// <param name="value">The matrix value to convert.</param>
 /// <returns>A float array containing 16 values in row major order [m11, m12, m13, ...].</returns>
 public static float[] double4x4ToArrayFloatRowOrder(Fusee.Math.Core.double4x4 value)
 {
     return(new float[] { (float)value.M11, (float)value.M12, (float)value.M13, (float)value.M14,
                          (float)value.M21, (float)value.M22, (float)value.M23, (float)value.M24,
                          (float)value.M31, (float)value.M32, (float)value.M33, (float)value.M34,
                          (float)value.M41, (float)value.M42, (float)value.M43, (float)value.M44 });
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Converts a <see cref="Fusee.Math.Core.double4x4"/> to an Array of double values. The row major order storage of the
 /// original matrix is converted to column major order (the matrix is transposed before exporting it to an Array).
 /// This way the returned array can be used in environments taking column major order
 /// matrices (like e.g. DirectX). Use ToArray[]RowOrder for converting the original matrix to environments taking
 /// row major order matrices (e.g. OpenGL).
 /// </summary>
 /// <param name="value">The matrix value to convert.</param>
 /// <returns>A double array containing 16 values in column major order [m11, m21, m31, ...].</returns>
 public static double[] double4x4ToArrayDoubleColOrder(Fusee.Math.Core.double4x4 value)
 {
     return(new double[] { value.M11, value.M21, value.M31, value.M41,
                           value.M12, value.M22, value.M32, value.M42,
                           value.M13, value.M23, value.M33, value.M43,
                           value.M14, value.M24, value.M34, value.M44 });
 }
Ejemplo n.º 4
0
 public void SetMatrix(ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ v)
 {
     double[] adbl_v;
     unsafe { adbl_v = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(v);    fixed(double *pdbl_v = adbl_v)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      C4dApiPINVOKE.GeData_SetMatrix(swigCPtr, (global::System.IntPtr)pdbl_v /* constMatrix&_csin */);
                  } finally {
                      // NOP v = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_v);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 5
0
 public void SetMatrix_Matrix(BaseObject op, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mg, int zoffset)
 {
     double[] adbl_mg;
     unsafe { adbl_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mg);    fixed(double *pdbl_mg = adbl_mg)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      C4dApiPINVOKE.BaseDraw_SetMatrix_Matrix__SWIG_1(swigCPtr, BaseObject.getCPtr(op), (global::System.IntPtr)pdbl_mg /* constMatrix&_csin */, zoffset);
                  } finally {
                      // NOP mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mg);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 6
0
 public virtual void GetModelingAxis(BaseObject op, BaseDocument doc, ref Fusee.Math.Core.double4x4 /* Matrix*&_cstype */ axis)
 {
     double[] adbl_axis;
     unsafe { adbl_axis = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(axis);    fixed(double *pdbl_axis = adbl_axis)
              {
                  /* Matrix*&_csin_pre */
                  try {
                      C4dApiPINVOKE.ObjectData_GetModelingAxis(swigCPtr, BaseObject.getCPtr(op), BaseDocument.getCPtr(doc), (global::System.IntPtr)pdbl_axis /* Matrix*&_csin */);
                  } finally {
                      axis = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_axis);
                      /* Matrix*&_csin_post */
                  }
              }
     } /* Matrix*&_csin_terminator */
 }
Ejemplo n.º 7
0
        } /* </constMatrix&_csout> */

        public void SetModelingAxis(ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ m)
        {
            double[] adbl_m;
            unsafe { adbl_m = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(m);    fixed(double *pdbl_m = adbl_m)
                     {
                         /* constMatrix&_csin_pre */
                         try {
                             C4dApiPINVOKE.BaseObject_SetModelingAxis(swigCPtr, (global::System.IntPtr)pdbl_m /* constMatrix&_csin */);
                         } finally {
                             // NOP m = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_m);
                             /* constMatrix&_csin_post */
                         }
                     }
            } /* constMatrix&_csin_terminator */
        }
Ejemplo n.º 8
0
 public void DrawBox(ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ m, double size, Fusee.Math.Core.double3 /* constVector&_cstype */ col, bool wire)
 {
     double[] adbl_m;
     unsafe { adbl_m = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(m);    fixed(double *pdbl_m = adbl_m)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      C4dApiPINVOKE.BaseDraw_DrawBox(swigCPtr, (global::System.IntPtr)pdbl_m /* constMatrix&_csin */, size, ref col /* constVector&_csin */, wire);
                  } finally {
                      // NOP m = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_m);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 9
0
 public void InitView(BaseContainer camera, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ op_m, double sv, double pix_x, double pix_y, bool fitview)
 {
     double[] adbl_op_m;
     unsafe { adbl_op_m = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(op_m);    fixed(double *pdbl_op_m = adbl_op_m)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      C4dApiPINVOKE.BaseDraw_InitView(swigCPtr, BaseContainer.getCPtr(camera), (global::System.IntPtr)pdbl_op_m /* constMatrix&_csin */, sv, pix_x, pix_y, fitview);
                  } finally {
                      // NOP op_m = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_op_m);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 10
0
        } /* </constMatrix&_csout> */

        public void SetMg(ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mg)
        {
            double[] adbl_mg;
            unsafe { adbl_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mg);    fixed(double *pdbl_mg = adbl_mg)
                     {
                         /* constMatrix&_csin_pre */
                         try {
                             C4dApiPINVOKE.BaseDrawHelp_SetMg(swigCPtr, (global::System.IntPtr)pdbl_mg /* constMatrix&_csin */);
                         } finally {
                             // NOP mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mg);
                             /* constMatrix&_csin_post */
                         }
                     }
            } /* constMatrix&_csin_terminator */
        }
Ejemplo n.º 11
0
 public bool SetMatrix(ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ m, GvRun r)
 {
     double[] adbl_m;
     unsafe { adbl_m = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(m);    fixed(double *pdbl_m = adbl_m)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      bool ret = C4dApiPINVOKE.GvPort_SetMatrix(swigCPtr, (global::System.IntPtr)pdbl_m /* constMatrix&_csin */, GvRun.getCPtr(r));
                      return(ret);
                  } finally {
                      // NOP m = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_m);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 12
0
 public bool ReadMatrix(ref Fusee.Math.Core.double4x4 /* Matrix*&_cstype */ v)
 {
     double[] adbl_v;
     unsafe { adbl_v = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(v);    fixed(double *pdbl_v = adbl_v)
              {
                  /* Matrix*&_csin_pre */
                  try {
                      bool ret = C4dApiPINVOKE.HyperFile_ReadMatrix(swigCPtr, (global::System.IntPtr)pdbl_v /* Matrix*&_csin */);
                      return(ret);
                  } finally {
                      v = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_v);
                      /* Matrix*&_csin_post */
                  }
              }
     } /* Matrix*&_csin_terminator */
 }
Ejemplo n.º 13
0
 public virtual bool Do(SWIGTYPE_p_void data, BaseObject op, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mg, bool controlobject)
 {
     double[] adbl_mg;
     unsafe { adbl_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mg);    fixed(double *pdbl_mg = adbl_mg)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      bool ret = C4dApiPINVOKE.Hierarchy_Do(swigCPtr, SWIGTYPE_p_void.getCPtr(data), BaseObject.getCPtr(op), (global::System.IntPtr)pdbl_mg /* constMatrix&_csin */, controlobject);
                      return(ret);
                  } finally {
                      // NOP mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mg);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 14
0
        /// <summary>
        /// Copys a <see cref="Fusee.Math.Core.double4x4"/> to an existing array of double values in the somewhat awkward Cinema 4D Matrix layout.
        /// This is a 3 rows, 4 columns matrix stored as column vectors with the "offset" vector first (although internally the C4D Matrix arithmetics
        /// is rather row major order oriented). Anyway, the layout of the resulting array will be [m14, m24, m34, m11, m21, m31, m12, m22, m32, m13, m23, m33].
        /// The "projection part" of the original 4x4 matrix is ignored.
        /// </summary>
        /// <param name="value">The matrix value to convert.</param>
        /// <param name="pDst">The destination pointer to write the matrix values to.</param>
        /// <returns>A double array containing 12 double values in the Cinema 4D matrix layout described above.</returns>
        public static unsafe void double4x4ToArrayDoubleC4DLayout(Fusee.Math.Core.double4x4 value, double *pDst)
        {
            pDst[0] = value.M14;
            pDst[1] = value.M24;
            pDst[2] = value.M34;

            pDst[3] = value.M11;
            pDst[4] = value.M21;
            pDst[5] = value.M31;

            pDst[6] = value.M12;
            pDst[7] = value.M22;
            pDst[8] = value.M32;

            pDst[9]  = value.M13;
            pDst[10] = value.M23;
            pDst[11] = value.M33;
        }
Ejemplo n.º 15
0
        } /* <Vector_csout> */

        public Fusee.Math.Core.double4x4 /* Matrix_cstype */ GetMatrix(int id, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ preset)
        {
            double[] adbl_preset;
            unsafe { adbl_preset = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(preset);    fixed(double *pdbl_preset = adbl_preset)
                     {
                         /* constMatrix&_csin_pre */
                         try  {/* <Matrix_csout> */
                             C34M ret_c34m = C4dApiPINVOKE.BaseContainer_GetMatrix__SWIG_0(swigCPtr, id, (global::System.IntPtr)pdbl_preset /* constMatrix&_csin */);
                             Fusee.Math.Core.double4x4 ret;
                             unsafe { ret = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(ret_c34m.m); }
                             return(ret);
                         } /* </Matrix_csout> */ finally {
                             // NOP preset = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_preset);
                             /* constMatrix&_csin_post */
                         }
                     }
            } /* constMatrix&_csin_terminator */
        }
Ejemplo n.º 16
0
 public void GetBone(ref Fusee.Math.Core.double4x4 /* Matrix*&_cstype */ m, SWIGTYPE_p_Float len)
 {
     double[] adbl_m;
     unsafe { adbl_m = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(m);    fixed(double *pdbl_m = adbl_m)
              {
                  /* Matrix*&_csin_pre */
                  try {
                      C4dApiPINVOKE.CAJointObject_GetBone(swigCPtr, (global::System.IntPtr)pdbl_m /* Matrix*&_csin */, SWIGTYPE_p_Float.getCPtr(len));
                      if (C4dApiPINVOKE.SWIGPendingException.Pending)
                      {
                          throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
                      }
                  } finally {
                      m = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_m);
                      /* Matrix*&_csin_post */
                  }
              }
     } /* Matrix*&_csin_terminator */
 }
Ejemplo n.º 17
0
 public virtual bool ModifyObject(BaseObject mod, BaseDocument doc, BaseObject op, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ op_mg, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mod_mg, double lod, int flags, BaseThread thread)
 {
     double[] adbl_op_mg;
     unsafe { adbl_op_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(op_mg);    fixed(double *pdbl_op_mg = adbl_op_mg)
              {
                  /* constMatrix&_csin_pre */
                  double[] adbl_mod_mg;
                  unsafe { adbl_mod_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mod_mg);    fixed(double *pdbl_mod_mg = adbl_mod_mg)
                           {
                               /* constMatrix&_csin_pre */
                               try {
                                   bool ret = C4dApiPINVOKE.ObjectData_ModifyObject(swigCPtr, BaseObject.getCPtr(mod), BaseDocument.getCPtr(doc), BaseObject.getCPtr(op), (global::System.IntPtr)pdbl_op_mg /* constMatrix&_csin */, (global::System.IntPtr)pdbl_mod_mg /* constMatrix&_csin */, lod, flags, BaseThread.getCPtr(thread));
                                   return(ret);
                               } finally {
                                   // NOP op_mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_op_mg);
                                   /* constMatrix&_csin_post */
                                   // NOP mod_mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mod_mg);
                                   /* constMatrix&_csin_post */
                               }
                           }
                  } /* constMatrix&_csin_terminator */
              }
     }              /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 18
0
 public Fusee.Math.Core.double3 /* Vector_cstype_out */ CalculateNewPosition(BaseDraw bd, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mg, Fusee.Math.Core.double3 /* constVector&_cstype */ mouse_pos)
 {
     double[] adbl_mg;
     unsafe { adbl_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mg);    fixed(double *pdbl_mg = adbl_mg)
              {
                  /* constMatrix&_csin_pre */
                  try  {/* <Vector_csout> */
                      Fusee.Math.Core.double3 ret = C4dApiPINVOKE.HandleInfo_CalculateNewPosition(swigCPtr, BaseDraw.getCPtr(bd), (global::System.IntPtr)pdbl_mg /* constMatrix&_csin */, ref mouse_pos /* constVector&_csin */);
                      return(ret);
                  } /* <Vector_csout> */ finally {
                      // NOP mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mg);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 19
0
 public virtual bool GetModifiedObjects(BaseTag tag, BaseDocument doc, SWIGTYPE_p_p_BaseObject op, SWIGTYPE_p_Bool pluginownedop, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ op_mg, double lod, int flags, BaseThread thread)
 {
     double[] adbl_op_mg;
     unsafe { adbl_op_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(op_mg);    fixed(double *pdbl_op_mg = adbl_op_mg)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      bool ret = C4dApiPINVOKE.TagData_GetModifiedObjects(swigCPtr, BaseTag.getCPtr(tag), BaseDocument.getCPtr(doc), SWIGTYPE_p_p_BaseObject.getCPtr(op), SWIGTYPE_p_Bool.getCPtr(pluginownedop), (global::System.IntPtr)pdbl_op_mg /* constMatrix&_csin */, lod, flags, BaseThread.getCPtr(thread));
                      if (C4dApiPINVOKE.SWIGPendingException.Pending)
                      {
                          throw C4dApiPINVOKE.SWIGPendingException.Retrieve();
                      }
                      return(ret);
                  } finally {
                      // NOP op_mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_op_mg);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }
Ejemplo n.º 20
0
 public bool TestClipping3D(Fusee.Math.Core.double3 /* constVector&_cstype */ mp, Fusee.Math.Core.double3 /* constVector&_cstype */ rad, ref Fusee.Math.Core.double4x4 /* constMatrix&_cstype */ mg, SWIGTYPE_p_Bool clip2d, SWIGTYPE_p_Bool clipz)
 {
     double[] adbl_mg;
     unsafe { adbl_mg = Fusee.Math.ArrayConvert.double4x4ToArrayDoubleC4DLayout(mg);    fixed(double *pdbl_mg = adbl_mg)
              {
                  /* constMatrix&_csin_pre */
                  try {
                      bool ret = C4dApiPINVOKE.BaseView_TestClipping3D(swigCPtr, ref mp /* constVector&_csin */, ref rad /* constVector&_csin */, (global::System.IntPtr)pdbl_mg /* constMatrix&_csin */, SWIGTYPE_p_Bool.getCPtr(clip2d), SWIGTYPE_p_Bool.getCPtr(clipz));
                      return(ret);
                  } finally {
                      // NOP mg = Fusee.Math.ArrayConvert.ArrayDoubleC4DLayoutTodouble4x4(pdbl_mg);
                      /* constMatrix&_csin_post */
                  }
              }
     } /* constMatrix&_csin_terminator */
 }