def XformMultiply(xform1, xform2):
    """Multiplies two transformation matrices, where result = xform1 * xform2
    Parameters:
      xform1 = List or Rhino.Geometry.Transform.  The first 4x4 transformation matrix to multiply.
      xform2 = List or Rhino.Geometry.Transform.  The second 4x4 transformation matrix to multiply.
    Returns:
      result transformation on success
    Example:
      import rhinoscriptsyntax as rs
      import math
      objs = rs.GetObjects("Select objects to shear")
      if objs:
      cplane = rs.ViewCPlane()
      cob = rs.XformChangeBasis(rs.WorldXYPlane(), cplane)
      shear2d = rs.XformIdentity()
      shear2d[0,2] = math.tan(math.radians(45.0))
      cob_inv = rs.XformChangeBasis(cplane, rs.WorldXYPlane())
      temp = rs.XformMultiply(shear2d, cob)
      xform = rs.XformMultiply(cob_inv, temp)
      rs.TransformObjects( objs, xform, True )
    See Also:
      XformPlanarProjection
      XformRotation
      XformScale
      XformShear
      XformTranslation
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1*xform2
def XformMultiply(xform1, xform2):
    """Multiplies two transformation matrices, where result = xform1 * xform2
    Parameters:
      xform1 (transform): List or Rhino.Geometry.Transform.  The first 4x4 transformation matrix to multiply.
      xform2 (transform): List or Rhino.Geometry.Transform.  The second 4x4 transformation matrix to multiply.
    Returns:
      transform: result transformation on success
    Example:
      import rhinoscriptsyntax as rs
      import math
      objs = rs.GetObjects("Select objects to shear")
      if objs:
          cplane = rs.ViewCPlane()
          cob = rs.XformChangeBasis(rs.WorldXYPlane(), cplane)
          shear2d = rs.XformIdentity()
          shear2d[0,2] = math.tan(math.radians(45.0))
          cob_inv = rs.XformChangeBasis(cplane, rs.WorldXYPlane())
          temp = rs.XformMultiply(shear2d, cob)
          xform = rs.XformMultiply(cob_inv, temp)
          rs.TransformObjects( objs, xform, True )
    See Also:
      XformPlanarProjection
      XformRotation1
      XformRotation2
      XformRotation3
      XformRotation4
      XformScale
      XformShear
      XformTranslation
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1 * xform2
def XformMultiply(xform1, xform2):
    """Multiplies two transformation matrices, where result = xform1 * xform2
    Returns:
      result transformation on success
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1*xform2
def XformMultiply(xform1, xform2):
    """Multiplies two transformation matrices, where result = xform1 * xform2
    Returns:
      result transformation on success
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1 * xform2
def XformCompare(xform1, xform2):
    """Compares two transformation matrices
    Parameters:
      xform1, xform2 = matrices to compare
    Returns:
      -1 if xform1<xform2
       1 if xform1>xform2
       0 if xform1=xform2
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1.CompareTo(xform2)
def XformCompare(xform1, xform2):
    """Compares two transformation matrices
    Parameters:
      xform1, xform2 = matrices to compare
    Returns:
      -1 if xform1<xform2
       1 if xform1>xform2
       0 if xform1=xform2
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1.CompareTo(xform2)
def IsXformZero(xform):
    "verifies that a matrix is a zero transformation matrix"
    xform = rhutil.coercexform(xform, True)
    for i in range(4):
        for j in range(4):
            if xform[i,j]!=0: return False
    return True
def IsXformSimilarity(xform):
    """Verifies a matrix is a similarity transformation. A similarity
    transformation can be broken into a sequence of dialations, translations,
    rotations, and reflections
    """
    xform = rhutil.coercexform(xform, True)
    return xform.SimilarityType!=Rhino.Geometry.TransformSimilarityType.NotSimilarity
def XformDeterminant(xform):
    """Returns the determinant of a transformation matrix. If the determinant
    of a transformation matrix is 0, the matrix is said to be singular. Singular
    matrices do not have inverses.
    """
    xform = rhutil.coercexform(xform, True)
    return xform.Determinant
def XformDeterminant(xform):
    """Returns the determinant of a transformation matrix. If the determinant
    of a transformation matrix is 0, the matrix is said to be singular. Singular
    matrices do not have inverses.
    """
    xform = rhutil.coercexform(xform, True)
    return xform.Determinant
Exemple #11
0
def LineTransform(line, xform):
    """Transforms a line
    Parameters:
      line (guid): the line to transform
      xform (transform): the transformation to apply
    Returns:
      guid: transformed line
    Example:
      import rhinoscriptsyntax as rs
      line = (0,0,0), (10,10,0)
      rs.AddLine( line[0], line[1] )
      plane = rs.WorldXYPlane()
      xform = rs.XformRotation(30, plane.Zaxis, plane.Origin)
      line = rs.LineTransform(line, xform)
      rs.AddLine( line.From, line.To )
    See Also:
      LineClosestPoint
      LineIsFartherThan
      LineMaxDistanceTo
      LineMinDistanceTo
      LinePlane
    """
    line = rhutil.coerceline(line, True)
    xform = rhutil.coercexform(xform, True)
    success = line.Transform(xform)
    if not success: raise Execption("unable to transform line")
    return line
def IsXformZero(xform):
    "verifies that a matrix is a zero transformation matrix"
    xform = rhutil.coercexform(xform, True)
    for i in range(4):
        for j in range(4):
            if xform[i, j] != 0: return False
    return True
def IsXformSimilarity(xform):
    """Verifies a matrix is a similarity transformation. A similarity
    transformation can be broken into a sequence of dialations, translations,
    rotations, and reflections
    """
    xform = rhutil.coercexform(xform, True)
    return xform.SimilarityType != Rhino.Geometry.TransformSimilarityType.NotSimilarity
Exemple #14
0
def LineTransform(line, xform):
    """Transforms a line
    Parameters:
      line = the line to transform
      xform = the transformation to apply
    Returns:
      transformed line
    Example:
      import rhinoscriptsyntax as rs
      line = (0,0,0), (10,10,0)
      rs.AddLine( line[0], line[1] )
      plane = rs.WorldXYPlane()
      xform = rs.XformRotation(30, plane.Zaxis, plane.Origin)
      line = rs.LineTransform(line, xform)
      rs.AddLine( line.From, line.To )
    See Also:
      LineClosestPoint
      LineIsFartherThan
      LineMaxDistanceTo
      LineMinDistanceTo
      LinePlane
    """
    line = rhutil.coerceline(line, True)
    xform = rhutil.coercexform(xform, True)
    success = line.Transform(xform)
    if not success: raise Execption("unable to transform line")
    return line
def XformInverse(xform):
    """Returns the inverse of a non-singular transformation matrix
    Returns None on error
    """
    xform = rhutil.coercexform(xform, True)
    rc, inverse = xform.TryGetInverse()
    if not rc: return scriptcontext.errorhandler()
    return inverse
def XformInverse(xform):
    """Returns the inverse of a non-singular transformation matrix
    Returns None on error
    """
    xform = rhutil.coercexform(xform, True)
    rc, inverse = xform.TryGetInverse()
    if not rc: return scriptcontext.errorhandler()
    return inverse
Exemple #17
0
def PlaneTransform(plane, xform):
    """Transforms a plane
    Parameters:
      plane = Plane to transform
      xform = Transformation to apply
    """
    plane = rhutil.coerceplane(plane, True)
    xform = rhutil.coercexform(xform, True)
    rc = Rhino.Geometry.Plane(plane)
    if rc.Transform(xform): return rc
Exemple #18
0
def PlaneTransform(plane, xform):
    """Transforms a plane
    Parameters:
      plane = OnPlane or On3dmConstructionPlane
      xform = 
    """
    plane = rhutil.coerceplane(plane, True)
    xform = rhutil.coercexform(xform, True)
    rc = Rhino.Geometry.Plane(plane)
    if rc.Transform(xform): return rc
    return scriptcontext.errorhandler()
Exemple #19
0
def PointArrayTransform(points, xform):
    """Transforms a list of 3D points
    Parameters:
      points = list of 3D points
      xform = transformation to apply
    Returns:
      list of transformed points on success
    """
    points = rhutil.coerce3dpointlist(points, True)
    xform = rhutil.coercexform(xform, True)
    return [xform*point for point in points]
Exemple #20
0
def PlaneTransform(plane, xform):
    """Transforms a plane
    Parameters:
      plane = OnPlane or On3dmConstructionPlane
      xform = 
    """
    plane = rhutil.coerceplane(plane, True)
    xform = rhutil.coercexform(xform, True)
    rc = Rhino.Geometry.Plane(plane)
    if rc.Transform(xform): return rc
    return scriptcontext.errorhandler()
Exemple #21
0
def PointTransform(point, xform):
    """Transforms a 3D point
    Paramters:
      point = the point to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    """
    point = rhutil.coerce3dpoint(point, True)
    xform = rhutil.coercexform(xform, True)
    return xform*point
Exemple #22
0
def VectorTransform(vector, xform):
    """Transforms a 3D vector
    Paramters:
      vector = the vector to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    """
    vector = rhutil.coerce3dvector(vector, True)
    xform = rhutil.coercexform(xform, True)
    return xform*vector
def XformCompare(xform1, xform2):
    """Compares two transformation matrices
    Parameters:
      xform1, xform2 = matrices to compare
    Returns:
      -1 if xform1<xform2
       1 if xform1>xform2
       0 if xform1=xform2
    Example:
      import rhinoscriptsyntax as rs
      xform0 = rs.XformZero()
      xform1 = rs.XformIdentity()
      print rs.XformCompare(xform0, xform1)
    See Also:
      IsXformIdentity
      IsXformSimilarity
      IsXformZero
    """
    xform1 = rhutil.coercexform(xform1, True)
    xform2 = rhutil.coercexform(xform2, True)
    return xform1.CompareTo(xform2)
Exemple #24
0
def LineTransform(line, xform):
    """Transforms a line
    Parameters:
      line = the line to transform
      xform = the transformation to apply
    Returns:
      transformed line
    """
    line = rhutil.coerceline(line, True)
    xform = rhutil.coercexform(xform, True)
    success = line.Transform(xform)
    if not success: raise Execption("unable to transform line")
    return line
Exemple #25
0
def LineTransform(line, xform):
    """Transforms a line
    Parameters:
      line = the line to transform
      xform = the transformation to apply
    Returns:
      transformed line
    """
    line = rhutil.coerceline(line, True)
    xform = rhutil.coercexform(xform, True)
    success = line.Transform(xform)
    if not success: raise Execption("unable to transform line")
    return line
Exemple #26
0
def InsertBlock2(block_name, xform):
    """Inserts a block whose definition already exists in the document
    Parameters:
      block_name = name of an existing block definition
      xform = 4x4 transformation matrix to apply
    Returns:
      id for the block that was added to the doc on success
    """
    idef = scriptcontext.doc.InstanceDefinitions.Find(block_name, True)
    if not idef: raise ValueError("%s does not exist in InstanceDefinitionsTable"%block_name)
    xform = rhutil.coercexform(xform, True)
    id = scriptcontext.doc.Objects.AddInstanceObject(idef.Index, xform )
    if id!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return id
Exemple #27
0
def InsertBlock2(block_name, xform):
    """Inserts a block whose definition already exists in the document
    Parameters:
      block_name = name of an existing block definition
      xform = 4x4 transformation matrix to apply
    Returns:
      id for the block that was added to the doc on success
    """
    idef = scriptcontext.doc.InstanceDefinitions.Find(block_name, True)
    if not idef: raise ValueError("%s does not exist in InstanceDefinitionsTable"%block_name)
    xform = rhutil.coercexform(xform, True)
    id = scriptcontext.doc.Objects.AddInstanceObject(idef.Index, xform )
    if id!=System.Guid.Empty:
        scriptcontext.doc.Views.Redraw()
        return id
def IsXformIdentity(xform):
    """Verifies a matrix is the identity matrix
    Parameters:
      xform =  List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      True or False indicating success or failure.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.XformIdentity()
      print rs.IsXformIdentity(xform)
    See Also:
      IsXformSimilarity
      IsXformZero
      XformIdentity
    """
    xform = rhutil.coercexform(xform, True)
    return xform==Rhino.Geometry.Transform.Identity
def IsXformIdentity(xform):
    """Verifies a matrix is the identity matrix
    Parameters:
      xform (transform): List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      bool: True or False indicating success or failure.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.XformIdentity()
      print rs.IsXformIdentity(xform)
    See Also:
      IsXformSimilarity
      IsXformZero
      XformIdentity
    """
    xform = rhutil.coercexform(xform, True)
    return xform == Rhino.Geometry.Transform.Identity
def XformDeterminant(xform):
    """Returns the determinant of a transformation matrix. If the determinant
    of a transformation matrix is 0, the matrix is said to be singular. Singular
    matrices do not have inverses.
    Parameters:
      xform = List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      The determinant if successful, otherwise None
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.BlockInstanceXform(obj)
      if xform: print rs.XformDeterminant(xform)
    See Also:
      XformInverse
    """
    xform = rhutil.coercexform(xform, True)
    return xform.Determinant
def IsXformSimilarity(xform):
    """Verifies a matrix is a similarity transformation. A similarity
    transformation can be broken into a sequence of dialations, translations,
    rotations, and reflections
    Parameters:
      xform = List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      True if this transformation is an orientation preserving similarity, otherwise False.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.BlockInstanceXform(block)
      print rs.IsXformSimilarity(xform)
    See Also:
      IsXformIdentity
      IsXformZero
    """
    xform = rhutil.coercexform(xform, True)
    return xform.SimilarityType!=Rhino.Geometry.TransformSimilarityType.NotSimilarity
def IsXformSimilarity(xform):
    """Verifies a matrix is a similarity transformation. A similarity
    transformation can be broken into a sequence of dialations, translations,
    rotations, and reflections
    Parameters:
      xform (transform): List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      bool: True if this transformation is an orientation preserving similarity, otherwise False.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.BlockInstanceXform(block)
      print rs.IsXformSimilarity(xform)
    See Also:
      IsXformIdentity
      IsXformZero
    """
    xform = rhutil.coercexform(xform, True)
    return xform.SimilarityType != Rhino.Geometry.TransformSimilarityType.NotSimilarity
def XformInverse(xform):
    """Returns the inverse of a non-singular transformation matrix
    Parameters:
      xform = List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      The inverted 4x4 transformation matrix if successful.
      None, if matrix is non-singular or on error.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.BlockInstanceXform(obj)
      if xform:
      rs.TransformObject( obj, rs.XformInverse(xform) )
    See Also:
      XformDeterminant
    """
    xform = rhutil.coercexform(xform, True)
    rc, inverse = xform.TryGetInverse()
    if not rc: return scriptcontext.errorhandler()
    return inverse
def XformInverse(xform):
    """Returns the inverse of a non-singular transformation matrix
    Parameters:
      xform (transform): List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      transform: The inverted 4x4 transformation matrix if successful.
      None: if matrix is non-singular or on error.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.BlockInstanceXform(obj)
      if xform:
          rs.TransformObject( obj, rs.XformInverse(xform) )
    See Also:
      XformDeterminant
    """
    xform = rhutil.coercexform(xform, True)
    rc, inverse = xform.TryGetInverse()
    if not rc: return scriptcontext.errorhandler()
    return inverse
Exemple #35
0
def TransformObjects(object_ids, matrix, copy=False):
    """Moves, scales, or rotates a list of objects given a 4x4 transformation
    matrix. The matrix acts on the left.
    Parameters:
      object_ids = List of object identifiers.
      matrix = The transformation matrix (4x4 array of numbers).
      copy[opt] = Copy the objects
    Returns:
      List of ids identifying the newly transformed objects
    """
    xform = rhutil.coercexform(matrix, True)
    id = rhutil.coerceguid(object_ids, False)
    if id: object_ids = [id]
    rc = []
    for object_id in object_ids:
        object_id = rhutil.coerceguid(object_id, True)
        id = scriptcontext.doc.Objects.Transform(object_id, xform, not copy)
        if id!=System.Guid.Empty: rc.append(id)
    if rc: scriptcontext.doc.Views.Redraw()
    return rc
Exemple #36
0
def PointArrayTransform(points, xform):
    """Transforms a list of 3D points
    Parameters:
      points = list of 3D points
      xform = transformation to apply
    Returns:
      list of transformed points on success
    Example:
      import rhinoscriptsyntax as rs
      obj = rs.GetObject("Select object")
      points = rs.BoundingBox(obj)
      xform = rs.XformRotation2(45.0, (0,0,1), (0,0,0))
      points = rs.PointArrayTransform(points, xform)
      rs.AddPoints(points)
    See Also:
      PointArrayClosestPoint
    """
    points = rhutil.coerce3dpointlist(points, True)
    xform = rhutil.coercexform(xform, True)
    return [xform * point for point in points]
Exemple #37
0
def TransformObjects(object_ids, matrix, copy=False):
    """Moves, scales, or rotates a list of objects given a 4x4 transformation
    matrix. The matrix acts on the left.
    Parameters:
      object_ids = List of object identifiers.
      matrix = The transformation matrix (4x4 array of numbers).
      copy[opt] = Copy the objects
    Returns:
      List of ids identifying the newly transformed objects
    """
    xform = rhutil.coercexform(matrix, True)
    id = rhutil.coerceguid(object_ids, False)
    if id: object_ids = [id]
    rc = []
    for object_id in object_ids:
        object_id = rhutil.coerceguid(object_id, True)
        id = scriptcontext.doc.Objects.Transform(object_id, xform, not copy)
        if id != System.Guid.Empty: rc.append(id)
    if rc: scriptcontext.doc.Views.Redraw()
    return rc
def IsXformZero(xform):
    """verifies that a matrix is a zero transformation matrix
    Parameters:
      xform (transform): List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      bool: True or False indicating success or failure.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.XformZero()
      print rs.IsXformZero(xform)
    See Also:
      IsXformIdentity
      IsXformSimilarity
      XformZero
    """
    xform = rhutil.coercexform(xform, True)
    for i in range(4):
        for j in range(4):
            if xform[i, j] != 0: return False
    return True
def IsXformZero(xform):
    """verifies that a matrix is a zero transformation matrix
    Parameters:
      xform = List or Rhino.Geometry.Transform.  A 4x4 transformation matrix.
    Returns:
      True or False indicating success or failure.
    Example:
      import rhinoscriptsyntax as rs
      xform = rs.XformZero()
      print rs.IsXformZero(xform)
    See Also:
      IsXformIdentity
      IsXformSimilarity
      XformZero
    """
    xform = rhutil.coercexform(xform, True)
    for i in range(4):
        for j in range(4):
            if xform[i,j]!=0: return False
    return True
def PointArrayTransform(points, xform):
    """Transforms a list of 3D points
    Parameters:
      points = list of 3D points
      xform = transformation to apply
    Returns:
      list of transformed points on success
    Example:
      import rhinoscriptsyntax as rs
      obj = rs.GetObject("Select object")
      points = rs.BoundingBox(obj)
      xform = rs.XformRotation2(45.0, (0,0,1), (0,0,0))
      points = rs.PointArrayTransform(points, xform)
      rs.AddPoints(points)
    See Also:
      PointArrayClosestPoint
    """
    points = rhutil.coerce3dpointlist(points, True)
    xform = rhutil.coercexform(xform, True)
    return [xform*point for point in points]
def VectorTransform(vector, xform):
    """Transforms a 3D vector
    Parameters:
      vector = the vector to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    Example:
      import rhinoscriptsyntax as rs
      vector = (1,0,0) #world x-axis
      xform = rs.XformRotation2(90.0, (0,0,1), (0,0,0))
      vector = rs.VectorTransform(vector, xform)
      print vector
    See Also:
      IsVectorZero
      VectorCreate
      VectorUnitize
    """
    vector = rhutil.coerce3dvector(vector, True)
    xform = rhutil.coercexform(xform, True)
    return xform*vector
Exemple #42
0
def VectorTransform(vector, xform):
    """Transforms a 3D vector
    Parameters:
      vector = the vector to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    Example:
      import rhinoscriptsyntax as rs
      vector = (1,0,0) #world x-axis
      xform = rs.XformRotation2(90.0, (0,0,1), (0,0,0))
      vector = rs.VectorTransform(vector, xform)
      print vector
    See Also:
      IsVectorZero
      VectorCreate
      VectorUnitize
    """
    vector = rhutil.coerce3dvector(vector, True)
    xform = rhutil.coercexform(xform, True)
    return xform * vector
Exemple #43
0
def PlaneTransform(plane, xform):
    """Transforms a plane
    Parameters:
      plane = Plane to transform
      xform = Transformation to apply
    Returns:
      the resulting plane if successful, otherwise None
    Example:
      import rhinoscriptsyntax as rs
      plane = rs.ViewCPlane()
      xform = rs.XformRotation(45.0, plane.Zaxis, plane.Origin)
      plane = rs.PlaneTransform(plane, xform)
      rs.ViewCPlane(None, plane)
    See Also:
      PlaneFromFrame
      PlaneFromNormal
      PlaneFromPoints
    """
    plane = rhutil.coerceplane(plane, True)
    xform = rhutil.coercexform(xform, True)
    rc = Rhino.Geometry.Plane(plane)
    if rc.Transform(xform): return rc
def PointTransform(point, xform):
    """Transforms a 3D point
    Parameters:
      point = the point to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    Example:
      # Translate (move) objects by (10,10,0)
      import rhinoscriptsyntax as rs
      point = 5,5,0
      matrix = rs.XformTranslation((10,10,0))
      result = rs.PointTransform(point, matrix)
      print result
    See Also:
      PointAdd
      PointCompare
      PointDivide
      PointScale
      PointSubtract
    """
    point = rhutil.coerce3dpoint(point, True)
    xform = rhutil.coercexform(xform, True)
    return xform*point
Exemple #45
0
def PointTransform(point, xform):
    """Transforms a 3D point
    Parameters:
      point = the point to transform
      xform = a valid 4x4 transformation matrix
    Returns:
      transformed vector on success
    Example:
      # Translate (move) objects by (10,10,0)
      import rhinoscriptsyntax as rs
      point = 5,5,0
      matrix = rs.XformTranslation((10,10,0))
      result = rs.PointTransform(point, matrix)
      print result
    See Also:
      PointAdd
      PointCompare
      PointDivide
      PointScale
      PointSubtract
    """
    point = rhutil.coerce3dpoint(point, True)
    xform = rhutil.coercexform(xform, True)
    return xform * point
def IsXformIdentity(xform):
    "Verifies a matrix is the identity matrix"
    xform = rhutil.coercexform(xform, True)
    return xform==Rhino.Geometry.Transform.Identity
def IsXformIdentity(xform):
    "Verifies a matrix is the identity matrix"
    xform = rhutil.coercexform(xform, True)
    return xform == Rhino.Geometry.Transform.Identity