protected override double[] getEffectVector2D(long timeInMs) { double num1 = FannedValueManager.ToDouble(this.Phase); double num2 = FannedValueManager.ToDouble(this.RotationFrequency); double num3 = this.PeriodicTime * num1 / 360.0; if (double.IsInfinity(this.SideDuration)) { throw new NotFiniteNumberException(string.Empty, this.SideDuration); } if (double.IsInfinity(this.PeriodicTime)) { throw new NotFiniteNumberException(string.Empty, this.PeriodicTime); } FannedValueManager.ToDouble(this.Corners); double[] xy = this.GetXY(((double)timeInMs + num3) % this.PeriodicTime, this.SideDuration); double num4 = xy[1]; double num5 = xy[0]; double num6 = FannedValueManager.ToDouble(this.Index) * 2.0 * Math.PI / 360.0; if (num2 != 0.0) { num6 += (double)timeInMs / 1000.0 * num2 * 2.0 * Math.PI; } return(new double[2] { num4 *Math.Cos(num6) - num5 * Math.Sin(num6), num5 *Math.Cos(num6) + num4 * Math.Sin(num6) }); }
public override sealed double[,] GetPictureData(int dataCount) { double indexing = -FannedValueManager.ToDouble(this.Index) * 2.0 * Math.PI / 360.0; double[,] numArray = new double[2, dataCount]; for (int index = 0; index < dataCount; ++index) { double[] xy = this.GetXY((double)index, (double)dataCount); numArray[0, index] = xy[0] * Math.Cos(indexing) - xy[1] * Math.Sin(indexing); numArray[1, index] = xy[1] * Math.Cos(indexing) + xy[0] * Math.Sin(indexing); } return(numArray); }
protected override double[] getEffectVector2D(long timeInMs) { double num = this.PeriodicTime * FannedValueManager.ToDouble(this.Phase) / 360.0; double num2 = FannedValueManager.ToDouble(this.Rotationfrequency); double num6 = FannedValueManager.ToDouble(this.Index) * 2.0 * Math.PI / 360.0; double[] xy = this.GetXY(((double)timeInMs + num) % this.PeriodicTime, this.PeriodicTime); if (num2 != 0.0) //Rotate if necessary { num6 += (double)timeInMs / 1000.0 * num2 * 2.0 * Math.PI; } return(new double[2] { xy[1] * Math.Cos(num6) - xy[0] * Math.Sin(num6), -xy[0] * Math.Cos(num6) - xy[1] * Math.Sin(num6) }); }
public override sealed double[,] GetPictureData(int dataCount) { FannedValueManager.ToDouble(this.AmplitudeX); FannedValueManager.ToDouble(this.AmplitudeY); FannedValueManager.ToDouble(this.Frequency); FannedValueManager.ToDouble(this.Phase); double num1 = -FannedValueManager.ToDouble(this.Index) * 2.0 * Math.PI / 360.0; //int num2 = 2*(int)FannedValueManager.ToDouble(this.Corners); int num2 = this.Pointlist.Length; double[,] numArray = new double[2, dataCount]; for (int index = 0; index < dataCount; ++index) { double[] xy = this.GetXY((double)index, (double)(dataCount / num2)); numArray[0, index] = xy[0] * Math.Cos(num1) + xy[1] * Math.Sin(num1); numArray[1, index] = xy[1] * Math.Cos(num1) - xy[0] * Math.Sin(num1); } return(numArray); }
public double[] GetXY(double time, double periodTime) { double a = FannedValueManager.ToDouble(this.Parameter_a); double b = FannedValueManager.ToDouble(this.Parameter_b); double start = FannedValueManager.ToDouble(this.Startangle) * 2.0 * Math.PI / 360; double stop = FannedValueManager.ToDouble(this.Stopangle) * 2.0 * Math.PI / 360; double num1 = 0.0; double num2 = 0.0; double deltaangle = stop - start; double angle = 0; if (this.Playmode == "normal") { //normal mode angle = start + (deltaangle * time / periodTime); } else { //bounce mode if ((time / periodTime) % 1 > 0.5f) { //Rücklaufend angle = start + (deltaangle * ((2.0 * time / periodTime) % 1)); } else { //Vorlaufend angle = stop - (deltaangle * ((2.0 * time / periodTime) % 1)); } } try { num1 = Math.Cos(angle) * a; num2 = Math.Sin(angle) * b; } catch (Exception ex) { Ellipse.log.Error("", ex); } return(new double[2] { num2, num1 }); }
public override sealed double[,] GetPictureData(int dataCount) { int p = (int)FannedValueManager.ToDouble(this.P); int q = (int)FannedValueManager.ToDouble(this.Q); int length = p * q; //Reduzieren der Grafikdarstellung auf relevanten Bereich (nur bei nicht zusammenhängenden Sternen notwendig) if (length > this.Pointlist.Length) { length = this.Pointlist.Length; } double num1 = -FannedValueManager.ToDouble(this.Index) * 2.0 * Math.PI / 360.0; //int num2 = 2*(int)FannedValueManager.ToDouble(this.Corners); int num2 = this.Pointlist.Length; double[,] numArray = new double[2, dataCount]; for (int index = 0; index < dataCount; ++index) { double[] xy = this.GetXY((double)index, (double)dataCount / length, false); numArray[0, index] = xy[0] * Math.Cos(num1) - xy[1] * Math.Sin(num1); numArray[1, index] = xy[1] * Math.Cos(num1) + xy[0] * Math.Sin(num1); } return(numArray); }
public double[] GetXY(double time, double sideDuration, bool constantspeed) { int num1; double num2 = 0; double num4 = 0; try { //int num1 = 2*(int)FannedValueManager.ToDouble(this.Corners); if (constantspeed) { //calculate Period of time for one time all forms. //The whole effect contains multiple times all forms. int p = (int)FannedValueManager.ToDouble(this.P); int q = (int)FannedValueManager.ToDouble(this.Q); double period = this.PeriodicTime; //constant speed double abstime = (time % period) / period; //calculate abstime (0...1) double absdist = this.Pointdistsum * abstime; num1 = this.Pointlist.Length; int index = 0; while (absdist >= this.Pointdist[(index) % num1]) { ++index; if (index == Pointdist.Length) { break; } } double stepabsdist = absdist; if (index != 0) { stepabsdist = stepabsdist - this.Pointdist[index - 1 % num1]; } double stepdiffdist = this.Pointdist[index]; if (index != 0) { stepdiffdist = stepdiffdist - this.Pointdist[index - 1]; } num2 = index + stepabsdist / stepdiffdist; num4 = num2 - (int)num2; } else { //constant time num1 = this.Pointlist.Length; num2 = time / sideDuration % (double)num1; num4 = num2 - (int)num2; } PointF cornerPoint = this.Pointlist[(int)num2]; PointF pointF = (int)num2 == num1 - 1 ? this.Pointlist[0] : this.Pointlist[(int)num2 + 1]; double num5 = (double)pointF.X - (double)cornerPoint.X; double num6 = (double)pointF.Y - (double)cornerPoint.Y; return(new double[2] { (double)cornerPoint.Y + num6 * num4, (double)cornerPoint.X + num5 * num4 }); } catch (Exception ex) { Starpolygon.log.Error("", ex); } return(new double[2]); }
private void calc_Points() { if (this.initializing == false) { int p = (int)FannedValueManager.ToDouble(this.P); int q = (int)FannedValueManager.ToDouble(this.Q); if (p <= 1) { throw new IndexOutOfRangeException(); } if (q <= 1) { throw new IndexOutOfRangeException(); } //Calculating outer Points PointF[] outerpointlist = new PointF[p]; double angle = 0.0; for (int index = 0; index < p; index = index + 1) { outerpointlist[index] = new PointF((float)Math.Cos(angle) * (float)1.0, (float)Math.Sin(angle) * (float)1.0); angle = angle + ((float)2 * Math.PI / (float)p); } //Calculating inner Points PointF[] innerpointlist = new PointF[p]; angle = (float)Math.PI / (float)p; //Spitzenwinkel = 180°-(q*360*)/p float mindst; if (p - q > q) { mindst = q % p; } else { mindst = Math.Abs(p - q) % p; } //mindst = q; float spitzenwinkel = ((float)Math.PI - (float)((float)2 * Math.PI * (mindst)) / (float)p); /*if (spitzenwinkel > (float)Math.PI / 2) * { * spitzenwinkel = (float)Math.PI - spitzenwinkel; * }*/ //innenradius = außenradius *(1-cos(0,5*spitzenwinkel) float innerradius = 1.0f * (float)Math.Sin((float)0.5 * spitzenwinkel) / (float)Math.Sin(Math.PI - (float)0.5 * spitzenwinkel - (Math.PI * (float)2) / ((float)2 * p)); for (int index = 0; index < p; index = index + 1) { innerpointlist[index] = new PointF((float)Math.Cos(angle) * innerradius, (float)Math.Sin(angle) * innerradius); angle = angle + ((float)2 * Math.PI / (float)p); } if ((String)this.Movingtype == "Outlines") { //Punkteliste für Außenkontur this.Pointlist = new PointF[2 * p]; for (int index = 0; index < 2 * p; index = index + 2) { this.Pointlist[index] = outerpointlist[index / 2]; this.Pointlist[index + 1] = innerpointlist[index / 2]; } } else { //Punkteliste für durch die Mitte this.Pointlist = new PointF[0]; int id = 0; int ggt = (berechneGgt(p, q)); //if (p%q != 0) //zusammenhaengende Sterne if (ggt == 1) //zusammenhaengende Sterne { for (int index = 0; index < p; index = index + 1) { appendPosition(outerpointlist[id]); id = (id + q) % p; } } else { //int counter = (int)(p/q); int counter = 0; int targetcounter = p / ggt; for (int index = 0; index < (p / ggt + 1) * p; index = index + 1) { appendPosition(outerpointlist[id]); if (counter == targetcounter) { // Beginnen der nächsten Form appendPosition(innerpointlist[id]); id = (id + 1) % p; counter = 0; } else { counter++; id = (id + q) % p; } } /* * //for (int index = 0; index < (p/q + 1)*p; index = index + 1) * for (int index = 0; index < (p/ggt + 1) * p; index = index + 1) * //for (int index = 0; index < (p*q)*p; index = index + 1) * { * appendPosition(outerpointlist[id]); * if (index == counter) { * // Beginnen der nächsten Form * appendPosition(innerpointlist[id]); * id = (id + 1) % p; * //counter = counter + (int)(p / q) + 1; * counter = counter + ggt + 1; * * } * else * { * // normale vervollständigung * id = (id + q) % p; * } * } */ } } calcdistances(); } }