예제 #1
0
 internal static HandleRef getCPtr(SplineObject obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
        static void OrientObject(SplineObject op, int plane, bool reverse)
        {
            // double3 padr = op.GetPointW();
            // Tangent hadr = op.GetTangentW(), h;
            int nPoints = op.GetPointCount();
            int i;

            bool bTangents = op.GetTangentCount()!= 0;

            if (plane >= 1)
            {
                switch (plane)
                {
                    case 1: // ZY
                        for (i = 0; i < nPoints; i++)
                        {
                            double3 v  = op.GetPointAt(i);
                            op.SetPointAt(i, new double3(-v.z, v.y, v.x));
                            if (!bTangents) continue;
                            Tangent t = op.GetTangentAt(i);
                            Tangent t2 = new Tangent();
                            t2.vl = new double3(-t.vl.z, t.vl.y, t.vl.x);
                            t2.vr = new double3(-t.vr.z, t.vr.y, t.vr.x);
                            op.SetTangentAt(i, t2);
                        }
                        break;

                    case 2: // XZ
                        for (i = 0; i < nPoints; i++)
                        {
                            double3 v = op.GetPointAt(i);
                            op.SetPointAt(i, new double3(v.x, -v.z, v.y));
                            if (!bTangents) continue;
                            Tangent t = op.GetTangentAt(i);
                            Tangent t2 = new Tangent();
                            t2.vl = new double3(t.vl.x, -t.vl.z, t.vl.y);
                            t2.vr = new double3(t.vr.x, -t.vr.z, t.vr.y);
                            op.SetTangentAt(i, t2);
                        }
                        break;
                }
            }

            if (reverse)
            {
                double3 p;
                int to = nPoints / 2;
                if ((nPoints % 2) != 0)
                    to++;
                for (i = 0; i < to; i++)
                {
                    p = op.GetPointAt(i);
                    op.SetPointAt(i, op.GetPointAt(nPoints - 1 - i));
                    op.SetPointAt(nPoints-1-i, p);
                    if (!bTangents)
                        continue;
                    Tangent h1 = op.GetTangentAt(i);
                    Tangent h2 = op.GetTangentAt(nPoints-1-i);
                    Tangent hTmp1 = new Tangent();
                    Tangent hTmp2 = new Tangent();
                    hTmp1.vl = new double3(h2.vr);
                    hTmp1.vr = new double3(h2.vl);
                    hTmp2.vl = new double3(h1.vr);
                    hTmp2.vr = new double3(h1.vl);
                    op.SetTangentAt(i, hTmp1);
                    op.SetTangentAt(nPoints-1-i, hTmp2);
                }
            }

            op.Message(C4dApi.MSG_UPDATE);
        }
예제 #3
0
 public bool Init(SplineObject op, int segment) {
   bool ret = C4dApiPINVOKE.SplineLengthData_Init__SWIG_1(swigCPtr, SplineObject.getCPtr(op), segment);
   return ret;
 }
예제 #4
0
 public bool Init(SplineObject op) {
   bool ret = C4dApiPINVOKE.SplineLengthData_Init__SWIG_2(swigCPtr, SplineObject.getCPtr(op));
   return ret;
 }
예제 #5
0
 public bool Init(SplineObject op, int segment, ref Fusee.Math.Core.Vector3D /* Vector*&_cstype */ padr) {
   bool ret = C4dApiPINVOKE.SplineLengthData_Init__SWIG_0(swigCPtr, SplineObject.getCPtr(op), segment, ref padr /* Vector*&_csin */);
   return ret;
 }