コード例 #1
0
        public Cube MakeNewCube(double size, List <Cube> cubes, List <Polygon3D> floor)
        {
            Cube ret = new Cube(clientSize); //click to add cube grrrrr

            UnRotateDeg(Global.TotalAngle);
            UnScale(size);
            Point3D thisCenter = new Point3D();

            thisCenter = this.Center();
            Scale(size);
            RotateDeg(Global.TotalAngle);

            Point3D cubeCenter = new Point3D();

            cubeCenter = thisCenter;
            //cubeCenter.Y += .25;

            bool flag = false;

            if (cubes.Count > 0)
            {
                foreach (Cube c in cubes)
                {
                    if (c.Contains(this))
                    {
                        c.UnScale(size);
                        c.UnRotateDeg(Global.TotalAngle);
                        cubeCenter = c.Center();
                        c.RotateDeg(Global.TotalAngle);
                        c.Scale(size);
                        flag = true;
                        continue;
                    }
                }
            }
            if (!flag)
            {
                if (Projection(Global.Distance).Face == Face.front)
                {
                    cubeCenter.Y += .5;
                }
                else
                {
                    cubeCenter.Y -= .5;
                }
            }

            Point3D translation = thisCenter;

            translation = (thisCenter - cubeCenter) * 2 + cubeCenter;

            ret.Scale(size);
            ret.Translate(translation * size, true);
            //ret.RotateDeg(Global.TotalAngle);

            return(ret);
        }
コード例 #2
0
 /// <summary>
 /// Move the point by the specified amount
 /// </summary>
 /// <param name="shift"></param>
 public void Translate(Point3D shift)
 {
     aCube.Translate(shift);
 }