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


Python utility.coercexform函数代码示例

本文整理汇总了Python中utility.coercexform函数的典型用法代码示例。如果您正苦于以下问题:Python coercexform函数的具体用法?Python coercexform怎么用?Python coercexform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: XformMultiply

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
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:30,代码来源:transformation.py

示例2: XformMultiply

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:8,代码来源:transformation.py

示例3: XformCompare

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)
开发者ID:AsherBond,项目名称:rhinopython,代码行数:12,代码来源:transformation.py

示例4: XformDeterminant

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:7,代码来源:transformation.py

示例5: IsXformZero

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:7,代码来源:transformation.py

示例6: IsXformSimilarity

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:7,代码来源:transformation.py

示例7: LineTransform

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
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:27,代码来源:line.py

示例8: XformInverse

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:8,代码来源:transformation.py

示例9: PlaneTransform

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
开发者ID:jehc,项目名称:rhinopython,代码行数:10,代码来源:plane.py

示例10: PointArrayTransform

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]
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:11,代码来源:pointvector.py

示例11: PlaneTransform

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()
开发者ID:Agnestan,项目名称:rhinopython,代码行数:11,代码来源:plane.py

示例12: PointTransform

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
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:11,代码来源:pointvector.py

示例13: VectorTransform

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
开发者ID:acormier,项目名称:rhinoscriptsyntax,代码行数:11,代码来源:pointvector.py

示例14: XformCompare

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)
开发者ID:itrowa,项目名称:rhinoscriptsyntax,代码行数:21,代码来源:transformation.py

示例15: LineTransform

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
开发者ID:AsherBond,项目名称:rhinopython,代码行数:13,代码来源:line.py


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