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


Python entity.scale函数代码示例

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


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

示例1: test_geometry_transforms

def test_geometry_transforms():
    from sympy import Tuple

    c = Curve((x, x ** 2), (x, 0, 1))
    pts = [Point(0, 0), Point(S(1) / 2, S(1) / 4), Point(1, 1)]
    cout = Curve((2 * x - 4, 3 * x ** 2 - 10), (x, 0, 1))
    pts_out = [Point(-4, -10), Point(-3, -S(37) / 4), Point(-2, -7)]
    assert c.scale(2, 3, (4, 5)) == cout
    assert [c.subs(x, xi / 2) for xi in Tuple(0, 1, 2)] == pts
    assert [cout.subs(x, xi / 2) for xi in Tuple(0, 1, 2)] == pts_out
    assert Triangle(*pts).scale(2, 3, (4, 5)) == Triangle(*pts_out)

    assert Ellipse((0, 0), 2, 3).scale(2, 3, (4, 5)) == Ellipse(Point(-4, -10), 4, 9)
    assert Circle((0, 0), 2).scale(2, 3, (4, 5)) == Ellipse(Point(-4, -10), 4, 6)
    assert Ellipse((0, 0), 2, 3).scale(3, 3, (4, 5)) == Ellipse(Point(-8, -10), 6, 9)
    assert Circle((0, 0), 2).scale(3, 3, (4, 5)) == Circle(Point(-8, -10), 6)
    assert Circle(Point(-8, -10), 6).scale(S(1) / 3, S(1) / 3, (4, 5)) == Circle((0, 0), 2)
    assert Curve((x + y, 3 * x), (x, 0, 1)).subs(y, S.Half) == Curve((x + S(1) / 2, 3 * x), (x, 0, 1))
    assert Curve((x, 3 * x), (x, 0, 1)).translate(4, 5) == Curve((x + 4, 3 * x + 5), (x, 0, 1))
    assert Circle((0, 0), 2).translate(4, 5) == Circle((4, 5), 2)
    assert Circle((0, 0), 2).scale(3, 3) == Circle((0, 0), 6)
    assert Point(1, 1).scale(2, 3, (4, 5)) == Point(-2, -7)
    assert Point(1, 1).translate(4, 5) == Point(5, 6)
    assert scale(1, 2, (3, 4)).tolist() == [[1, 0, 0], [0, 2, 0], [0, -4, 1]]
    assert RegularPolygon((0, 0), 1, 4).scale(2, 3, (4, 5)) == Polygon(
        Point(-2, -10), Point(-4, -7), Point(-6, -10), Point(-4, -13)
    )
开发者ID:flacjacket,项目名称:sympy,代码行数:27,代码来源:test_geometry.py

示例2: test_transform

def test_transform():
    p = Point(1, 1)
    assert p.transform(rotate(pi/2)) == Point(-1, 1)
    assert p.transform(scale(3, 2)) == Point(3, 2)
    assert p.transform(translate(1, 2)) == Point(2, 3)
    assert Point(1, 1).scale(2, 3, (4, 5)) == \
        Point(-2, -7)
    assert Point(1, 1).translate(4, 5) == \
        Point(5, 6)
开发者ID:kpsychas,项目名称:sympy,代码行数:9,代码来源:test_point.py

示例3: test_transform

def test_transform():
    p = Point(1, 1)
    assert p.transform(rotate(pi / 2)) == Point(-1, 1)
    assert p.transform(scale(3, 2)) == Point(3, 2)
    assert p.transform(translate(1, 2)) == Point(2, 3)
开发者ID:flacjacket,项目名称:sympy,代码行数:5,代码来源:test_geometry.py

示例4: test_transform

def test_transform():
    assert scale(1, 2, (3, 4)).tolist() == \
        [[1, 0, 0], [0, 2, 0], [0, -4, 1]]
开发者ID:AlexanderKulka,项目名称:sympy,代码行数:3,代码来源:test_entity.py


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