/// <param name="centreDestination">where the centre of the grid will end up (local)</param>
        private void createCapsule(Vector3 centreDestination, IMyCubeBlock navigationBlock)
        {
            float longestDistanceSquared = 0;

            foreach (Vector3 rejection in rejectionCells)
            {
                float distanceSquared = (rejection - CentreRejection).LengthSquared();
                if (distanceSquared > longestDistanceSquared)
                {
                    longestDistanceSquared = distanceSquared;
                }
            }
            Vector3D P0 = RelativeVector3F.createFromLocal(Centre, myCubeGrid).getWorldAbsolute();
            //Vector3D P1 = RelativeVector3F.createFromLocal(centreDestination, myCubeGrid).getWorldAbsolute();

            // need to extend capsule past destination by distance between remote and front of ship
            Vector3 localPosition = navigationBlock.LocalPosition();
            Ray     navTowardsDest = new Ray(localPosition, DirectionNorm);
            float   tMin, tMax;

            myCubeGrid.LocalVolume.IntersectRaySphere(navTowardsDest, out tMin, out tMax);
            Vector3D P1 = RelativeVector3F.createFromLocal(centreDestination + tMax * DirectionNorm, myCubeGrid).getWorldAbsolute();

            float CapsuleRadius = (float)(Math.Pow(longestDistanceSquared, 0.5) + 3 * myCubeGrid.GridSize);

            myPath = new Capsule(P0, P1, CapsuleRadius);
        }
        public static bool IsOnSide(this IMyCubeBlock block, Vector3 side)
        {
            Vector3  blockPosition = block.LocalPosition();
            Vector3D centreOfMass  = block.CubeGrid.Physics.CenterOfMassWorld;
            MatrixD  invWorld      = block.CubeGrid.PositionComp.WorldMatrixNormalizedInv;

            Vector3D.Transform(ref centreOfMass, ref invWorld, out centreOfMass);
            Vector3 localCentreOfMass = centreOfMass;

            float blockPosInDirect; Vector3.Dot(ref blockPosition, ref side, out blockPosInDirect);
            float centreInDirect; Vector3.Dot(ref localCentreOfMass, ref side, out centreInDirect);

            return(blockPosInDirect > centreInDirect);
        }