Ejemplo n.º 1
0
    /// <summary>
    /// Create a Blend curve between two existing curves.
    /// </summary>
    /// <param name="curveA">Curve to blend from (blending will occur at curve end point).</param>
    /// <param name="curveB">Curve to blend to (blending will occur at curve start point).</param>
    /// <param name="continuity">Continuity of blend.</param>
    /// <param name="bulgeA">Bulge factor at curveA end of blend. Values near 1.0 work best.</param>
    /// <param name="bulgeB">Bulge factor at curveB end of blend. Values near 1.0 work best.</param>
    /// <returns>A curve representing the blend between A and B or null on failure.</returns>
    public static Curve CreateBlendCurve(Curve curveA, Curve curveB, BlendContinuity continuity, double bulgeA, double bulgeB)
    {
      if (curveA == null) throw new ArgumentNullException("curveA");
      if (curveB == null) throw new ArgumentNullException("curveB");

      IntPtr pCurveA = curveA.ConstPointer();
      IntPtr pCurveB = curveB.ConstPointer();

      switch (continuity)
      {
        case BlendContinuity.Position:
          return new LineCurve(curveA.PointAtEnd, curveB.PointAtStart);

        case BlendContinuity.Tangency:
          IntPtr pG1Curve = UnsafeNativeMethods.RHC_RhinoBlendG1Curve(pCurveA, pCurveB, bulgeA, bulgeB);
          return GeometryBase.CreateGeometryHelper(pG1Curve, null) as Curve;

        case BlendContinuity.Curvature:
          IntPtr pG2Curve = UnsafeNativeMethods.RHC_RhinoBlendG2Curve(pCurveA, pCurveB, bulgeA, bulgeB);
          return GeometryBase.CreateGeometryHelper(pG2Curve, null) as Curve;
      }

      return null;
    }
Ejemplo n.º 2
0
 /// <summary>
 /// Makes a curve blend between 2 curves at the parameters specified
 /// with the directions and continuities specified
 /// </summary>
 /// <param name="curve0">First curve to blend from</param>
 /// <param name="t0">Parameter on first curve for blend endpoint</param>
 /// <param name="reverse0">
 /// If false, the blend will go in the natural direction of the curve.
 /// If true, the blend will go in the opposite direction to the curve
 /// </param>
 /// <param name="continuity0">continuity for the blend at the start</param>
 /// <param name="curve1">Second curve to blend from</param>
 /// <param name="t1">Parameter on second curve for blend endpoint</param>
 /// <param name="reverse1">
 /// If false, the blend will go in the natural direction of the curve.
 /// If true, the blend will go in the opposite direction to the curve
 /// </param>
 /// <param name="continuity1">continuity for the blend at the end</param>
 /// <returns>the blend curve on success. null on failure</returns>
 public static Curve CreateBlendCurve(Curve curve0, double t0, bool reverse0, BlendContinuity continuity0,
                                      Curve curve1, double t1, bool reverse1, BlendContinuity continuity1)
 {
   IntPtr pConstCurve0 = curve0.ConstPointer();
   IntPtr pConstCurve1 = curve1.ConstPointer();
   IntPtr pCurve = UnsafeNativeMethods.CRhinoBlend_CurveBlend(pConstCurve0, t0, reverse0, (int)continuity0, pConstCurve1, t1, reverse1, (int)continuity1);
   return GeometryBase.CreateGeometryHelper(pCurve, null) as Curve;
 }
Ejemplo n.º 3
0
 /// <summary>
 /// Create a Blend curve between two existing curves.
 /// </summary>
 /// <param name="curveA">Curve to blend from (blending will occur at curve end point).</param>
 /// <param name="curveB">Curve to blend to (blending will occur at curve start point).</param>
 /// <param name="continuity">Continuity of blend.</param>
 /// <returns>A curve representing the blend between A and B or null on failure.</returns>
 public static Curve CreateBlendCurve(Curve curveA, Curve curveB, BlendContinuity continuity)
 {
   return CreateBlendCurve(curveA, curveB, continuity, 1, 1);
 }