Example #1
0
 public void Scale(float x, float y, float z)
 {
     for (int i = 0; i < Vertices.Length; ++i)
     {
         Vertices[i].X = Vertices[i].X * x;
         Vertices[i].Y = Vertices[i].Y * y;
         Vertices[i].Z = Vertices[i].Z * z;
     }
     Bound = null;
 }
Example #2
0
        public void Move(Vector3 moveVector)
        {
            Center += moveVector;

            for (int i = 0; i < Vertices.Length; ++i)
            {
                Vertices[i] += moveVector;
            }

            Bound = null;
        }
Example #3
0
        public void Normalize()
        {
            var maxX = Vertices.Select(v => v.X).Max();
            var maxY = Vertices.Select(v => v.Y).Max();
            var maxZ = Vertices.Select(v => v.Z).Max();

            for (int i = 0; i < Vertices.Length; ++i)
            {
                Vertices[i].X = Vertices[i].X / maxX;
                Vertices[i].Y = Vertices[i].Y / maxY;
                Vertices[i].Z = Vertices[i].Z / maxZ;
            }
            Bound = null;
        }
Example #4
0
        public void Rotate(float x, float y, float z)
        {
            var rotX = Matrix4x4.CreateRotationX(x);
            var rotY = Matrix4x4.CreateRotationY(y);
            var rotZ = Matrix4x4.CreateRotationZ(z);

            for (int i = 0; i < Vertices.Length; ++i)
            {
                Vertices[i] = Vector3.Transform(Vertices[i], rotX);
                Vertices[i] = Vector3.Transform(Vertices[i], rotY);
                Vertices[i] = Vector3.Transform(Vertices[i], rotZ);
            }

            for (int i = 0; i < Normals.Length; ++i)
            {
                Normals[i] = Vector3.Transform(Normals[i], rotX);
                Normals[i] = Vector3.Transform(Normals[i], rotY);
                Normals[i] = Vector3.Transform(Normals[i], rotZ);
            }

            Bound = null;
        }
Example #5
0
 public void CalculateBounds(int slices = 1, float bias = 0.001f)
 {
     Bound = slices == 0 ? null : new MeshBound(this, slices, bias);
 }