Пример #1
0
        //public MorphControl()
        //{
        //  IntPtr pThis = UnsafeNativeMethods.ON_MorphControl_New(IntPtr.Zero);
        //  this.ConstructNonConstObject(pThis);
        //}

        //public MorphControl(MorphControl other)
        //{
        //  IntPtr pConstOther = other.ConstPointer();
        //  IntPtr pThis = UnsafeNativeMethods.ON_MorphControl_New(pConstOther);
        //  this.ConstructNonConstObject(pThis);
        //}

        /// <summary>
        /// Constructs a MorphControl that allows for morphing between two curves.
        /// </summary>
        /// <param name="originCurve">The origin curve for morphing.</param>
        /// <param name="targetCurve">The target curve for morphing.</param>
        public MorphControl(NurbsCurve originCurve, NurbsCurve targetCurve)
        {
            IntPtr pCurve0 = originCurve.ConstPointer();
            IntPtr pCurve1 = targetCurve.ConstPointer();

            IntPtr pThis = UnsafeNativeMethods.ON_MorphControl_New(IntPtr.Zero);

            ConstructNonConstObject(pThis);
            UnsafeNativeMethods.ON_MorphControl_SetCurves(pThis, pCurve0, pCurve1);
        }
Пример #2
0
        /// <summary>
        /// Finds minimum twist ruling between 2 curves at local domains
        /// </summary>
        /// <param name="rail0">  First rail </param>
        /// <param name="t0">     Seed parameter on first rail </param>
        /// <param name="dom0">   Parameter sub-domain to adjust in on first rail </param>
        /// <param name="rail1">  Second rail </param>
        /// <param name="t1">     Seed parameter on second rail </param>
        /// <param name="dom1">   Parameter sub-domain to adjust in on second rail </param>
        /// <param name="t0_out"> Result ruling on first rail </param>
        /// <param name="t1_out"> Result ruling on second rail </param>
        /// <returns>
        /// -1: Error
        ///  0: Exact non-twisting ruling found between t0_out and t1_out
        ///  1: Ruling found between t0_out and t1_out that has less twist
        ///       the ruling between t0 and t1
        /// </returns>
        /// <since>6.0</since>
        static public int GetLocalDevopableRuling(
            NurbsCurve rail0, double t0, Interval dom0,
            NurbsCurve rail1, double t1, Interval dom1,
            ref double t0_out, ref double t1_out)
        {
            IntPtr r0 = rail0.ConstPointer();
            IntPtr r1 = rail1.ConstPointer();

            return(UnsafeNativeMethods.RHC_RhGetLocalDevopableRuling(r0, t0, dom0, r1, t1, dom1, ref t0_out, ref t1_out));
        }
Пример #3
0
        /// <summary>
        /// Find a ruling from rail0(t0_out) to rail1(t1_out) that has the least twist
        /// across the ruling with t0_out in domain0 and t1_out in domain1.
        /// max_cos_twist is cos(twist) for the returned ruling
        /// </summary>
        /// <param name="rail0"></param>
        /// <param name="t0"></param>
        /// <param name="dom0"></param>
        /// <param name="rail1"></param>
        /// <param name="t1"></param>
        /// <param name="dom1"></param>
        /// <param name="t0_out"></param>
        /// <param name="t1_out"></param>
        /// <param name="cos_twist_out"></param>
        /// <returns></returns>
        /// <since>6.0</since>
        static public bool RulingMinTwist(
            NurbsCurve rail0, double t0, Interval dom0,
            NurbsCurve rail1, double t1, Interval dom1,
            ref double t0_out, ref double t1_out, ref double cos_twist_out
            )
        {
            IntPtr r0 = rail0.ConstPointer();
            IntPtr r1 = rail1.ConstPointer();

            return(UnsafeNativeMethods.RHC_DevRulingMinTwist2(r0, t0, dom0, r1, t1, dom1, ref t0_out, ref t1_out, ref cos_twist_out));
        }
Пример #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="rail0"></param>
        /// <param name="rail1"></param>
        /// <param name="rulings"></param>
        /// <returns></returns>
        static public bool UntwistRulings(NurbsCurve rail0, NurbsCurve rail1, ref IEnumerable <Point2d> rulings)
        {
            bool rc = false;

            Point2d[] ruling_array = rulings.ToArray <Point2d>();
            int       count        = ruling_array.Length;

            if (count > 2)
            {
                IntPtr r0 = rail0.ConstPointer();
                IntPtr r1 = rail1.ConstPointer();

                rc = UnsafeNativeMethods.RHC_DevRulingUntwist(r0, r1, count, ruling_array);
                if (rc)
                {
                    rulings = ruling_array;
                }
            }
            return(rc);
        }