private static MusicFontSymbol GetSymbol(Duration duration, BeamDirection direction, bool isGrace) { if (direction == BeamDirection.Up) { if (isGrace) { return MusicFontSymbol.FooterUpEighth; } switch (duration) { case Duration.Eighth: return MusicFontSymbol.FooterUpEighth; case Duration.Sixteenth: return MusicFontSymbol.FooterUpSixteenth; case Duration.ThirtySecond: return MusicFontSymbol.FooterUpThirtySecond; case Duration.SixtyFourth: return MusicFontSymbol.FooterUpSixtyFourth; default: return MusicFontSymbol.FooterUpEighth; } } else { if (isGrace) { return MusicFontSymbol.FooterDownEighth; } switch (duration) { case Duration.Eighth: return MusicFontSymbol.FooterDownEighth; case Duration.Sixteenth: return MusicFontSymbol.FooterDownSixteenth; case Duration.ThirtySecond: return MusicFontSymbol.FooterDownThirtySecond; case Duration.SixtyFourth: return MusicFontSymbol.FooterDownSixtyFourth; default: return MusicFontSymbol.FooterDownEighth; } } }
/// <summary> /// Initializes a new instance of the <see cref="EulerBernoulliBeamHelper"/> class. /// </summary> /// <param name="direction">The direction.</param> public EulerBernoulliBeamHelper(BeamDirection direction, Element targetElement) { _direction = direction; TargetElement = targetElement; {//loading condistions list pool from element's cache var listPoolKey = "26167C0A-1E58-4FA5-950D-5464ED6F264A"; object obj; if (targetElement != null) { targetElement.TryGetCache(listPoolKey, out CondsListPool); } if (CondsListPool == null) { CondsListPool = new ListPool <Condition>(); if (targetElement != null) { targetElement.SetCache(listPoolKey, CondsListPool); } } } }
private BeamDirection Invert(BeamDirection direction) { if (!InvertBeamDirection) { return(direction); } switch (direction) { case BeamDirection.Down: return(BeamDirection.Up); case BeamDirection.Up: return(BeamDirection.Down); } return(BeamDirection.Up); }
private void PaintFingering(ICanvas canvas, Beat beat, float beatLineX, BeamDirection direction, float topY) { var settings = Settings; if (settings.FingeringMode != FingeringMode.Score) { return; } if (direction == BeamDirection.Up) { beatLineX -= 10 * Scale; } else { beatLineX += 3 * Scale; } // sort notes ascending in their value to ensure // we are drawing the numbers according to their order on the stave var noteList = beat.Notes.Clone(); noteList.Sort((a, b) => a.RealValue - b.RealValue); for (int n = 0; n < noteList.Count; n++) { var note = noteList[n]; string text = null; if (note.LeftHandFinger != Fingers.Unknown) { text = ModelUtils.FingerToString(settings, beat, note.LeftHandFinger, true); } else if (note.RightHandFinger != Fingers.Unknown) { text = ModelUtils.FingerToString(settings, beat, note.RightHandFinger, false); } if (text == null) { continue; } canvas.FillText(text, beatLineX, topY); topY -= (int)(canvas.Font.Size); } }
private static MusicFontSymbol GetSymbol(Duration duration, BeamDirection direction, bool isGrace) { if (isGrace) { duration = Duration.Eighth; } if (direction == BeamDirection.Up) { switch (duration) { case Duration.Eighth: return(MusicFontSymbol.FooterUpEighth); case Duration.Sixteenth: return(MusicFontSymbol.FooterUpSixteenth); case Duration.ThirtySecond: return(MusicFontSymbol.FooterUpThirtySecond); case Duration.SixtyFourth: return(MusicFontSymbol.FooterUpSixtyFourth); case Duration.OneHundredTwentyEighth: return(MusicFontSymbol.FooterUpOneHundredTwentyEighth); case Duration.TwoHundredFiftySixth: return(MusicFontSymbol.FooterUpTwoHundredFiftySixth); default: return(MusicFontSymbol.FooterUpEighth); } } else { switch (duration) { case Duration.Eighth: return(MusicFontSymbol.FooterDownEighth); case Duration.Sixteenth: return(MusicFontSymbol.FooterDownSixteenth); case Duration.ThirtySecond: return(MusicFontSymbol.FooterDownThirtySecond); case Duration.SixtyFourth: return(MusicFontSymbol.FooterDownSixtyFourth); case Duration.OneHundredTwentyEighth: return(MusicFontSymbol.FooterDownOneHundredTwentyEighth); case Duration.TwoHundredFiftySixth: return(MusicFontSymbol.FooterDownOneHundredTwentyEighth); default: return(MusicFontSymbol.FooterDownEighth); } } }
Vector3 GetBeamDirection(BeamDirection rDir) { switch (rDir) { case BeamDirection.Up: return(transform.up); case BeamDirection.Down: return(-transform.up); case BeamDirection.Left: return(-transform.right); case BeamDirection.Right: return(transform.right); case BeamDirection.Front: return(transform.forward); case BeamDirection.Back: return(-transform.forward); } return(transform.up); }
protected override float GetStartY(BarRendererBase noteRenderer, BeamDirection direction) { if (StartBeat.IsRest) { // below all lines return(((ScoreBarRenderer)noteRenderer).GetScoreY(9)); } switch (direction) { case BeamDirection.Up: // below lowest note return(noteRenderer.GetNoteY(StartBeat.MinNote)); default: return(noteRenderer.GetNoteY(StartBeat.MaxNote)); } }
private static MusicFontSymbol GetSymbol(Duration duration, BeamDirection direction, bool isGrace) { if (direction == BeamDirection.Up) { if (isGrace) { return(MusicFontSymbol.FooterUpEighth); } switch (duration) { case Duration.Eighth: return(MusicFontSymbol.FooterUpEighth); case Duration.Sixteenth: return(MusicFontSymbol.FooterUpSixteenth); case Duration.ThirtySecond: return(MusicFontSymbol.FooterUpThirtySecond); case Duration.SixtyFourth: return(MusicFontSymbol.FooterUpSixtyFourth); default: return(MusicFontSymbol.FooterUpEighth); } } else { if (isGrace) { return(MusicFontSymbol.FooterDownEighth); } switch (duration) { case Duration.Eighth: return(MusicFontSymbol.FooterDownEighth); case Duration.Sixteenth: return(MusicFontSymbol.FooterDownSixteenth); case Duration.ThirtySecond: return(MusicFontSymbol.FooterDownThirtySecond); case Duration.SixtyFourth: return(MusicFontSymbol.FooterDownSixtyFourth); default: return(MusicFontSymbol.FooterDownEighth); } } }
protected override float GetEndY(BarRendererBase noteRenderer, BeamDirection direction) { if (EndBeat.IsRest) { switch (direction) { case BeamDirection.Up: return(((ScoreBarRenderer)noteRenderer).GetScoreY(9)); default: return(((ScoreBarRenderer)noteRenderer).GetScoreY(0)); } } switch (direction) { case BeamDirection.Up: // below lowest note return(((ScoreBarRenderer)noteRenderer).GetNoteY(EndBeat.MinNote)); default: return(((ScoreBarRenderer)noteRenderer).GetNoteY(EndBeat.MaxNote)); } }
public BeamGlyph(float x, float y, Duration duration, BeamDirection direction, bool isGrace) : base(x, y, isGrace ? NoteHeadGlyph.GraceScale : 1, GetSymbol(duration, direction, isGrace)) { }
public RhythmBarRendererFactory(BeamDirection direction) { _direction = direction; IsInAccolade = false; HideOnMultiTrack = false; }
/// <summary> /// Initializes a new instance of the <see cref="TimoshenkoBeamHelper"/> class. /// </summary> /// <param name="direction">The direction.</param> public TimoshenkoBeamHelper(BeamDirection direction) { _direction = direction; }
private void PaintFingering(ICanvas canvas, Beat beat, float beatLineX, BeamDirection direction, float topY) { if (direction == BeamDirection.Up) { beatLineX -= 10 * Scale; } else { beatLineX += 3 * Scale; } // sort notes ascending in their value to ensure // we are drawing the numbers according to their order on the stave var noteList = beat.Notes.Clone(); noteList.Sort((a, b) => b.RealValue - a.RealValue); for (int n = 0; n < noteList.Count; n++) { var note = noteList[n]; string text = null; if (note.LeftHandFinger != Fingers.Unknown) { text = FingerToString(beat, note.LeftHandFinger, true); } else if (note.RightHandFinger != Fingers.Unknown) { text = FingerToString(beat, note.RightHandFinger, false); } if (text == null) { continue; } canvas.FillText(text, beatLineX, topY); topY -= (int)(canvas.Font.Size); } }
public RhythmBarRenderer(Bar bar, BeamDirection direction) : base(bar) { _direction = direction; }
protected virtual float GetEndY(BarRendererBase noteRenderer, BeamDirection direction) { return(0); }
private float CalculateBeamYWithDirection(BeamingHelper h, float x, BeamDirection direction) { var stemSize = GetStemSize(h); return(h.CalculateBeamYWithDirection(stemSize, Scale, x, Scale, this, direction)); }
/// <summary> /// Initializes a new instance of the <see cref="EulerBernoulliBeamHelper"/> class. /// </summary> /// <param name="direction">The direction.</param> public EulerBernoulliBeamHelper(BeamDirection direction) { _direction = direction; }
protected override float GetStartY(BarRendererBase noteRenderer, BeamDirection direction) { return(noteRenderer.GetNoteY(_startNote)); }
public float CalculateBeamYWithDirection(float stemSize, float xCorrection, float xPosition, float scale, IBeamYCalculator yPosition, BeamDirection direction) { // create a line between the min and max note of the group if (Beats.Count == 1) { if (direction == BeamDirection.Up) { return(yPosition.GetYPositionForNote(MaxNote) - stemSize); } return(yPosition.GetYPositionForNote(MinNote) + stemSize); } // we use the min/max notes to place the beam along their real position // we only want a maximum of 10 offset for their gradient var maxDistance = (10 * scale); // if the min note is not first or last, we can align notes directly to the position // of the min note if (direction == BeamDirection.Down && MinNote != FirstMinNote && MinNote != LastMinNote) { return(yPosition.GetYPositionForNote(MinNote) + stemSize); } if (direction == BeamDirection.Up && MaxNote != FirstMaxNote && MaxNote != LastMaxNote) { return(yPosition.GetYPositionForNote(MaxNote) - stemSize); } float startX = GetBeatLineX(FirstMinNote.Beat) + xCorrection; float startY = direction == BeamDirection.Up ? yPosition.GetYPositionForNote(FirstMaxNote) - stemSize : yPosition.GetYPositionForNote(FirstMinNote) + stemSize; float endX = GetBeatLineX(LastMaxNote.Beat) + xCorrection; float endY = direction == BeamDirection.Up ? yPosition.GetYPositionForNote(LastMaxNote) - stemSize : yPosition.GetYPositionForNote(LastMinNote) + stemSize; // ensure the maxDistance if (direction == BeamDirection.Down && startY > endY && (startY - endY) > maxDistance) { endY = (startY - maxDistance); } if (direction == BeamDirection.Down && endY > startY && (endY - startY) > maxDistance) { startY = (endY - maxDistance); } if (direction == BeamDirection.Up && startY < endY && (endY - startY) > maxDistance) { endY = (startY + maxDistance); } if (direction == BeamDirection.Up && endY < startY && (startY - endY) > maxDistance) { startY = (endY + maxDistance); } // get the y position of the given beat on this curve if (startX == endX) { return(startY); } // y(x) = ( (y2 - y1) / (x2 - x1) ) * (x - x1) + y1; return(((endY - startY) / (endX - startX)) * (xPosition - startX) + startY); }
/// <inheritdoc/> public IEnumerable <Tuple <DoF, double> > GetLocalInternalForceAt(Element targetElement, Displacement[] localDisplacements, params double[] isoCoords) { var nc = targetElement.Nodes.Length; var ld = localDisplacements; Matrix B = new Matrix(2, 4); var xi = isoCoords[0]; if (xi < -1 || xi > 1) { throw new ArgumentOutOfRangeException(nameof(isoCoords)); } var bar = targetElement as BarElement; if (bar == null) { throw new Exception(); } var n = GetNMatrixAt(targetElement, isoCoords); var oldDir = this._direction; //TODO: this is very odd and not true. //TODO: should not change the _direction. this._direction = this._direction == BeamDirection.Y ? BeamDirection.Z : BeamDirection.Y; var d = GetDMatrixAt(targetElement, isoCoords); this._direction = oldDir; var u = new Matrix(2 * nc, 1); var j = GetJMatrixAt(targetElement, isoCoords).Determinant(); if (_direction == BeamDirection.Y) { u.FillColumn(0, ld[0].DZ, ld[0].RY, ld[1].DZ, ld[1].RY); } else { u.FillColumn(0, ld[0].DY, ld[0].RZ, ld[1].DY, ld[1].RZ); } var ei = d[0, 0]; n.MultiplyRowByConstant(1, 1 / j); n.MultiplyRowByConstant(2, ei / (j * j)); n.MultiplyRowByConstant(3, ei / (j * j * j)); var f = n * u; f.MultiplyByConstant(-1); var buf = new List <Tuple <DoF, double> >(); if (_direction == BeamDirection.Y) { buf.Add(Tuple.Create(DoF.Ry, f[2, 0])); buf.Add(Tuple.Create(DoF.Dz, f[3, 0])); } else { buf.Add(Tuple.Create(DoF.Rz, -f[2, 0])); buf.Add(Tuple.Create(DoF.Dy, f[3, 0])); } return(buf); }
public void Finish() { Direction = CalculateDirection(); }
protected override float GetEndY(BarRendererBase noteRenderer, BeamDirection direction) { return(noteRenderer.GetNoteY(_endNote) - Offset); }
private BeamDirection Invert(BeamDirection direction) { if (!InvertBeamDirection) return direction; switch (direction) { case BeamDirection.Down: return BeamDirection.Up; case BeamDirection.Up: return BeamDirection.Down; } return BeamDirection.Up; }