Ejemplo n.º 1
0
 /// <summary>
 /// Makes adjustments to the ends of one or both input curves so that they meet at a point.
 /// </summary>
 /// <param name="curveA">1st curve to adjust.</param>
 /// <param name="adjustStartCurveA">
 /// Which end of the 1st curve to adjust: true is start, false is end.
 /// </param>
 /// <param name="curveB">2nd curve to adjust.</param>
 /// <param name="adjustStartCurveB">
 /// which end of the 2nd curve to adjust true==start, false==end.
 /// </param>
 /// <returns>true on success.</returns>
 public static bool MakeEndsMeet(Curve curveA, bool adjustStartCurveA, Curve curveB, bool adjustStartCurveB)
 {
   IntPtr pCurveA = curveA.NonConstPointer();
   IntPtr pCurveB = curveB.NonConstPointer();
   return UnsafeNativeMethods.RHC_RhinoMakeCurveEndsMeet(pCurveA, adjustStartCurveA, pCurveB, adjustStartCurveB);
 }
Ejemplo n.º 2
0
    /// <summary>
    /// Only for developers who are defining custom subclasses of CurveObject.
    /// Directly sets the internal curve geometry for this object.  Note that
    /// this function does not work with Rhino's "undo".
    /// </summary>
    /// <param name="curve"></param>
    /// <returns>
    /// The old curve geometry that was set for this object
    /// </returns>
    /// <remarks>
    /// Note that this function does not work with Rhino's "undo".  The typical
    /// approach for adjusting the curve geometry is to modify the object that you
    /// get when you call the CurveGeometry property and then call CommitChanges.
    /// </remarks>
    protected Curve SetCurve(Curve curve)
    {
      var parent = curve.ParentRhinoObject();
      if (parent != null && parent.RuntimeSerialNumber == this.RuntimeSerialNumber)
        return curve;

      IntPtr pThis = this.NonConstPointer_I_KnowWhatImDoing();

      IntPtr pCurve = curve.NonConstPointer();
      IntPtr pOldCurve = UnsafeNativeMethods.CRhinoCurveObject_SetCurve(pThis, pCurve);
      curve.ChangeToConstObject(this);
      if (pOldCurve != pCurve && pOldCurve != IntPtr.Zero)
        return new Curve(pOldCurve, null);
      return curve;
    }