Did I find the right examples for you? yes no

All Samples(72)  |  Call(69)  |  Derive(0)  |  Import(3)
An undirected line segment in space.

A segment is declared with two distinct points.

Note:
At the moment only segments in a 2D space can be declared, because
Points can be defined only for 2D spaces.

*Example*
(more...)

src/s/y/sympy-HEAD/sympy/geometry/util.py   sympy(Download)
    """
 
    from sympy.geometry import Polygon, Segment, Point
    if args:
        if all(isinstance(g, Point) for g in args):

src/s/y/sympy-HEAD/sympy/geometry/tests/test_geometry.py   sympy(Download)
from sympy import (Abs, C, Dummy, Rational, Float, S, Symbol, cos, oo, pi,
                   simplify, sin, sqrt, symbols, tan)
from sympy.geometry import (Circle, Curve, Ellipse, GeometryError, Line, Point,
                            Polygon, Ray, RegularPolygon, Segment, Triangle,
                            are_similar, convex_hull, intersection, centroid)
        Point(t + 1, t + 1)
 
    s1 = Segment(p1, p2)
    s2 = Segment(p1, p1_1)
    assert s1.midpoint == Point(Rational(1, 2), Rational(1, 2))
    # intersections
    assert s1.intersection(Line(p6, p9)) == []
    s3 = Segment(Point(0.25, 0.25), Point(0.5, 0.5))
    assert s1.intersection(s3) == [s1]
    assert s3.intersection(s1) == [s3]
    assert r4.intersection(s3) == [s3]
    assert r4.intersection(Segment(Point(2, 3), Point(3, 4))) == []

src/s/y/sympy-polys-HEAD/sympy/geometry/tests/test_geometry.py   sympy-polys(Download)
from sympy import Symbol, Rational, sqrt, pi, cos, oo, simplify, Real, raises
from sympy.geometry import Point, Polygon, convex_hull, Segment, \
        RegularPolygon, Circle, Ellipse, GeometryError, Line, intersection, \
        Ray, Triangle, are_similar, Curve
 
    assert r3 != r1
 
    s1 = Segment(p1, p2)
    s2 = Segment(p1, p1_1)
    assert s1.midpoint == Point(Rational(1,2), Rational(1,2))
    r3 = Ray(Point(1, 1), Point(-1, -1))
    r4 = Ray(Point(0, 4), Point(-1, -5))
    assert intersection(r1, r2) == [Segment(Point(1, 1), Point(2, 2))]
    assert intersection(r1, r3) == [Point(1, 1)]
    assert r1.projection(r3) == Point(1, 1)
    assert r1.projection(r4) == Segment(Point(1, 1), Point(2, 2))