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


Python Polygon.mirror方法代码示例

本文整理汇总了Python中UM.Math.Polygon.Polygon.mirror方法的典型用法代码示例。如果您正苦于以下问题:Python Polygon.mirror方法的具体用法?Python Polygon.mirror怎么用?Python Polygon.mirror使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UM.Math.Polygon.Polygon的用法示例。


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

示例1: test_mirror

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirror(self, data):
     polygon = Polygon(numpy.array(data["points"], numpy.float32)) #Create a polygon with the specified points.
     polygon.mirror(data["axis_point"], data["axis_direction"]) #Mirror over the specified axis.
     points = polygon.getPoints()
     assert len(points) == len(data["points"]) #Must have the same amount of vertices.
     for point_index in range(len(points)):
         assert len(points[point_index]) == len(data["answer"][point_index]) #Same dimensionality (2).
         for dimension in range(len(points[point_index])):
             assert Float.fuzzyCompare(points[point_index][dimension], data["answer"][point_index][dimension]) #All points must be equal.
开发者ID:senttech,项目名称:Uranium,代码行数:11,代码来源:TestPolygon.py

示例2: test_mirrorDiagonal

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirrorDiagonal(self):
     p = Polygon(numpy.array([ #Make a triangle.
         [0.0, 0.0],
         [2.0, 0.0],
         [1.0, 2.0]
     ], numpy.float32))
     p.mirror([0, 4], [1, 1]) #Mirror over the diagonal axis. The diagonal axis also has an offset.
     self.assertEqual(len(p), 3)
     self.assertEqual(p[0], [-4.0, 4.0])
     self.assertEqual(p[1], [-4.0, 6.0])
     self.assertEqual(p[2], [-2.0, 5.0])
开发者ID:dakshsingh,项目名称:Uranium,代码行数:13,代码来源:TestPolygon.py

示例3: test_mirrorHorizontalFar

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirrorHorizontalFar(self):
     p = Polygon(numpy.array([ #Make a triangle.
         [0.0, 0.0],
         [2.0, 0.0],
         [1.0, 2.0]
     ], numpy.float32))
     p.mirror([10, 0], [0, 1]) #Mirror over the vertical axis with an offset.
     self.assertEqual(len(p), 3)
     self.assertEqual(p[0], [20.0, 0.0])
     self.assertEqual(p[1], [18.0, 0.0])
     self.assertEqual(p[2], [19.0, 2.0])
开发者ID:dakshsingh,项目名称:Uranium,代码行数:13,代码来源:TestPolygon.py

示例4: test_mirrorVertical

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirrorVertical(self):
     p = Polygon(numpy.array([ #Make a triangle.
         [0.0, 0.0],
         [2.0, 0.0],
         [1.0, 2.0]
     ], numpy.float32))
     p.mirror([0, 0], [1, 0]) #Mirror over the horizontal axis.
     self.assertEqual(len(p), 3)
     self.assertEqual(p[0], [0.0, 0.0])
     self.assertEqual(p[1], [2.0, 0.0])
     self.assertEqual(p[2], [1.0, -2.0])
开发者ID:dakshsingh,项目名称:Uranium,代码行数:13,代码来源:TestPolygon.py

示例5: test_mirrorEmpty

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirrorEmpty(self):
     p = Polygon(numpy.array([], numpy.float32)) #Empty polygon.
     p.mirror([0, 0], [1, 0]) #Mirror over the horizontal axis.
     self.assertEqual(len(p), 0)
开发者ID:dakshsingh,项目名称:Uranium,代码行数:6,代码来源:TestPolygon.py

示例6: test_mirrorSingleVertex

# 需要导入模块: from UM.Math.Polygon import Polygon [as 别名]
# 或者: from UM.Math.Polygon.Polygon import mirror [as 别名]
 def test_mirrorSingleVertex(self):
     p = Polygon(numpy.array([[10.0, 0.0]], numpy.float32)) #Single vertex.
     p.mirror([0, 0], [1, 0]) #Mirror over the horizontal axis.
     self.assertEqual(len(p), 1)
     self.assertEqual(p[0], [-10.0, 0.0])
开发者ID:dakshsingh,项目名称:Uranium,代码行数:7,代码来源:TestPolygon.py


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