Skip to content

Commit 4346d9d

Browse files
authored
Merge pull request #1503 from TiagoCavalcanteTrindade/add-mathics-threejs-backend-version
Add mathics-threejs-backend version
2 parents d2f6ce8 + 42840e7 commit 4346d9d

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

mathics/builtin/box/graphics3d.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -388,6 +388,7 @@ def boxes_to_json(self, leaves=None, **options):
388388
},
389389
"lighting": self.lighting,
390390
"viewpoint": self.viewpoint,
391+
"protocol": "1.0",
391392
}
392393
)
393394

mathics/format/svg.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ def density_plot_box(self, **options):
178178
for index, triangle_coords in enumerate(self.lines):
179179
triangle = [coords.pos() for coords in triangle_coords]
180180
colors = [rgb.to_js() for rgb in self.vertex_colors[index]]
181-
r = (colors[0][0] + colors[1][0] + colors[2][0]) / 3.0
182-
g = (colors[0][1] + colors[1][1] + colors[2][1]) / 3.0
183-
b = (colors[0][2] + colors[1][2] + colors[2][1]) / 3.0
184-
mid_color = r"rgb(%f%%, %f%%, %f%%)" % (r * 100, g * 100, b * 100)
181+
r = (colors[0][0] + colors[1][0] + colors[2][0]) / 3
182+
g = (colors[0][1] + colors[1][1] + colors[2][1]) / 3
183+
b = (colors[0][2] + colors[1][2] + colors[2][1]) / 3
184+
mid_color = r"rgb(%f, %f, %f)" % (r * 255, g * 255, b * 255)
185185

186186
points = " ".join("%f,%f" % (point[0], point[1]) for point in triangle)
187-
svg_data.append(f'<polygon points="{points}" style="fill: {mid_color}" />')
187+
svg_data.append(f'<polygon points="{points}" fill="{mid_color}" />')
188188

189189
svg = "\n".join(svg_data)
190190
# print("DensityPlot: ", svg)

0 commit comments

Comments
 (0)