当前位置: 首页>>代码示例>>C#>>正文


C# Interval.MakeIncreasing方法代码示例

本文整理汇总了C#中Interval.MakeIncreasing方法的典型用法代码示例。如果您正苦于以下问题:C# Interval.MakeIncreasing方法的具体用法?C# Interval.MakeIncreasing怎么用?C# Interval.MakeIncreasing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Interval的用法示例。


在下文中一共展示了Interval.MakeIncreasing方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Trim

    /// <summary>
    /// Constructs a sub-surface that covers the specified UV trimming domain.
    /// </summary>
    /// <param name="u">Domain of surface along U direction to include in the subsurface.</param>
    /// <param name="v">Domain of surface along V direction to include in the subsurface.</param>
    /// <returns>SubSurface on success, null on failure.</returns>
    public Surface Trim(Interval u, Interval v)
    {
      u.MakeIncreasing();
      v.MakeIncreasing();

      if (!u.IsValid || u.IsSingleton)
        return null;
      if (!v.IsValid || v.IsSingleton)
        return null;

      IntPtr ptr = ConstPointer();
      IntPtr pSurface = UnsafeNativeMethods.ON_Surface_Trim(ptr, u, v);
      GeometryBase g = GeometryBase.CreateGeometryHelper(pSurface, null);
      Surface rc = g as Surface;
      return rc;
    }
开发者ID:mennodeij,项目名称:rhinocommon,代码行数:22,代码来源:opennurbs_surface.cs

示例2: GetBox

    /// <summary>
    /// Asks the user to select a Box in the viewport.
    /// </summary>
    /// <param name="box">If the result is Success, this parameter will be filled out.</param>
    /// <param name="mode">A particular "get box" mode, or <see cref="GetBoxMode.All"/>.</param>
    /// <param name="basePoint">Optional base point. Supply Point3d.Unset if you don't want to use this.</param>
    /// <param name="prompt1">Optional first prompt. Supply null to use the default prompt.</param>
    /// <param name="prompt2">Optional second prompt. Supply null to use the default prompt.</param>
    /// <param name="prompt3">Optional third prompt. Supply null to use the default prompt.</param>
    /// <returns>Commands.Result.Success if successful.</returns>
    public static Commands.Result GetBox(out Rhino.Geometry.Box box, GetBoxMode mode, Point3d basePoint, string prompt1, string prompt2, string prompt3)
    {
      Point3d[] corners = new Point3d[8];
      // 19 Feb 2010 S. Baer
      // On Win x64 builds the .NET framework appears to have problems if you don't initialize the array
      // before passing it off to unmanaged code.
      for (int i = 0; i < corners.Length; i++)
        corners[i] = new Point3d();
      Rhino.Commands.Result rc = (Rhino.Commands.Result)UnsafeNativeMethods.RHC_RhinoGetBox(corners, (int)mode, basePoint, prompt1, prompt2, prompt3);

      // David: This code is untested.
      box = new Box();

      if (rc == Rhino.Commands.Result.Success)
      {
        Vector3d x = corners[1] - corners[0];
        Vector3d y = corners[3] - corners[0];
        Vector3d z = corners[4] - corners[0];

        // Create a singular box.
        if (x.IsZero && y.IsZero && z.IsZero)
        {
          box = new Box(new Plane(corners[0], new Vector3d(0, 0, 1)), new Interval(), new Interval(), new Interval());
          return rc;
        }

        // Create a linear box.
        if (x.IsZero && y.IsZero)
        {
          box = new Box(new Plane(corners[0], z), new Interval(), new Interval(), new Interval(0, z.Length));
          return rc;
        }

        // Boxes were getting inverted if the "height" pick was on the negative side of the base plane.
        Plane base_plane = new Plane(corners[0], x, y);
        Point3d C0, C1;
        base_plane.RemapToPlaneSpace(corners[0], out C0);
        base_plane.RemapToPlaneSpace(corners[6], out C1);

        Interval ix = new Interval(C0.X, C1.X); ix.MakeIncreasing();
        Interval iy = new Interval(C0.Y, C1.Y); iy.MakeIncreasing();
        Interval iz = new Interval(C0.Z, C1.Z); iz.MakeIncreasing();

        box = new Box(base_plane, ix, iy, iz);
      }

      return rc;
    }
开发者ID:austinlaw,项目名称:rhinocommon,代码行数:58,代码来源:rhinosdkget.cs


注:本文中的Interval.MakeIncreasing方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。