Skip to content

Commit

Permalink
Hide azimuthalAngleIndicator when vertical, see #54
Browse files Browse the repository at this point in the history
  • Loading branch information
AgustinVallejo committed Jan 9, 2025
1 parent 0135cac commit add7787
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions js/common/view/BlochSphereNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,17 +281,21 @@ export default class BlochSphereNode extends Node {
false
);

azimuthalAngleIndicator.shape = new Shape().ellipticalArc(
0,
0,
equatorSemiMajorAxis / 2,
equatorSemiMinorAxis / 2,
0,
// Begins with offset; Ends at the azimuthal angle with an adjustement due to the sphere perspective
-xAxisOffsetAngle + Math.PI / 2,
-( azimuthalAngle + xAxisOffsetAngle - Math.PI / 2 ) % ( 2 * Math.PI ),
true
);
if ( options.drawAngleIndicators && Math.abs( Math.sin( polarAngle ) ) > 1e-5 ) {
azimuthalAngleIndicator.shape = new Shape().ellipticalArc(
0,
0,
equatorSemiMajorAxis / 2,
equatorSemiMinorAxis / 2,
0,
// Begins with offset; Ends at the azimuthal angle with an adjustement due to the sphere perspective
-xAxisOffsetAngle + Math.PI / 2,
-( azimuthalAngle + xAxisOffsetAngle - Math.PI / 2 ) % ( 2 * Math.PI ),
true
);
azimuthalAngleIndicator.visible = true;
}
azimuthalAngleIndicator.visible = false;
}
);
}
Expand Down

0 comments on commit add7787

Please sign in to comment.