本文整理汇总了Python中sympy.geometry.Point类的典型用法代码示例。如果您正苦于以下问题:Python Point类的具体用法?Python Point怎么用?Python Point使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Point类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
def main():
O = Point(0, 0)
p0 = Point(0, 10.1)
p1 = Point(1.4, -9.6)
m = p0.midpoint(p1)
X = Line(O, Point(10, 0))
Y = Line(O, Point(0, 10))
ellipse = Ellipse(Point(0, 0), 5 , 10)
sortie = Segment(Point(-0.01, 10), Point(0.01, 10))
ray = Ray(m, p1)
reflections = 0
while not sortie.intersection(ray) and reflections < 5:
targets = ellipse.intersection(ray)
print " Targets: ", targets
origin = next_origin(ray.p1, targets)
tangents = ellipse.tangent_lines(origin)
if len(tangents) > 1:
print("Error computing intersection")
break
tangent = tangents.pop()
alpha = next_angle(ray, tangent, (X, Y))
reflections += 1
ray = Ray(origin, angle=alpha)
print "Reflections :", reflections
示例2: test_reflect
def test_reflect():
b = Symbol('b')
m = Symbol('m')
l = Line((0, b), slope=m)
p = Point(x, y)
r = p.reflect(l)
dp = l.perpendicular_segment(p).length
dr = l.perpendicular_segment(r).length
assert test_numerically(dp, dr)
t = Triangle((0, 0), (1, 0), (2, 3))
assert t.area == -t.reflect(l).area
e = Ellipse((1, 0), 1, 2)
assert e.area == -e.reflect(Line((1, 0), slope=0)).area
assert e.area == -e.reflect(Line((1, 0), slope=oo)).area
raises(NotImplementedError, lambda: e.reflect(Line((1,0), slope=m)))
# test entity overrides
c = Circle((x, y), 3)
cr = c.reflect(l)
assert cr == Circle(r, -3)
assert c.area == -cr.area
pent = RegularPolygon((1, 2), 1, 5)
l = Line((0, pi), slope=sqrt(2))
rpent = pent.reflect(l)
poly_pent = Polygon(*pent.vertices)
assert rpent.center == pent.center.reflect(l)
assert str([w.n(3) for w in rpent.vertices]) == (
'[Point(-0.586, 4.27), Point(-1.69, 4.66), '
'Point(-2.41, 3.73), Point(-1.74, 2.76), '
'Point(-0.616, 3.10)]')
assert pent.area.equals(-rpent.area)
示例3: test_reflect_entity_overrides
def test_reflect_entity_overrides():
x = Symbol('x', real=True)
y = Symbol('y', real=True)
b = Symbol('b')
m = Symbol('m')
l = Line((0, b), slope=m)
p = Point(x, y)
r = p.reflect(l)
c = Circle((x, y), 3)
cr = c.reflect(l)
assert cr == Circle(r, -3)
assert c.area == -cr.area
pent = RegularPolygon((1, 2), 1, 5)
l = Line(pent.vertices[1],
slope=Rational(random() - .5, random() - .5))
rpent = pent.reflect(l)
assert rpent.center == pent.center.reflect(l)
rvert = [i.reflect(l) for i in pent.vertices]
for v in rpent.vertices:
for i in range(len(rvert)):
ri = rvert[i]
if ri.equals(v):
rvert.remove(ri)
break
assert not rvert
assert pent.area.equals(-rpent.area)
示例4: 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)
示例5: test_subs
def test_subs():
p = Point(x, 2)
q = Point(1, 1)
r = Point(3, 4)
for o in [p,
Segment(p, q),
Ray(p, q),
Line(p, q),
Triangle(p, q, r),
RegularPolygon(p, 3, 6),
Polygon(p, q, r, Point(5,4)),
Circle(p, 3),
Ellipse(p, 3, 4)]:
assert 'y' in str(o.subs(x, y))
assert p.subs({x: 1}) == Point(1, 2)
示例6: test_subs
def test_subs():
p = Point(x, 2)
q = Point(1, 1)
r = Point(3, 4)
for o in [p,
Segment(p, q),
Ray(p, q),
Line(p, q),
Triangle(p, q, r),
RegularPolygon(p, 3, 6),
Polygon(p, q, r, Point(5,4)),
Circle(p, 3),
Ellipse(p, 3, 4)]:
assert 'y' in str(o.subs(x, y))
assert p.subs({x: 1}) == Point(1, 2)
assert Point(1, 2).subs(Point(1, 2), Point(3, 4)) == Point(3, 4)
assert Point(1, 2).subs((1,2), Point(3,4)) == Point(3, 4)
assert Point(1, 2).subs(Point(1,2), Point(3,4)) == Point(3, 4)
assert Point(1, 2).subs(set([(1, 2)])) == Point(2, 2)
raises(ValueError, lambda: Point(1, 2).subs(1))
raises(ValueError, lambda: Point(1, 1).subs((Point(1, 1), Point(1, 2)), 1, 2))
示例7: test_reflect
def test_reflect():
x = Symbol('x', real=True)
y = Symbol('y', real=True)
b = Symbol('b')
m = Symbol('m')
l = Line((0, b), slope=m)
p = Point(x, y)
r = p.reflect(l)
dp = l.perpendicular_segment(p).length
dr = l.perpendicular_segment(r).length
assert verify_numerically(dp, dr)
t = Triangle((0, 0), (1, 0), (2, 3))
assert Polygon((1, 0), (2, 0), (2, 2)).reflect(Line((3, 0), slope=oo)) \
== Triangle(Point(5, 0), Point(4, 0), Point(4, 2))
assert Polygon((1, 0), (2, 0), (2, 2)).reflect(Line((0, 3), slope=oo)) \
== Triangle(Point(-1, 0), Point(-2, 0), Point(-2, 2))
assert Polygon((1, 0), (2, 0), (2, 2)).reflect(Line((0, 3), slope=0)) \
== Triangle(Point(1, 6), Point(2, 6), Point(2, 4))
assert Polygon((1, 0), (2, 0), (2, 2)).reflect(Line((3, 0), slope=0)) \
== Triangle(Point(1, 0), Point(2, 0), Point(2, -2))
示例8: test_reflect_entity_overrides
def test_reflect_entity_overrides():
x = Symbol('x', real=True)
y = Symbol('y', real=True)
b = Symbol('b')
m = Symbol('m')
l = Line((0, b), slope=m)
p = Point(x, y)
r = p.reflect(l)
c = Circle((x, y), 3)
cr = c.reflect(l)
assert cr == Circle(r, -3)
assert c.area == -cr.area
pent = RegularPolygon((1, 2), 1, 5)
l = Line((0, pi), slope=sqrt(2))
rpent = pent.reflect(l)
assert rpent.center == pent.center.reflect(l)
assert str([w.n(3) for w in rpent.vertices]) == (
'[Point2D(-0.586, 4.27), Point2D(-1.69, 4.66), '
'Point2D(-2.41, 3.73), Point2D(-1.74, 2.76), '
'Point2D(-0.616, 3.10)]')
assert pent.area.equals(-rpent.area)
示例9: centroid
def centroid(*args):
"""Find the centroid (center of mass) of the collection containing only Points,
Segments or Polygons. The centroid is the weighted average of the individual centroid
where the weights are the lengths (of segments) or areas (of polygons).
Overlapping regions will add to the weight of that region.
If there are no objects (or a mixture of objects) then None is returned.
See Also
========
sympy.geometry.point.Point, sympy.geometry.line.Segment,
sympy.geometry.polygon.Polygon
Examples
========
>>> from sympy import Point, Segment, Polygon
>>> from sympy.geometry.util import centroid
>>> p = Polygon((0, 0), (10, 0), (10, 10))
>>> q = p.translate(0, 20)
>>> p.centroid, q.centroid
(Point2D(20/3, 10/3), Point2D(20/3, 70/3))
>>> centroid(p, q)
Point2D(20/3, 40/3)
>>> p, q = Segment((0, 0), (2, 0)), Segment((0, 0), (2, 2))
>>> centroid(p, q)
Point2D(1, 2 - sqrt(2))
>>> centroid(Point(0, 0), Point(2, 0))
Point2D(1, 0)
Stacking 3 polygons on top of each other effectively triples the
weight of that polygon:
>>> p = Polygon((0, 0), (1, 0), (1, 1), (0, 1))
>>> q = Polygon((1, 0), (3, 0), (3, 1), (1, 1))
>>> centroid(p, q)
Point2D(3/2, 1/2)
>>> centroid(p, p, p, q) # centroid x-coord shifts left
Point2D(11/10, 1/2)
Stacking the squares vertically above and below p has the same
effect:
>>> centroid(p, p.translate(0, 1), p.translate(0, -1), q)
Point2D(11/10, 1/2)
"""
from sympy.geometry import Polygon, Segment, Point
if args:
if all(isinstance(g, Point) for g in args):
c = Point(0, 0)
for g in args:
c += g
den = len(args)
elif all(isinstance(g, Segment) for g in args):
c = Point(0, 0)
L = 0
for g in args:
l = g.length
c += g.midpoint*l
L += l
den = L
elif all(isinstance(g, Polygon) for g in args):
c = Point(0, 0)
A = 0
for g in args:
a = g.area
c += g.centroid*a
A += a
den = A
c /= den
return c.func(*[i.simplify() for i in c.args])
示例10: test_ellipse
def test_ellipse():
p1 = Point(0, 0)
p2 = Point(1, 1)
p4 = Point(0, 1)
e1 = Ellipse(p1, 1, 1)
e2 = Ellipse(p2, half, 1)
e3 = Ellipse(p1, y1, y1)
c1 = Circle(p1, 1)
c2 = Circle(p2, 1)
c3 = Circle(Point(sqrt(2), sqrt(2)), 1)
# Test creation with three points
cen, rad = Point(3*half, 2), 5*half
assert Circle(Point(0, 0), Point(3, 0), Point(0, 4)) == Circle(cen, rad)
raises(
GeometryError, lambda: Circle(Point(0, 0), Point(1, 1), Point(2, 2)))
raises(ValueError, lambda: Ellipse(None, None, None, 1))
raises(GeometryError, lambda: Circle(Point(0, 0)))
# Basic Stuff
assert Ellipse(None, 1, 1).center == Point(0, 0)
assert e1 == c1
assert e1 != e2
assert p4 in e1
assert p2 not in e2
assert e1.area == pi
assert e2.area == pi/2
assert e3.area == pi*y1*abs(y1)
assert c1.area == e1.area
assert c1.circumference == e1.circumference
assert e3.circumference == 2*pi*y1
assert e1.plot_interval() == e2.plot_interval() == [t, -pi, pi]
assert e1.plot_interval(x) == e2.plot_interval(x) == [x, -pi, pi]
assert Ellipse(None, 1, None, 1).circumference == 2*pi
assert c1.minor == 1
assert c1.major == 1
assert c1.hradius == 1
assert c1.vradius == 1
# Private Functions
assert hash(c1) == hash(Circle(Point(1, 0), Point(0, 1), Point(0, -1)))
assert c1 in e1
assert (Line(p1, p2) in e1) is False
assert e1.__cmp__(e1) == 0
assert e1.__cmp__(Point(0, 0)) > 0
# Encloses
assert e1.encloses(Segment(Point(-0.5, -0.5), Point(0.5, 0.5))) is True
assert e1.encloses(Line(p1, p2)) is False
assert e1.encloses(Ray(p1, p2)) is False
assert e1.encloses(e1) is False
assert e1.encloses(
Polygon(Point(-0.5, -0.5), Point(-0.5, 0.5), Point(0.5, 0.5))) is True
assert e1.encloses(RegularPolygon(p1, 0.5, 3)) is True
assert e1.encloses(RegularPolygon(p1, 5, 3)) is False
assert e1.encloses(RegularPolygon(p2, 5, 3)) is False
# with generic symbols, the hradius is assumed to contain the major radius
M = Symbol('M')
m = Symbol('m')
c = Ellipse(p1, M, m).circumference
_x = c.atoms(Dummy).pop()
assert c == 4*M*C.Integral(
sqrt((1 - _x**2*(M**2 - m**2)/M**2)/(1 - _x**2)), (_x, 0, 1))
assert e2.arbitrary_point() in e2
# Foci
f1, f2 = Point(sqrt(12), 0), Point(-sqrt(12), 0)
ef = Ellipse(Point(0, 0), 4, 2)
assert ef.foci in [(f1, f2), (f2, f1)]
# Tangents
v = sqrt(2) / 2
p1_1 = Point(v, v)
p1_2 = p2 + Point(half, 0)
p1_3 = p2 + Point(0, 1)
assert e1.tangent_lines(p4) == c1.tangent_lines(p4)
assert e2.tangent_lines(p1_2) == [Line(p1_2, p2 + Point(half, 1))]
assert e2.tangent_lines(p1_3) == [Line(p1_3, p2 + Point(half, 1))]
assert c1.tangent_lines(p1_1) == [Line(p1_1, Point(0, sqrt(2)))]
assert c1.tangent_lines(p1) == []
assert e2.is_tangent(Line(p1_2, p2 + Point(half, 1)))
assert e2.is_tangent(Line(p1_3, p2 + Point(half, 1)))
assert c1.is_tangent(Line(p1_1, Point(0, sqrt(2))))
assert e1.is_tangent(Line(Point(0, 0), Point(1, 1))) is False
assert c1.is_tangent(e1) is False
assert c1.is_tangent(Ellipse(Point(2, 0), 1, 1)) is True
assert c1.is_tangent(
Polygon(Point(1, 1), Point(1, -1), Point(2, 0))) is True
assert c1.is_tangent(
Polygon(Point(1, 1), Point(1, 0), Point(2, 0))) is False
assert Ellipse(Point(5, 5), 2, 1).tangent_lines(Point(0, 0)) == \
[Line(Point(0, 0), Point(77/25, 132/25)),
Line(Point(0, 0), Point(33/5, 22/5))]
assert Ellipse(Point(5, 5), 2, 1).tangent_lines(Point(3, 4)) == \
[Line(Point(3, 4), Point(3, 5)), Line(Point(3, 4), Point(5, 4))]
#.........这里部分代码省略.........
示例11: test_line_geom
def test_line_geom():
x = Symbol('x', real=True)
y = Symbol('y', real=True)
x1 = Symbol('x1', real=True)
y1 = Symbol('y1', real=True)
half = Rational(1, 2)
p1 = Point(0, 0)
p2 = Point(1, 1)
p3 = Point(x1, x1)
p4 = Point(y1, y1)
p5 = Point(x1, 1 + x1)
p6 = Point(1, 0)
p7 = Point(0, 1)
p8 = Point(2, 0)
p9 = Point(2, 1)
l1 = Line(p1, p2)
l2 = Line(p3, p4)
l3 = Line(p3, p5)
l4 = Line(p1, p6)
l5 = Line(p1, p7)
l6 = Line(p8, p9)
l7 = Line(p2, p9)
raises(ValueError, lambda: Line(Point(0, 0), Point(0, 0)))
# Basic stuff
assert Line((1, 1), slope=1) == Line((1, 1), (2, 2))
assert Line((1, 1), slope=oo) == Line((1, 1), (1, 2))
assert Line((1, 1), slope=-oo) == Line((1, 1), (1, 2))
raises(TypeError, lambda: Line((1, 1), 1))
assert Line(p1, p2) == Line(p1, p2)
assert Line(p1, p2) != Line(p2, p1)
assert l1 != l2
assert l1 != l3
assert l1.slope == 1
assert l1.length == oo
assert l3.slope == oo
assert l4.slope == 0
assert l4.coefficients == (0, 1, 0)
assert l4.equation(x=x, y=y) == y
assert l5.slope == oo
assert l5.coefficients == (1, 0, 0)
assert l5.equation() == x
assert l6.equation() == x - 2
assert l7.equation() == y - 1
assert p1 in l1 # is p1 on the line l1?
assert p1 not in l3
assert Line((-x, x), (-x + 1, x - 1)).coefficients == (1, 1, 0)
assert simplify(l1.equation()) in (x - y, y - x)
assert simplify(l3.equation()) in (x - x1, x1 - x)
assert Line(p1, p2).scale(2, 1) == Line(p1, p9)
assert l2.arbitrary_point() in l2
for ind in range(0, 5):
assert l3.random_point() in l3
# Orthogonality
p1_1 = Point(-x1, x1)
l1_1 = Line(p1, p1_1)
assert l1.perpendicular_line(p1.args).equals( Line(Point(0, 0), Point(1, -1)) )
assert l1.perpendicular_line(p1).equals( Line(Point(0, 0), Point(1, -1)) )
assert Line.is_perpendicular(l1, l1_1)
assert Line.is_perpendicular(l1, l2) is False
p = l1.random_point()
assert l1.perpendicular_segment(p) == p
# Parallelity
l2_1 = Line(p3, p5)
assert l2.parallel_line(p1_1).equals( Line(Point(-x1, x1), Point(-y1, 2*x1 - y1)) )
assert l2_1.parallel_line(p1.args).equals( Line(Point(0, 0), Point(0, -1)) )
assert l2_1.parallel_line(p1).equals( Line(Point(0, 0), Point(0, -1)) )
assert Line.is_parallel(l1, l2)
assert Line.is_parallel(l2, l3) is False
assert Line.is_parallel(l2, l2.parallel_line(p1_1))
assert Line.is_parallel(l2_1, l2_1.parallel_line(p1))
# Intersection
assert intersection(l1, p1) == [p1]
assert intersection(l1, p5) == []
assert intersection(l1, l2) in [[l1], [l2]]
assert intersection(l1, l1.parallel_line(p5)) == []
# Concurrency
l3_1 = Line(Point(5, x1), Point(-Rational(3, 5), x1))
assert Line.are_concurrent(l1) is False
assert Line.are_concurrent(l1, l3)
assert Line.are_concurrent(l1, l1, l1, l3)
assert Line.are_concurrent(l1, l3, l3_1)
assert Line.are_concurrent(l1, l1_1, l3) is False
# Projection
assert l2.projection(p4) == p4
assert l1.projection(p1_1) == p1
assert l3.projection(p2) == Point(x1, 1)
raises(GeometryError, lambda: Line(Point(0, 0), Point(1, 0))
.projection(Circle(Point(0, 0), 1)))
# Finding angles
#.........这里部分代码省略.........
示例12: test_concyclic_doctest_bug
def test_concyclic_doctest_bug():
p1, p2 = Point(-1, 0), Point(1, 0)
p3, p4 = Point(0, 1), Point(-1, 2)
assert Point.is_concyclic(p1, p2, p3)
assert not Point.is_concyclic(p1, p2, p3, p4)
示例13: test_line
def test_line():
p1 = Point(0, 0)
p2 = Point(1, 1)
p3 = Point(x1, x1)
p4 = Point(y1, y1)
p5 = Point(x1, 1 + x1)
p6 = Point(1, 0)
p7 = Point(0, 1)
p8 = Point(2, 0)
p9 = Point(2, 1)
l1 = Line(p1, p2)
l2 = Line(p3, p4)
l3 = Line(p3, p5)
l4 = Line(p1, p6)
l5 = Line(p1, p7)
l6 = Line(p8, p9)
l7 = Line(p2, p9)
raises(ValueError, lambda: Line(Point(0, 0), Point(0, 0)))
# Basic stuff
assert Line((1, 1), slope=1) == Line((1, 1), (2, 2))
assert Line((1, 1), slope=oo) == Line((1, 1), (1, 2))
assert Line((1, 1), slope=-oo) == Line((1, 1), (1, 2))
raises(ValueError, lambda: Line((1, 1), 1))
assert Line(p1, p2) == Line(p2, p1)
assert l1 == l2
assert l1 != l3
assert l1.slope == 1
assert l1.length == oo
assert l3.slope == oo
assert l4.slope == 0
assert l4.coefficients == (0, 1, 0)
assert l4.equation(x=x, y=y) == y
assert l5.slope == oo
assert l5.coefficients == (1, 0, 0)
assert l5.equation() == x
assert l6.equation() == x - 2
assert l7.equation() == y - 1
assert p1 in l1 # is p1 on the line l1?
assert p1 not in l3
assert Line((-x, x), (-x + 1, x - 1)).coefficients == (1, 1, 0)
assert simplify(l1.equation()) in (x - y, y - x)
assert simplify(l3.equation()) in (x - x1, x1 - x)
assert Line(p1, p2).scale(2, 1) == Line(p1, p9)
assert l2.arbitrary_point() in l2
for ind in xrange(0, 5):
assert l3.random_point() in l3
# Orthogonality
p1_1 = Point(-x1, x1)
l1_1 = Line(p1, p1_1)
assert l1.perpendicular_line(p1) == l1_1
assert Line.is_perpendicular(l1, l1_1)
assert Line.is_perpendicular(l1, l2) == False
p = l1.random_point()
assert l1.perpendicular_segment(p) == p
# Parallelity
p2_1 = Point(-2 * x1, 0)
l2_1 = Line(p3, p5)
assert l2.parallel_line(p1_1) == Line(p2_1, p1_1)
assert l2_1.parallel_line(p1) == Line(p1, Point(0, 2))
assert Line.is_parallel(l1, l2)
assert Line.is_parallel(l2, l3) == False
assert Line.is_parallel(l2, l2.parallel_line(p1_1))
assert Line.is_parallel(l2_1, l2_1.parallel_line(p1))
# Intersection
assert intersection(l1, p1) == [p1]
assert intersection(l1, p5) == []
assert intersection(l1, l2) in [[l1], [l2]]
assert intersection(l1, l1.parallel_line(p5)) == []
# Concurrency
l3_1 = Line(Point(5, x1), Point(-Rational(3, 5), x1))
assert Line.is_concurrent(l1) == False
assert Line.is_concurrent(l1, l3)
assert Line.is_concurrent(l1, l3, l3_1)
assert Line.is_concurrent(l1, l1_1, l3) == False
# Projection
assert l2.projection(p4) == p4
assert l1.projection(p1_1) == p1
assert l3.projection(p2) == Point(x1, 1)
raises(GeometryError, lambda: Line(Point(0, 0), Point(1, 0)).projection(Circle(Point(0, 0), 1)))
# Finding angles
l1_1 = Line(p1, Point(5, 0))
assert feq(Line.angle_between(l1, l1_1).evalf(), pi.evalf() / 4)
# Testing Rays and Segments (very similar to Lines)
assert Ray((1, 1), angle=pi / 4) == Ray((1, 1), (2, 2))
assert Ray((1, 1), angle=pi / 2) == Ray((1, 1), (1, 2))
assert Ray((1, 1), angle=-pi / 2) == Ray((1, 1), (1, 0))
assert Ray((1, 1), angle=-3 * pi / 2) == Ray((1, 1), (1, 2))
assert Ray((1, 1), angle=5 * pi / 2) == Ray((1, 1), (1, 2))
#.........这里部分代码省略.........
示例14: test_point
def test_point():
p1 = Point(x1, x2)
p2 = Point(y1, y2)
p3 = Point(0, 0)
p4 = Point(1, 1)
assert p3.x == 0
assert p3.y == 0
assert p4.x == 1
assert p4.y == 1
assert len(p1) == 2
assert p2[1] == y2
assert (p3+p4) == p4
assert (p2-p1) == Point(y1-x1, y2-x2)
assert p4*5 == Point(5, 5)
assert -p2 == Point(-y1, -y2)
assert Point.midpoint(p3, p4) == Point(half, half)
assert Point.midpoint(p1, p4) == Point(half + half*x1, half + half*x2)
assert Point.midpoint(p2, p2) == p2
assert Point.distance(p3, p4) == sqrt(2)
assert Point.distance(p1, p1) == 0
#assert Point.distance(p3, p2) == abs(p2)
p1_1 = Point(x1, x1)
p1_2 = Point(y2, y2)
p1_3 = Point(x1 + 1, x1)
assert Point.is_collinear(p3)
assert Point.is_collinear(p3, p4)
assert Point.is_collinear(p3, p4, p1_1, p1_2)
assert Point.is_collinear(p3, p4, p1_1, p1_3) == False
x_pos = Symbol('x', real=True, positive=True)
p2_1 = Point(x_pos, 0)
p2_2 = Point(0, x_pos)
p2_3 = Point(-x_pos, 0)
p2_4 = Point(0, -x_pos)
p2_5 = Point(x_pos, 5)
assert Point.is_concyclic(p2_1)
assert Point.is_concyclic(p2_1, p2_2)
assert Point.is_concyclic(p2_1, p2_2, p2_3, p2_4)
assert Point.is_concyclic(p2_1, p2_2, p2_3, p2_5) == False
示例15: test__normalize_dimension
def test__normalize_dimension():
assert Point._normalize_dimension(Point(1, 2), Point(3, 4)) == [
Point(1, 2), Point(3, 4)]
assert Point._normalize_dimension(
Point(1, 2), Point(3, 4, 0), on_morph='ignore') == [
Point(1, 2, 0), Point(3, 4, 0)]