Skip to content

Commit

Permalink
Merge pull request #290 from MeikeWeiss/doubleGon
Browse files Browse the repository at this point in the history
Added method for double n-gon
  • Loading branch information
MeikeWeiss authored Sep 23, 2024
2 parents b00a8a3 + 252c13f commit 8264009
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
30 changes: 29 additions & 1 deletion gap/Library/library.gd
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,6 @@ DeclareOperation( "JanusHead", [] );
#! [ [ 1, 2, 5 ], [ 2, 3, 6 ], [ 3, 4, 7 ], [ 1, 4, 8 ] ]
#! gap> VerticesOfFaces(umb4);
#! [ [ 1, 2, 5 ], [ 2, 3, 5 ], [ 3, 4, 5 ], [ 1, 4, 5 ] ]
#! gap>
#! gap> umb2 := SimplicialUmbrella(2);
#! simplicial surface (3 vertices, 4 edges, and 2 faces)
#! gap> VerticesOfEdges(umb2);
Expand All @@ -476,6 +475,35 @@ DeclareOperation( "JanusHead", [] );
DeclareOperation("SimplicialUmbrella", [ IsPosInt ] );
DeclareSynonym("SimplicialGon", SimplicialUmbrella);

#! <ManSection Label="SimplicialDoubleUmbrella">
#! <Oper Name="SimplicialDoubleUmbrella" Arg="nrFaces" Label="for IsPosInt"/>
#! <Filt Name="SimplicialDoubleGon" Arg="nrFaces" Type="operation"/>
#! <Returns><K>a simplicial surface</K></Returns>
#! <Description>
#! Return a simplicial surface consisting of two closed umbrella-paths
#! with <A>nrFaces</A> triangles which are joined at their boundary.
#! The labels of one umbrella are assigned according to the illustration for <E>SimplicialUmbrella</E>,
#! the additional vertex is labelled with <A>nrFaces+2</A>, the incident edges to this vertex
#! are labelled from <A>2*nrFaces+1</A> to <A>4*nrFaces</A> and the incident faces are labelled from
#! <A>nrFaces+1</A> to <A>2*nrFaces</A>.
#! @ExampleSession
#! gap> doubleumb2:=SimplicialDoubleUmbrella(2);
#! simplicial surface (4 vertices, 6 edges, and 4 faces)
#! gap> VerticesOfEdges(doubleumb2);
#! [ [ 1, 3 ], [ 2, 3 ], [ 1, 2 ], [ 1, 2 ], [ 1, 4 ], [ 2, 4 ] ]
#! gap> EdgesOfFaces(doubleumb2);
#! [ [ 1, 2, 3 ], [ 1, 2, 4 ], [ 3, 5, 6 ], [ 4, 5, 6 ] ]
#! gap> doubleumb4:=SimplicialDoubleUmbrella(4);
#! simplicial surface (6 vertices, 12 edges, and 8 faces)
#! gap> IsIsomorphic(doubleumb4,Octahedron());
#! true
#! @EndExampleSession
#! </Description>
#! </ManSection>
# here no AutoDoc documentation since synonyms can't be handled automatically
DeclareOperation("SimplicialDoubleUmbrella", [ IsPosInt ] );
DeclareSynonym("SimplicialDoubleGon", SimplicialDoubleUmbrella);

#! @BeginGroup SimplicialOpenGeodesic
#! @Description
#! Return a simplicial surface consisting of one non-closed geodesic-path
Expand Down
24 changes: 24 additions & 0 deletions gap/Library/library.gi
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,30 @@ InstallMethod( SimplicialUmbrella, "for an integer at least 2", [IsPosInt],
end
);

InstallMethod(SimplicialDoubleUmbrella, "for an integer at least 2", [IsPosInt],
function(nrFaces)
local umbr, verticesOfEdges, edgesOfFaces, i;

if nrFaces = 1 then
Error("SimplicialUmbrella: Argument has to be greater than 1.");
fi;

umbr:=SimplicialUmbrella(nrFaces);
verticesOfEdges:=ShallowCopy(VerticesOfEdges(umbr));
edgesOfFaces:=ShallowCopy(EdgesOfFaces(umbr));

for i in [1..nrFaces-1] do
edgesOfFaces[i+nrFaces] := [i+nrFaces,2*nrFaces+i,2*nrFaces+i+1];

verticesOfEdges[2*nrFaces+i] := [i,nrFaces+2];
od;
edgesOfFaces[2*nrFaces] := [2*nrFaces,2*nrFaces+nrFaces, 2*nrFaces+1];
verticesOfEdges[2*nrFaces+nrFaces]:=[nrFaces, nrFaces+2];

return SimplicialSurfaceByDownwardIncidenceNC(verticesOfEdges, edgesOfFaces);
end);


InstallMethod( SimplicialOpenGeodesic, "for an integer at least 1", [IsPosInt],
function(nrFaces)
local verticesOfFaces;
Expand Down

0 comments on commit 8264009

Please sign in to comment.