Bounds2D.toLocal C# (CSharp) Method

toLocal() public method

public toLocal ( Bounds2D, global ) : Bounds2D,
global Bounds2D,
return Bounds2D,
    public Bounds2D toLocal(Bounds2D global)
    {
        Bounds2D ret = new Bounds2D();
        ret.x = global.x - x;
        ret.y = global.y - y;
        ret.width = global.width;
        ret.height = global.height;
        return ret;
    }

Usage Example

Esempio n. 1
0
    private void getBits()
    {
        //Intersection of the two bounds in global space.
        Bounds2D intersection = boundsA.intersection(boundsB);

        //Intersections in local space.
        Bounds2D intersectionA = boundsA.toLocal(intersection);
        Bounds2D intersectionB = boundsB.toLocal(intersection);

        bitsA = getBitArray(intersectionA, a.collisionMask);
        bitsB = getBitArray(intersectionB, b.collisionMask);
    }