public PlotPoint RotateAround(float degrees, PlotPoint center)
        {
            double sin = Math.Sin(degrees * Math.PI / 180f);
            double cos = Math.Cos(degrees * Math.PI / 180f);

            double tx = this.X - center.X;
            double ty = this.Y - center.Y;

            double vX = ((cos * tx) - (sin * ty)) + center.X;
            double vY = ((sin * tx) + (cos * ty)) + center.Y;

            return(new PlotPoint((float)vX, (float)vY));
        }
Exemplo n.º 2
0
 public static PlotPoint[] BuildRandom(
     float xmean, float xdeviation,
     float ymean, float ydeviation,
     float angle, int count
     )
 {
     PlotPoint[] out_data = new PlotPoint[count];
     for (int i = 0; i < count; i++)
     {
         float xval = NextFloat() * xdeviation + xmean;
         float yval = NextFloat() * ydeviation + ymean;
         out_data[i] = new PlotPoint(xval, yval).RotateAround(angle, new PlotPoint(xmean, ymean));
     }
     return(out_data);
 }