Exemplo n.º 1
0
        public vector Clip(vector min, vector max)
        {
            vector v = this;

            if (v.X < min.X)
            {
                v.X = min.X;
            }
            else if (max.X < v.X)
            {
                v.X = max.X;
            }
            if (v.Y < min.Y)
            {
                v.Y = min.Y;
            }
            else if (max.Y < v.Y)
            {
                v.Y = max.Y;
            }
            if (v.Z < min.Z)
            {
                v.Z = min.Z;
            }
            else if (max.Z < v.Z)
            {
                v.Z = max.Z;
            }
            return(v);
        }
Exemplo n.º 2
0
 public void ClipSelf(vector min, vector max)
 {
     if (X < min.X)
     {
         X = min.X;
     }
     else if (max.X < X)
     {
         X = max.X;
     }
     if (Y < min.Y)
     {
         Y = min.Y;
     }
     else if (max.Y < Y)
     {
         Y = max.Y;
     }
     if (Z < min.Z)
     {
         Z = min.Z;
     }
     else if (max.Z < Z)
     {
         Z = max.Z;
     }
 }
Exemplo n.º 3
0
 public bool LessIdThan(vector v)
 {
     if (X < v.X)
     {
         return(true);
     }
     if (X > v.X)
     {
         return(false);
     }
     if (Y < v.Y)
     {
         return(true);
     }
     if (Y > v.Y)
     {
         return(false);
     }
     if (Z < v.Z)
     {
         return(true);
     }
     if (Z > v.Z)
     {
         return(false);
     }
     return(false);
 }
Exemplo n.º 4
0
 public Obb3i(vector center, vector extents, vector ax, vector ay, vector az)
 {
     Center  = center;
     Extents = extents;
     Ax      = ax;
     Ay      = ay;
     Az      = az;
 }
Exemplo n.º 5
0
 public Obb3i(aabb aabb)
 {
     Center  = aabb.Center;
     Extents = aabb.Extents;
     Ax      = vector.AxisX;
     Ay      = vector.AxisY;
     Az      = vector.AxisZ;
 }
Exemplo n.º 6
0
 public Obb3i(Obb3d v)
 {
     Center  = new vector(v.Center);
     Extents = new vector(v.Extents);
     Ax      = new vector(v.Ax);
     Ay      = new vector(v.Ay);
     Az      = new vector(v.Az);
 }
Exemplo n.º 7
0
        public Range3i(IEnumerable <vector> positions)
        {
            vector min = vector.MaxValue, max = vector.MinValue;

            foreach (var p in positions)
            {
                min.ElementWiseMinSelf(p);
                max.ElementWiseMaxSelf(p);
            }
            Min = min;
            Max = max;
        }
Exemplo n.º 8
0
        public Range3i(IEnumerable <volume> volumes)
        {
            vector min = vector.MaxValue, max = vector.MinValue;

            foreach (var v in volumes)
            {
                min.ElementWiseMinSelf(v.Min);
                max.ElementWiseMaxSelf(v.Max);
            }
            Min = min;
            Max = max;
        }
Exemplo n.º 9
0
 public Range3i(vector min, vector max, bool normalize)
 {
     if (normalize)
     {
         vector.ElementWiseMinMax(min, max, out Min, out Max);
     }
     else
     {
         Min = min;
         Max = max;
     }
 }
Exemplo n.º 10
0
 public void ElementWiseMinSelf(vector v)
 {
     if (v.X < X)
     {
         X = v.X;
     }
     if (v.Y < Y)
     {
         Y = v.Y;
     }
     if (v.Z < Z)
     {
         Z = v.Z;
     }
 }
Exemplo n.º 11
0
 public void ElementWiseMaxSelf(vector v)
 {
     if (v.X > X)
     {
         X = v.X;
     }
     if (v.Y > Y)
     {
         Y = v.Y;
     }
     if (v.Z > Z)
     {
         Z = v.Z;
     }
 }
Exemplo n.º 12
0
 static public vector ElementWiseMax(vector v1, vector v2)
 {
     if (v2.X < v1.X)
     {
         v2.X = v1.X;
     }
     if (v2.Y < v1.Y)
     {
         v2.Y = v1.Y;
     }
     if (v2.Z < v1.Z)
     {
         v2.Z = v1.Z;
     }
     return(v2);
 }
Exemplo n.º 13
0
 public static void ElementWiseMinMax(vector v1, vector v2, out vector min, out vector max)
 {
     if (v2.X < v1.X)
     {
         var t = v1.X; v1.X = v2.X; v2.X = t;
     }
     ;
     if (v2.Y < v1.Y)
     {
         var t = v1.Y; v1.Y = v2.Y; v2.Y = t;
     }
     ;
     if (v2.Z < v1.Z)
     {
         var t = v1.Z; v1.Z = v2.Z; v2.Z = t;
     }
     ;
     min = v1;
     max = v2;
 }
Exemplo n.º 14
0
 public Range3i(vector min, vector max)
 {
     Min = min;
     Max = max;
 }
Exemplo n.º 15
0
 public Range3i(vector position)
 {
     Min = position;
     Max = position;
 }
Exemplo n.º 16
0
 public void ExpandSelf(vector v)
 {
     Min.SubSelf(v);
     Max.AddSelf(v);
 }
Exemplo n.º 17
0
 public volume Expand(vector v)
 {
     return(new volume(Min - v, Max + v));
 }
Exemplo n.º 18
0
 public void MergeSelf(vector v)
 {
     Min.ElementWiseMinSelf(v);
     Max.ElementWiseMaxSelf(v);
 }
Exemplo n.º 19
0
 public element Dot(vector v)
 {
     return(X * v.X + Y * v.Y + Z * v.Z);
 }
Exemplo n.º 20
0
 public Aabb3i(vector center, vector extents)
 {
     Center  = center;
     Extents = extents;
 }
Exemplo n.º 21
0
 public void MulSelf(vector v)
 {
     X *= v.X;
     Y *= v.Y;
     Z *= v.Z;
 }
Exemplo n.º 22
0
 public vector Cross(vector v)
 {
     return(new vector(Y * v.Z - Z * v.Y, Z * v.X - X * v.Z, X * v.Y - Y * v.X));
 }
Exemplo n.º 23
0
 public void SubSelf(vector v)
 {
     X -= v.X;
     Y -= v.Y;
     Z -= v.Z;
 }
Exemplo n.º 24
0
 public bool Contains(vector v)
 {
     v.SubSelf(Center);
     v = (Ax * v.X) + (Ay * v.Y) + (Az * v.Z);
     return(Math.Abs(v.X) <= Extents.X && Math.Abs(v.Y) <= Extents.Y && Math.Abs(v.Z) <= Extents.Z);
 }
Exemplo n.º 25
0
 public Range3i(Range3d v)
 {
     Min = new vector(v.Min);
     Max = new vector(v.Max);
 }
Exemplo n.º 26
0
 public volume Merge(vector v)
 {
     return(new volume(vector.ElementWiseMin(Min, v), vector.ElementWiseMax(Max, v)));
 }
Exemplo n.º 27
0
 public Aabb3i(Aabb3d v)
 {
     Center  = new vector(v.Center);
     Extents = new vector(v.Extents);
 }
Exemplo n.º 28
0
 public void DivSelf(vector v)
 {
     X /= v.X;
     Y /= v.Y;
     Z /= v.Z;
 }
Exemplo n.º 29
0
 public bool Contains(vector v)
 {
     return(Min <= v && v <= Max);
 }
Exemplo n.º 30
0
 public void AddSelf(vector v)
 {
     X += v.X;
     Y += v.Y;
     Z += v.Z;
 }