Surface
=======

.. py:module:: rhino3dm

.. py:class:: Surface

   .. py:attribute:: IsSolid

      bool: Gets a values indicating whether a surface is solid.

   .. py:method:: SetDomain(direction, domain)

      Sets the domain in a direction.

      :param int direction: 0 sets first parameter's domain, 1 sets second parameter's domain.
      :param rhino3dm.Interval domain: A new domain to be assigned.

      :return: True if setting succeeded, otherwise false.

      :rtype: bool

   .. py:method:: Degree(direction)

      Returns the maximum algebraic degree of any span
      (or a good estimate if curve spans are not algebraic).

      :param int direction: 0 gets first parameter's domain, 1 gets second parameter's domain.

      :return: The maximum degree.

      :rtype: int

   .. py:method:: SpanCount(direction)

      Gets number of smooth nonempty spans in the parameter direction.

      :param int direction: 0 gets first parameter's domain, 1 gets second parameter's domain.

      :return: The span count.

      :rtype: int

   .. py:method:: PointAt(u, v)

      Evaluates a point at a given parameter.

      :param float u: evaluation parameters.
      :param float v: evaluation parameters.

      :return: Point3d.Unset on failure.

      :rtype: rhino3dm.Point3d

   .. py:method:: FrameAt(u, v)

      Computes the orient plane on a surface given a U and V parameter.
      This is the simple evaluation call with no error handling.

      :param float u: A first parameter.
      :param float v: A second parameter.

      :return: tuple (bool, rhino3dm.Plane)

         - True if this operation succeeded; otherwise false.
         - A frame plane that will be computed during this call. \

      :rtype: (bool, rhino3dm.Plane)

   .. py:method:: Domain(direction)

      Gets the domain in a direction.

      :param int direction: 0 gets first parameter, 1 gets second parameter.

      :return: An interval value.

      :rtype: rhino3dm.Interval

   .. py:method:: GetSpanVector(direction)

      Gets array of span "knots".

      :param int direction: 0 gets first parameter's domain, 1 gets second parameter's domain.

      :return: An array with span vectors; or None on error.

      :rtype: float[]

   .. py:method:: NormalAt(u, v)

      Computes the surface normal at a point.
      This is the simple evaluation call - it does not support error handling.

      :param float u: A U parameter.
      :param float v: A V parameter.

      :return: The normal.

      :rtype: rhino3dm.Vector3d

   .. py:method:: IsClosed(direction)

      Gets a value indicating if the surface is closed in a direction.

      :param int direction: 0 = U, 1 = V.

      :return: The indicating boolean value.

      :rtype: bool

   .. py:method:: IsPeriodic(direction)

      Gets a value indicating if the surface is periodic in a direction (default is false).

      :param int direction: 0 = U, 1 = V.

      :return: The indicating boolean value.

      :rtype: bool

   .. py:method:: IsSingular(side)

      True if surface side is collapsed to a point.

      :param int side: side of parameter space to test \
         0 = south, 1 = east, 2 = north, 3 = west.

      :return: True if this specific side of the surface is singular; otherwise, false.

      :rtype: bool

   .. py:method:: IsAtSingularity(u, v, exact)

      Tests if a surface parameter value is at a singularity.

      :param float u: Surface u parameter to test.
      :param float v: Surface v parameter to test.
      :param bool exact: If true, test if (u,v) is exactly at a singularity. \
         If false, test if close enough to cause numerical problems.

      :return: True if surface is singular at (s,t)

      :rtype: bool

   .. py:method:: IsAtSeam(u, v)

      Tests if a surface parameter value is at a seam.

      :param float u: Surface u parameter to test.
      :param float v: Surface v parameter to test.

      :return: 0 if not a seam, \
         1 if u == Domain(0)[i] and srf(u, v) == srf(Domain(0)[1-i], v) \
         2 if v == Domain(1)[i] and srf(u, v) == srf(u, Domain(1)[1-i]) \
         3 if 1 and 2 are true.

      :rtype: int

   .. py:method:: IsoCurve(direction, constantParameter)

      Gets isoparametric curve.

      :param int direction: 0 first parameter varies and second parameter is constant \
         e.g., point on IsoCurve(0,c) at t is srf(t,c) \
         This is a horizontal line from left to right \
         \
         1 first parameter is constant and second parameter varies \
         e.g., point on IsoCurve(1,c) at t is srf(c,t \
         This is a vertical line from bottom to top.
      :param float constantParameter: The parameter that was constant on the original surface.

      :return: An isoparametric curve or None on error.

      :rtype: rhino3dm.Curve

   .. py:method:: ToNurbsSurface()

      Gets a NURBS surface representation of this surface. Default
      tolerance of 0.0 is used.

      :return: NurbsSurface on success, None on failure.

      :rtype: NurbsSurface

   .. py:method:: ToNurbsSurface(tolerance)

      Gets a NURBS surface representation of this surface. Default
      tolerance of 0.0 is used.

      :return: NurbsSurface on success, None on failure.

      :rtype: NurbsSurface

   .. py:method:: IsPlanar(tolerance)

      Tests a surface to see if it is planar to zero tolerance.

      :return: True if the surface is planar (flat) to within RhinoMath.ZeroTolerance units (1e-12).

      :rtype: bool

   .. py:method:: IsSphere(tolerance)

      Determines if the surface is a portion of a sphere within RhinoMath.ZeroTolerance.

      :return: True if the surface is a portion of a sphere.

      :rtype: bool

   .. py:method:: IsCylinder(tolerance)

      Determines if the surface is a portion of a cylinder within RhinoMath.ZeroTolerance.

      :return: True if the surface is a portion of a cylinder.

      :rtype: bool

   .. py:method:: IsCone(tolerance)

      Determines if the surface is a portion of a cone within RhinoMath.ZeroTolerance.

      :return: True if the surface is a portion of a cone.

      :rtype: bool

   .. py:method:: IsTorus(tolerance)

      Determines if the surface is a portion of a torus within RhinoMath.ZeroTolerance.

      :return: True if the surface is a portion of a torus.

      :rtype: bool

   .. py:method:: GetSurfaceParameterFromNurbsFormParameter(nurbsS, nurbsT)

      Translates a parameter from a value on the surface returned by  to the current surface.

      :param float nurbsS: The parameter in the S, or sometimes U, direction of the NURBS form surface.
      :param float nurbsT: The parameter in the T, or sometimes V, direction of the NURBS form surface.

      :return: tuple (bool, float, float)

         - True if the operation succeeded; otherwise, false.
         - S on this surface. \
         - T o n this surface. \

      :rtype: (bool, float, float)

   .. py:method:: GetNurbsFormParameterFromSurfaceParameter(surfaceS, surfaceT)

      Translates a parameter from the current surface to the parameter space of the surface returned by .

      :param float surfaceS: The parameter in the S, or sometimes U, direction, of this surface.
      :param float surfaceT: The parameter in the T, or sometimes V, direction of this surface.

      :return: tuple (bool, float, float)

         - True if the operation succeeded; otherwise, false.
         - S on the NURBS form. \
         - T on the NURBS form. \

      :rtype: (bool, float, float)
