-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add exponent to the labels of web 3D gates (#4777)
This pull request fixes the bug reported in #4761. The exponents of gates are not reflected in the labels of 3D circuits. This PR adds it using `CircuitDiagramInfo._wire_symbols_including_formatted_exponent`, which has been used in the generation of the text circuit diagrams. Another problem raises after the exponents are added. The color of the `X` gate is chosen as black, and the label's color is also black. As a result, the label cannot be recognized. To solve this problem, I set the label's color according to the brightness of the gate color. If it is dark (e.g., in the case of black), white is picked for the label. The color parameter for `MeshBasicMaterial` has also to be changed to avoid shadowing the label. After the modification, the test case used in the #4761 ``` import cirq_web a, b, c, d = cirq.GridQubit.rect(2, 2) cirq_web.Circuit3D(cirq.Circuit(cirq.X(a)**0.5, cirq.Y(b)**0.5, cirq.X(c), cirq.Y(d))).generate_html_file( file_name="hello.html") ``` generates this circuit:  close #4761
- Loading branch information
Showing
4 changed files
with
26 additions
and
5 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters