コード例 #1
0
 /*
  * Normalizes angle to be between 0 and +360.
  */
 public static float NormalizeDeg2(float angle)
 {
     return(CgMath.Normalize(angle, 0, 360));
 }
コード例 #2
0
 /*
  * Normalizes angle to be between -180 and +180.
  */
 public static float NormalizeDeg(float angle)
 {
     return(CgMath.Normalize(angle, -180, 180));
 }
コード例 #3
0
 /*
  * Normalizes angle to be between 0 and 2PI.
  */
 public static float NormalizeRad2(float angle)
 {
     return(CgMath.Normalize(angle, 0, TwoPI));
 }
コード例 #4
0
 /*
  * Normalizes angle to be between -PI and +PI.
  */
 public static float NormalizeRad(float angle)
 {
     return(CgMath.Normalize(angle, -PI, PI));
 }
コード例 #5
0
 public Vector2D InRectSpace(Vector2D v)
 {
     return(new Vector2D(
                CgMath.Clamp(v.X - X, 0, Width),
                CgMath.Clamp(v.Y - Y, 0, Height)));
 }
コード例 #6
0
ファイル: VectorGrid.cs プロジェクト: lithander/vectrics
        public Vector2D SampleLinStepped(Vector2D point, float edge0, float edge1)
        {
            Vector2D dir = Sample(point);

            return(dir.Sized(CgMath.Linstep(edge0, edge1, dir.Length)));
        }
コード例 #7
0
ファイル: Grid.cs プロジェクト: lithander/vectrics
 public Vector2D CellTopLeft(Vector2D point)
 {
     return(_spacing * CgMath.Floor(point * _toGrid));
 }
コード例 #8
0
ファイル: Grid.cs プロジェクト: lithander/vectrics
 public Vector2D CellCenter(Vector2D point)
 {
     return(_spacing * (CgMath.Floor(point * _toGrid) + Vector2D.Half));
 }