Exemple #1
0
 /// <summary>
 /// Element wise index wrap. 
 /// X wraps around [0,n.X-1]
 /// Y wraps around [0,n.Y-1]
 /// Z wraps around [0,n.Z-1]
 /// This's (X,Y,Z) is assumed to be a 3d index in a 3d table of size (n.X,n.Y.n.Z).
 /// If X, Y or Z are not in the valid array range, they are wrapped around [0,n.X-1], [0,n.Y-1], [0,n.Z-1] respectively (-1 becomes n-1, n becomes 0, n+1 becomes 1 etc), else their value is unchanged.
 /// <param name="n">The 2d size "this" components must be wrapped around. The components of n are assumed to be positive (values of n.X, n.Y or n.Z negative or zero will result in undefined behaviour).</param>
 /// </summary>
 public Vector3i WrapIndex( Vector3i n )
 {
     return new Vector3i( Common.WrapIndex( X, n.X ) ,
                          Common.WrapIndex( Y, n.Y ) ,
                          Common.WrapIndex( Z, n.Z ) );
 }
Exemple #2
0
 /// <summary>Element wise min.</summary>
 public Vector3i Min( Vector3i value )
 {
     return new Vector3i( Common.Min( X, value.X ) ,
                          Common.Min( Y, value.Y ),
                          Common.Min( Z, value.Z ) );
 }
Exemple #3
0
 /// <summary>Equality test.</summary>
 public bool Equals( Vector3i v )
 {
     return( X == v.X ) && ( Y == v.Y ) && ( Z == v.Z );
 }
Exemple #4
0
 /// <summary>Element wise max.</summary>
 public Vector3i Max( Vector3i value )
 {
     return new Vector3i( Common.Max( X, value.X ) ,
                          Common.Max( Y, value.Y ) ,
                          Common.Max( Z, value.Z ) );
 }
Exemple #5
0
 /// <summary>Element wise clamp.</summary>
 public Vector3i Clamp( Vector3i min, Vector3i max )
 {
     return new Vector3i( Common.Clamp( X, min.X, max.X ) ,
                          Common.Clamp( Y, min.Y, max.Y ),
                          Common.Clamp( Z, min.Z, max.Z ) );
 }