Exemplo n.º 1
0
 /*
  * Normalizes angle to be between 0 and +360.
  */
 public static float NormalizeDeg2(float angle)
 {
     return(CgMath.Normalize(angle, 0, 360));
 }
Exemplo n.º 2
0
 /*
  * Normalizes angle to be between -180 and +180.
  */
 public static float NormalizeDeg(float angle)
 {
     return(CgMath.Normalize(angle, -180, 180));
 }
Exemplo n.º 3
0
 /*
  * Normalizes angle to be between 0 and 2PI.
  */
 public static float NormalizeRad2(float angle)
 {
     return(CgMath.Normalize(angle, 0, TwoPI));
 }
Exemplo n.º 4
0
 /*
  * Normalizes angle to be between -PI and +PI.
  */
 public static float NormalizeRad(float angle)
 {
     return(CgMath.Normalize(angle, -PI, PI));
 }
Exemplo n.º 5
0
 public Vector2D InRectSpace(Vector2D v)
 {
     return(new Vector2D(
                CgMath.Clamp(v.X - X, 0, Width),
                CgMath.Clamp(v.Y - Y, 0, Height)));
 }
Exemplo n.º 6
0
        public Vector2D SampleLinStepped(Vector2D point, float edge0, float edge1)
        {
            Vector2D dir = Sample(point);

            return(dir.Sized(CgMath.Linstep(edge0, edge1, dir.Length)));
        }
Exemplo n.º 7
0
 public Vector2D CellTopLeft(Vector2D point)
 {
     return(_spacing * CgMath.Floor(point * _toGrid));
 }
Exemplo n.º 8
0
 public Vector2D CellCenter(Vector2D point)
 {
     return(_spacing * (CgMath.Floor(point * _toGrid) + Vector2D.Half));
 }