UNPKG

@qbead/bloch-sphere

Version:

A 3D Bloch Sphere visualisation built with Three.js and TypeScript.

21 lines (18 loc) 411 B
import { BlochVector } from '../math/bloch-vector' import { Wedge } from './wedge' /** * A wedge which is a quarter of a circle */ export class QubitProjWedge extends Wedge { constructor() { super() } follow(v: BlochVector) { const { theta, phi } = v if (theta > Math.PI / 2) { this.rotation.set(0, Math.PI, Math.PI - phi) } else { this.rotation.set(0, 0, phi) } } }