similarity
¶
Initialize self. See help(type(self)) for accurate signature.
- class flatsurf.geometry.similarity.Similarity(p, a, b, s, t, sign)[source]¶
Class for a similarity of the plane with possible reflection.
Construct the similarity (x,y) mapsto (ax-by+s,bx+ay+t) if sign=1, and (ax+by+s,bx-ay+t) if sign=-1
- derivative()[source]¶
Return the 2x2 matrix corresponding to the derivative of this element
EXAMPLES:
sage: from flatsurf.geometry.similarity import SimilarityGroup sage: S = SimilarityGroup(QQ) sage: S((1,-2/3,1,1,-1)).derivative() [ 1 -2/3] [-2/3 -1]
- is_half_translation()[source]¶
Return whether this element is a half translation.
EXAMPLES:
sage: from flatsurf.geometry.similarity import SimilarityGroup sage: S = SimilarityGroup(QQ) sage: S((1,2)).is_half_translation() True sage: S((-1, 0, 0, 2)).is_half_translation() True sage: S((0,1,0,0)).is_half_translation() False
- is_isometry()[source]¶
Check whether this element is an isometry
EXAMPLES:
sage: from flatsurf.geometry.similarity import SimilarityGroup sage: S = SimilarityGroup(QQ) sage: S.one().is_isometry() True sage: S((0,1,0,0)).is_isometry() True sage: S((0,1,0,0,-1)).is_isometry() True sage: S((1,1,0,0)).is_isometry() False sage: S((3,-1/2)).is_isometry() True
- is_rotation()[source]¶
Check whether this element is a rotation
EXAMPLES:
sage: from flatsurf.geometry.similarity import SimilarityGroup sage: S = SimilarityGroup(QQ) sage: S((1,2)).is_rotation() False sage: S((0,-1,0,0)).is_rotation() True sage: S.one().is_rotation() True
- is_translation()[source]¶
Return whether this element is a translation.
EXAMPLES:
sage: from flatsurf.geometry.similarity import SimilarityGroup sage: S = SimilarityGroup(QQ) sage: S((1,2)).is_translation() True sage: S((1,0,3,-1/2)).is_translation() True sage: S((0,1,0,0)).is_translation() False
- class flatsurf.geometry.similarity.SimilarityGroup(base_ring)[source]¶
The group of possibly orientation reversing similarities in the plane.
This is the group generated by rotations, translations and dilations.
- Element¶
alias of
Similarity
- flatsurf.geometry.similarity.similarity_from_vectors(u, v, matrix_space=None)[source]¶
Return the unique similarity matrix that maps
u
tov
.EXAMPLES:
sage: from flatsurf.geometry.similarity import similarity_from_vectors sage: V = VectorSpace(QQ,2) sage: u = V((1,0)) sage: v = V((0,1)) sage: m = similarity_from_vectors(u,v); m [ 0 -1] [ 1 0] sage: m*u == v True sage: u = V((2,1)) sage: v = V((1,-2)) sage: m = similarity_from_vectors(u,v); m [ 0 1] [-1 0] sage: m * u == v True
An example built from the Pythagorean triple 3^2 + 4^2 = 5^2:
sage: u2 = V((5,0)) sage: v2 = V((3,4)) sage: m = similarity_from_vectors(u2,v2); m [ 3/5 -4/5] [ 4/5 3/5] sage: m * u2 == v2 True
Some test over number fields:
sage: K.<sqrt2> = NumberField(x^2-2, embedding=1.4142) sage: V = VectorSpace(K,2) sage: u = V((sqrt2,0)) sage: v = V((1, 1)) sage: m = similarity_from_vectors(u,v); m [ 1/2*sqrt2 -1/2*sqrt2] [ 1/2*sqrt2 1/2*sqrt2] sage: m*u == v True sage: m = similarity_from_vectors(u, 2*v); m [ sqrt2 -sqrt2] [ sqrt2 sqrt2] sage: m*u == 2*v True