spaceconquest.Hex3D.getCenter C# (CSharp) 메소드

getCenter() 공개 메소드

public getCenter ( ) : Vector3
리턴 Vector3
        public Vector3 getCenter()
        {
            float xshift = (float)Math.Cos(Math.PI / (double)6) * radius+spacing;
            float yshift = (float)Math.Sin(Math.PI / (double)6) * radius+spacing;

            return new Vector3(   (this.x * xshift * 2) + (xshift*this.y) , (yshift + radius) * this.y, 1);
        }

Usage Example

예제 #1
0
파일: Ship.cs 프로젝트: cclay/spaceconquest
        public void SetGhost(Hex3D target)
        {
            //Console.WriteLine("setting ghost");

            double x = target.getCenter().X - hex.getCenter().X;
            double y = hex.getCenter().Y - target.getCenter().Y;
            targetangle = Math.Atan(x / y);
            //Console.WriteLine(" x  " + x);
            //Console.WriteLine(" y " + y);
            if (y < 0) targetangle = targetangle + Math.PI;
            //Console.WriteLine("angle -> " + targetangle);

            if (ghosthex != null) ghosthex.SetGhostObject(null);
            ghosthex = target;
            target.SetGhostObject(this);
            if (this.hex.hexgrid == ghosthex.hexgrid)
            {
                //Console.WriteLine("creating new linemodel");
                line = new LineModel(getCenter(), ghosthex.getCenter());
            }
        }
All Usage Examples Of spaceconquest.Hex3D::getCenter