• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python utility.coercexform函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: InsertBlock2

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


示例17: IsXformIdentity

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


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


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


示例20: XformInverse

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python utility.flatten函数代码示例发布时间:2022-05-26
下一篇:
Python utility.coercerhinoobject函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap