Skip to content

Commit

Permalink
add edgecolours to js as well, working on #59
Browse files Browse the repository at this point in the history
  • Loading branch information
schnellecom committed Nov 23, 2023
1 parent ba51b25 commit 5bb709f
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions gap/javascript/draw.gi
Original file line number Diff line number Diff line change
Expand Up @@ -928,14 +928,24 @@ InstallMethod( DrawComplexToJavaScript,
# for each color there is a new geometry and material generated. these are then combined into a mesh and added to the root group
faceColors := GetFaceColours(surface, printRecord);

# generate a list of all unique colors of the faces
# generate a list of all unique colors of the edges and faces
uniqueFaceColors := [];
for color in faceColors do
if not color in uniqueFaceColors then
Add(uniqueFaceColors, color);
fi;
od;

edgeColors := GetEdgeColours(surface, printRecord);

uniqueEdgeColors := [];
uniqueEdgeColorsActive := [];
for color in edgeColors do
if not color in uniqueEdgeColors then
Add(uniqueEdgeColors, color);
fi;
od;

AppendTo(output, "\n\t// --- start of generated output --- //\n\n");

# write the incidence, colours and coordinates in a single place to reduce storage later
Expand All @@ -955,6 +965,19 @@ InstallMethod( DrawComplexToJavaScript,
# od;
# AppendTo(output, "\t];\n\n");

# AppendTo(output, "\tconst uniqueEdgeColors = [\n");
# for colour in uniqueEdgeColors do
# AppendTo(output, "\t\t\"", colour ,"\",\n");
# od;
# AppendTo(output, "\t];\n\n");

# AppendTo(output, "\t// the edge colours w.r.t. the uniqueEdgeColours defined before so edge[i] has uniqueEdgeColour[edgeColour[i]]\n");
# AppendTo(output, "\tconst edgeColors = [");
# for edge in Edges(surface) do
# AppendTo(output, Position(uniqueEdgeColors, GetEdgeColour(oct, edge, printRecord)) ,", ");
# od;
# AppendTo(output, "];\n\n");

# AppendTo(output, "\tconst faces = [\n");
# for face in Faces(surface) do
# AppendTo(output, "\t\t[", Position(vertices, VerticesOfFace(surface, face)[1]), ", ",
Expand Down Expand Up @@ -1097,16 +1120,6 @@ InstallMethod( DrawComplexToJavaScript,
# add edges to geometry by iterating over all colors
# for each color there is a new geometry and material generated. these are then combined into a mesh and added to the edgeRoot group
AppendTo(output, "\n\t// generate the edges grouped by color\n");
edgeColors := GetEdgeColours(surface, printRecord);

# generate a list of all unique colors of the faces
uniqueEdgeColors := [];
uniqueEdgeColorsActive := [];
for color in edgeColors do
if not color in uniqueEdgeColors then
Add(uniqueEdgeColors, color);
fi;
od;

for color in uniqueEdgeColors do
delete := true;
Expand Down

0 comments on commit 5bb709f

Please sign in to comment.