Beispiel #1
0
        public static Vector[] DrawLine(Vector from, Vector to, int numPoints)
        {
            Vector[] points = new Vector[numPoints];

            for (int i = 0; i < points.Length; i++)
            {
                float perc = i / (points.Length - 1f);
                points[i] = CMath.Lerp(perc, from, to);
            }

            return(points);
        }
Beispiel #2
0
 public void SetTone(int Hertz)
 {
     bufferLen = Math.Min(CMath.NearestOf(audio.GetSampleRate() * 8 / Hertz, 4), sampleBuffer.Length);
 }
Beispiel #3
0
 public Vector Clamp(float min, float max)
 {
     return(new Vector(CMath.Clamp(this.X, min, max), CMath.Clamp(this.Y, min, max)));
 }
Beispiel #4
0
 public Vector Wrap(float mod)
 {
     return(new Vector(CMath.Mod(this.X, mod), CMath.Mod(this.Y, mod)));
 }