コード例 #1
0
        /// <summary>
        /// Constructs a new NURBS surfaces from torus data.
        /// </summary>
        /// <param name="torus">A torus value.</param>
        /// <returns>A new NURBS surface, or null on error.</returns>
        public static NurbsSurface CreateFromTorus(Torus torus)
        {
            IntPtr pNurbsSurface = UnsafeNativeMethods.ON_Torus_GetNurbForm(ref torus);

            if (IntPtr.Zero == pNurbsSurface)
            {
                return(null);
            }
            return(new NurbsSurface(pNurbsSurface, null));
        }
コード例 #2
0
        /// <summary>
        /// Constructs a new surface of revolution from the values of a torus.
        /// </summary>
        /// <param name="torus">A torus.</param>
        /// <returns>A new surface of revolution, or null if any of the inputs is invalid or on error.</returns>
        /// <since>5.0</since>
        public static RevSurface CreateFromTorus(Torus torus)
        {
            IntPtr pRevSurface = UnsafeNativeMethods.ON_Torus_RevSurfaceForm(ref torus);

            if (IntPtr.Zero == pRevSurface)
            {
                return(null);
            }
            return(new RevSurface(pRevSurface, null));
        }
コード例 #3
0
ファイル: ex_addtorus.cs プロジェクト: austinlaw/rhinocommon
  public static Rhino.Commands.Result AddTorus(Rhino.RhinoDoc doc)
  {
    double major_radius = 4.0;
    double minor_radius = 2.0;

    Rhino.Geometry.Plane plane = Rhino.Geometry.Plane.WorldXY;
    Rhino.Geometry.Torus torus = new Rhino.Geometry.Torus(plane, major_radius, minor_radius);
    Rhino.Geometry.RevSurface revsrf = torus.ToRevSurface();
    if (doc.Objects.AddSurface(revsrf) != Guid.Empty)
    {
      doc.Views.Redraw();
      return Rhino.Commands.Result.Success;
    }
    return Rhino.Commands.Result.Failure;
  }
コード例 #4
0
    public static Rhino.Commands.Result AddTorus(Rhino.RhinoDoc doc)
    {
        const double major_radius = 4.0;
        const double minor_radius = 2.0;

        Rhino.Geometry.Plane      plane  = Rhino.Geometry.Plane.WorldXY;
        Rhino.Geometry.Torus      torus  = new Rhino.Geometry.Torus(plane, major_radius, minor_radius);
        Rhino.Geometry.RevSurface revsrf = torus.ToRevSurface();
        if (doc.Objects.AddSurface(revsrf) != Guid.Empty)
        {
            doc.Views.Redraw();
            return(Rhino.Commands.Result.Success);
        }
        return(Rhino.Commands.Result.Failure);
    }
コード例 #5
0
 /// <summary>Tests a surface to see if it is a portion of a torus and returns the torus.</summary>
 /// <param name="torus">On success, the torus parameters are filled in.</param>
 /// <param name="tolerance">tolerance to use when checking.</param>
 /// <returns>true if the surface is a portion of a torus.</returns>
 public bool TryGetTorus(out Torus torus, double tolerance)
 {
   torus = new Torus();
   IntPtr pThis = ConstPointer();
   return UnsafeNativeMethods.ON_Surface_IsTorus(pThis, ref torus, tolerance, true);
 }
コード例 #6
0
 /// <summary>Tests a surface to see if it is a portion of a torus within RhinoMath.ZeroTolerance and returns the torus.</summary>
 /// <param name="torus">On success, the torus parameters are filled in.</param>
 /// <returns>true if the surface is a portion of a torus.</returns>
 public bool TryGetTorus(out Torus torus)
 {
   return TryGetTorus(out torus, RhinoMath.ZeroTolerance);
 }
コード例 #7
0
 /// <summary>Determines if the surface is a portion of a torus within a given tolerance.</summary>
 /// <param name="tolerance">tolerance to use when checking.</param>
 /// <returns>true if the surface is a portion of a torus.</returns>
 public bool IsTorus(double tolerance)
 {
   Torus torus = new Torus();
   IntPtr pThis = ConstPointer();
   return UnsafeNativeMethods.ON_Surface_IsTorus(pThis, ref torus, tolerance, false);
 }
コード例 #8
0
 /// <summary>
 /// Draw a wireframe torus.
 /// </summary>
 /// <param name="torus">Torus to draw.</param>
 /// <param name="color">Color to draw with.</param>
 /// <param name="thickness">Thickness (in pixels) of torus wires.</param>
 public void DrawTorus(Torus torus, System.Drawing.Color color, int thickness)
 {
   int argb = color.ToArgb();
   UnsafeNativeMethods.CRhinoDisplayPipeline_DrawTorus(m_ptr, ref torus, argb, thickness);
 }
コード例 #9
0
 /// <summary>
 /// Constructs a new surface of revolution from the values of a torus.
 /// </summary>
 /// <param name="torus">A torus.</param>
 /// <returns>A new surface of revolution, or null if any of the inputs is invalid or on error.</returns>
 public static RevSurface CreateFromTorus(Torus torus)
 {
   IntPtr pRevSurface = UnsafeNativeMethods.ON_Torus_RevSurfaceForm(ref torus);
   if (IntPtr.Zero == pRevSurface)
     return null;
   return new RevSurface(pRevSurface, null);
 }
コード例 #10
0
        /***************************************************/

        public static void RenderRhinoWires(RHG.Torus torus, Rhino.Display.DisplayPipeline pipeline, Color bhColour, int thickness)
        {
            pipeline.DrawTorus(torus, bhColour);
        }
コード例 #11
0
        /***************************************************/

        public static void RenderRhinoMeshes(RHG.Torus torus, Rhino.Display.DisplayPipeline pipeline, DisplayMaterial material)
        {
            pipeline.DrawBrepShaded(torus.ToRevSurface().ToBrep(), material);
        }
コード例 #12
0
ファイル: FromRhino.cs プロジェクト: BHoM/Rhinoceros_Toolkit
        /***************************************************/

        public static BHG.Torus FromRhino(this RHG.Torus torus)
        {
            return(new BHG.Torus {
                Centre = torus.Plane.Origin.FromRhino(), Axis = torus.Plane.ZAxis.FromRhino(), RadiusMajor = torus.MajorRadius, RadiusMinor = torus.MinorRadius
            });
        }
コード例 #13
0
        /***************************************************/

        public static RHG.Mesh CreatePreviewMesh(RHG.Torus torus, RHG.MeshingParameters parameters)
        {
            return(CreatePreviewMesh(torus.ToRevSurface().ToBrep(), parameters));
        }