/// <summary> /// Initialise a new U3 gate. /// </summary> /// <param name="qubit"> The qubit on which this gate should operate. </param> /// <param name="theta"> The first angle of this U3 gate. /param> /// <param name="phi"> The second angle of this U3 gate. </param> /// <param name="lambda"> The third angle of this U3 gate. </param> /// <param name="gatePart"> The gatepart this U3 gate represents. </param> public U3(int qubit, double theta, double phi, double lambda, GatePart gatePart) : base(new List <int> { qubit }) { Theta = theta; Phi = phi; Lambda = lambda; GatePart = gatePart; }
private void Create2StrokeLR_new(Gate name, GatePart leftPart, GatePart rightPart) { if (m_InkOverlay.Ink.Strokes.Count != 2) { MessageBox.Show("Incorrect # of strokes present"); return; } Rectangle b0 = m_InkOverlay.Ink.Strokes[0].GetBoundingBox(); Rectangle b1 = m_InkOverlay.Ink.Strokes[1].GetBoundingBox(); Rectangle bLeft, bRight; Stroke msLeft, msRight; if (b0.Right < b1.Right) { msLeft = m_InkOverlay.Ink.Strokes[0]; msRight = m_InkOverlay.Ink.Strokes[1]; bLeft = b0; bRight = b1; } else { msLeft = m_InkOverlay.Ink.Strokes[1]; msRight = m_InkOverlay.Ink.Strokes[0]; bLeft = b1; bRight = b0; } Sketch.Substroke Left = m_Sketch.GetSketchSubstrokeByInkId(msLeft.Id); Sketch.Substroke Right = m_Sketch.GetSketchSubstrokeByInkId(msRight.Id); List <Sketch.Substroke> strokes = new List <Sketch.Substroke>(); Dictionary <Sketch.Substroke, GatePart> strokeInfo = new Dictionary <Sketch.Substroke, GatePart>(); strokes.Add(Left); strokeInfo.Add(Left, leftPart); strokes.Add(Right); strokeInfo.Add(Right, rightPart); Rectangle shapeBbox = m_InkOverlay.Ink.Strokes.GetBoundingBox(); SymbolInfo info = new SymbolInfo(new User("Tester"), name.ToString(), "Gate"); ImageTemplate complete = new ImageTemplate(strokes, strokeInfo, info); m_ImageTemplates.Add(complete); }
/// <summary> /// Initialise a new dependency rule with two gate parts. /// </summary> /// <param name="gatePart1"> The first gate part for this dependency rule. </param> /// <param name="gatePart2"> The second gate part for this dependency rule. </param> public DependencyRule(GatePart gatePart1, GatePart gatePart2) : this(new List <GatePart> { gatePart1, gatePart2 }) { }