Base classes for triangulations
We provide (fast) cython implementations here.
AUTHORS:
Bases: sage.structure.sage_object.SageObject
A Python shim for the C++-class ‘triangulations’
INPUT:
point_configuration – a PointConfiguration.
seed – a regular triangulation or None (default). In the latter case, a suitable triangulation is generated automatically. Otherwise, you can explicitly specify the seed triangulation as
- A Triangulation object, or
- an iterable of iterables specifying the vertices of the simplices, or
- an iterable of integers, which are then considered the enumerated simplices (see simplex_to_int().
star – either None (default) or an integer. If an integer is passed, all returned triangulations will be star with respect to the
fine – boolean (default: False). Whether to return only fine triangulations, that is, simplicial decompositions that make use of all the points of the configuration.
OUTPUT:
An iterator. The generated values are tuples of integers, which encode simplices of the triangulation. The output is a suitable input to Triangulation.
EXAMPLES:
sage: p = PointConfiguration([[0,0],[0,1],[1,0],[1,1],[-1,-1]])
sage: from sage.geometry.triangulation.base import ConnectedTriangulationsIterator
sage: ci = ConnectedTriangulationsIterator(p)
sage: ci.next()
(9, 10)
sage: ci.next()
(2, 3, 4, 5)
sage: ci.next()
(7, 8)
sage: ci.next()
(1, 3, 5, 7)
sage: ci.next()
Traceback (most recent call last):
...
StopIteration
You can reconstruct the triangulation from the compressed output via:
sage: from sage.geometry.triangulation.element import Triangulation
sage: Triangulation((2, 3, 4, 5), p)
(<0,1,3>, <0,1,4>, <0,2,3>, <0,2,4>)
How to use the restrictions:
sage: ci = ConnectedTriangulationsIterator(p, fine=True)
sage: list(ci)
[(2, 3, 4, 5), (1, 3, 5, 7)]
sage: ci = ConnectedTriangulationsIterator(p, star=1)
sage: list(ci)
[(7, 8)]
sage: ci = ConnectedTriangulationsIterator(p, star=1, fine=True)
sage: list(ci)
[]
x.next() -> the next value, or raise StopIteration
Bases: sage.structure.sage_object.SageObject
A point of a point configuration.
Note that the coordinates of the points of a point configuration are somewhat arbitrary. What counts are the abstract linear relations between the points, for example encoded by the circuits().
Warning
You should not create Point objects manually. The constructor of PointConfiguration_base takes care of this for you.
INPUT:
EXAMPLES:
sage: pc = PointConfiguration([(0,0)])
sage: from sage.geometry.triangulation.base import Point
sage: Point(pc, 123, (0,0,1), (0,0), ())
P(0, 0)
Return the affine coordinates of the point in the ambient space.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
Return the index of the point in the point configuration.
EXAMPLES:
sage: pc = PointConfiguration([[0, 1], [0, 0], [1, 0]])
sage: p = pc.point(2); p
P(1, 0)
sage: p.index()
2
Return the point configuration to which the point belongs.
OUTPUT:
EXAMPLES:
sage: pc = PointConfiguration([ (0,0), (1,0), (0,1) ]) sage: p = pc.point(0) sage: p is pc.point(0) True sage: p.point_configuration() is pc True
Return the projective coordinates of the point in the ambient space.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
Return the affine coordinates of the point on the hyperplane spanned by the point configuration.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
Return the affine coordinates of the point on the hyperplane spanned by the point configuration.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
Return the projective coordinates of the point on the hyperplane spanned by the point configuration.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
Return the affine coordinates of the point on the hyperplane spanned by the point configuration.
OUTPUT:
A tuple containing the coordinates.
EXAMPLES:
sage: pc = PointConfiguration([[10, 0, 1], [10, 0, 0], [10, 2, 3]])
sage: p = pc.point(2); p
P(10, 2, 3)
sage: p.affine()
(10, 2, 3)
sage: p.projective()
(10, 2, 3, 1)
sage: p.reduced_affine()
(2, 2)
sage: p.reduced_projective()
(2, 2, 1)
sage: p.reduced_affine_vector()
(2, 2)
sage: type(p.reduced_affine_vector())
<type 'sage.modules.vector_rational_dense.Vector_rational_dense'>
Bases: sage.structure.parent.Parent
The cython abstract base class for PointConfiguration.
Warning
You should not instantiate this base class, but only its derived class PointConfiguration.
Return the dimension of the ambient space of the point configuration.
See also dimension()
EXAMPLES:
sage: p = PointConfiguration([[0,0,0]])
sage: p.ambient_dim()
3
sage: p.dim()
0
Return the base ring, that is, the ring containing the coordinates of the points.
OUTPUT:
A ring.
EXAMPLES:
sage: p = PointConfiguration([(0,0)])
sage: p.base_ring()
Integer Ring
sage: p = PointConfiguration([(1/2,3)])
sage: p.base_ring()
Rational Field
sage: p = PointConfiguration([(0.2, 5)])
sage: p.base_ring()
Real Field with 53 bits of precision
Return the actual dimension of the point configuration.
See also ambient_dim()
EXAMPLES:
sage: p = PointConfiguration([[0,0,0]])
sage: p.ambient_dim()
3
sage: p.dim()
0
Reverses the enumeration of possible simplices in simplex_to_int().
The enumeration is compatible with [PUNTOS].
INPUT:
OUTPUT:
An ordered tuple consisting of the indices of the vertices of the simplex.
EXAMPLES:
sage: U=matrix([
... [ 0, 0, 0, 0, 0, 2, 4,-1, 1, 1, 0, 0, 1, 0],
... [ 0, 0, 0, 1, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0],
... [ 0, 2, 0, 0, 0, 0,-1, 0, 1, 0, 1, 0, 0, 1],
... [ 0, 1, 1, 0, 0, 1, 0,-2, 1, 0, 0,-1, 1, 1],
... [ 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 0, 0, 0]
... ])
sage: pc = PointConfiguration(U.columns())
sage: pc.simplex_to_int([1,3,4,7,10,13])
1678
sage: pc.int_to_simplex(1678)
(1, 3, 4, 7, 10, 13)
Whether the configuration is defined by affine points.
OUTPUT:
Boolean. If true, the homogeneous coordinates all have as
their last entry.
EXAMPLES:
sage: p = PointConfiguration([(0.2, 5), (3, 0.1)])
sage: p.is_affine()
True
sage: p = PointConfiguration([(0.2, 5, 1), (3, 0.1, 1)], projective=True)
sage: p.is_affine()
False
Return the number of points.
Same as len(self).
EXAMPLES:
sage: p = PointConfiguration([[0,0],[0,1],[1,0],[1,1],[-1,-1]])
sage: p
A point configuration in QQ^2 consisting of 5 points. The
triangulations of this point configuration are assumed to
be connected, not necessarily fine, not necessarily regular.
sage: len(p)
5
sage: p.n_points()
5
Return the i-th point of the configuration.
Same as __getitem__()
INPUT:
OUTPUT:
A point of the point configuration.
EXAMPLES:
sage: pconfig = PointConfiguration([[0,0],[0,1],[1,0],[1,1],[-1,-1]])
sage: list(pconfig)
[P(0, 0), P(0, 1), P(1, 0), P(1, 1), P(-1, -1)]
sage: [ p for p in pconfig.points() ]
[P(0, 0), P(0, 1), P(1, 0), P(1, 1), P(-1, -1)]
sage: pconfig.point(0)
P(0, 0)
sage: pconfig[0]
P(0, 0)
sage: pconfig.point(1)
P(0, 1)
sage: pconfig.point( pconfig.n_points()-1 )
P(-1, -1)
Return a list of the points.
OUTPUT:
Returns a list of the points. See also the __iter__() method, which returns the corresponding generator.
EXAMPLES:
sage: pconfig = PointConfiguration([[0,0],[0,1],[1,0],[1,1],[-1,-1]])
sage: list(pconfig)
[P(0, 0), P(0, 1), P(1, 0), P(1, 1), P(-1, -1)]
sage: [ p for p in pconfig.points() ]
[P(0, 0), P(0, 1), P(1, 0), P(1, 1), P(-1, -1)]
sage: pconfig.point(0)
P(0, 0)
sage: pconfig.point(1)
P(0, 1)
sage: pconfig.point( pconfig.n_points()-1 )
P(-1, -1)
Return the vector space that contains the affine points.
OUTPUT:
A vector space over the fraction field of base_ring().
EXAMPLES:
sage: p = PointConfiguration([[0,0,0], [1,2,3]])
sage: p.base_ring()
Integer Ring
sage: p.reduced_affine_vector_space()
Vector space of dimension 1 over Rational Field
sage: p.reduced_projective_vector_space()
Vector space of dimension 2 over Rational Field
Return the vector space that is spanned by the homogeneous coordinates.
OUTPUT:
A vector space over the fraction field of base_ring().
EXAMPLES:
sage: p = PointConfiguration([[0,0,0], [1,2,3]])
sage: p.base_ring()
Integer Ring
sage: p.reduced_affine_vector_space()
Vector space of dimension 1 over Rational Field
sage: p.reduced_projective_vector_space()
Vector space of dimension 2 over Rational Field
Returns an integer that uniquely identifies the given simplex.
See also the inverse method int_to_simplex().
The enumeration is compatible with [PUNTOS].
INPUT:
OUTPUT:
An integer that uniquely specifies the simplex.
EXAMPLES:
sage: U=matrix([
... [ 0, 0, 0, 0, 0, 2, 4,-1, 1, 1, 0, 0, 1, 0],
... [ 0, 0, 0, 1, 0, 0,-1, 0, 0, 0, 0, 0, 0, 0],
... [ 0, 2, 0, 0, 0, 0,-1, 0, 1, 0, 1, 0, 0, 1],
... [ 0, 1, 1, 0, 0, 1, 0,-2, 1, 0, 0,-1, 1, 1],
... [ 0, 0, 0, 0, 1, 0,-1, 0, 0, 0, 0, 0, 0, 0]
... ])
sage: pc = PointConfiguration(U.columns())
sage: pc.simplex_to_int([1,3,4,7,10,13])
1678
sage: pc.int_to_simplex(1678)
(1, 3, 4, 7, 10, 13)