Returns collision with axis aligned rect
439184
def collides(self, other):
        """"""

        angle = self.angle
        width = self.width
        height = self.height

        if angle == 0:
            return other.collides(Rect(-0.5 * width,
                                       -0.5 * height, width, height))

        # Phase 1
        #
        #  * Form bounding box on tilted rectangle P.
        #  * Check whether bounding box and other intersect.
        #  * If not, then self and other do not intersect.
        #  * Otherwise proceed to Phase 2.

        # Now perform the standard rectangle intersection test.

        if self.is_bbox_not_intersecting(other):
            return False

        # Phase 2
        #
        # If we get here, check the edges of self to see
        #  * if one of them excludes all vertices of other.
        #  * If so, then self and other do not intersect.
        #  * (If not, then self and other do intersect.)

        return not self.is_edge_not_excluding_vertices(other)
775976
def parse_collisions(self):
        """"""
        fs = open(self.collisionmap_path, "r")
        self.collisionmap = fs.readlines()
        fs.close()

        x_index = 0
        y_index = 0
        for line in self.collisionmap:
            if line[0] is "#":
                continue
            for char in line:
                if char is "":
                    continue
                #An empty character is the same as collision type 0
                elif char is " ":
                    char = "0"
                elif char is "s":
                    #Placing the start location
                    self.start_location = self.tiles_to_pixels(Vector2(x_index, y_index))
                    char = "0"
                elif not (char in self.tile_bindings):
                    continue

                self.tiles[y_index][x_index].binding_type = self.tile_bindings[char]
                x_index += 1

            x_index = 0
            y_index += 1
110598
def hit(self, pt):
        """"""

        if self.hidden or not self._enabled:
            return None

        if not self.frame.collidepoint(pt):
            return None

        local_pt = (pt[0] - self.frame.topleft[0],
                    pt[1] - self.frame.topleft[1])

        for child in reversed(self.children):   # front to back
            hit_view = child.hit(local_pt)
            if hit_view is not None:
                return hit_view

        return self
1127702
function (rect) {

            var wrapper = this,
              key,
              attribs = {},
              normalizer,
              strokeWidth = rect.strokeWidth || wrapper.strokeWidth || 0;

            normalizer = mathRound(strokeWidth) % 2 / 2; // mathRound because strokeWidth can sometimes have roundoff errors

            // normalize for crisp edges
            rect.x = mathFloor(rect.x || wrapper.x || 0) + normalizer;
            rect.y = mathFloor(rect.y || wrapper.y || 0) + normalizer;
            rect.width = mathFloor((rect.width || wrapper.width || 0) - 2 * normalizer);
            rect.height = mathFloor((rect.height || wrapper.height || 0) - 2 * normalizer);
            rect.strokeWidth = strokeWidth;

            for (key in rect) {
                if (wrapper[key] !== rect[key]) { // only set attribute if changed
                    wrapper[key] = attribs[key] = rect[key];
                }
            }

            return attribs;
        }
1371859
def rectangle(self, rect, attr=None, fill=u' '):
        '''
        oldtop = self.WindowTop
        oldpos = self.pos()
        #raise NotImplementedError
        x0, y0, x1, y1 = rect
        if attr is None:
            attr = self.attr
        if fill:
            rowfill = fill[:1] * abs(x1 - x0)
        else:
            rowfill = u' ' * abs(x1 - x0)
        for y in range(y0, y1):
                System.Console.SetCursorPosition(x0, y)
                self.write_color(rowfill, attr)
        self.pos(*oldpos)
425525
def collides(self,position,size):
        ''''''
        word_rect = pygame.Rect(position,self.word_size)
        if word_rect.collidelistall(self.used_pos) == []:
            return False
        else:
            return True
777401
def is_colliding(self, other):
        """"""
        if isinstance(other, AABoundingBox):
            if self.rect.colliderect(other.rect):
                return True
            return False
490111
function (layer) {
            var bounds = layer instanceof me.TMXLayer ? me.pool.pull("me.Rect", 0, 0, 0, 0) : this.bounds;

            // origin is always 0 for finite maps
            bounds.pos.set(0, 0);
            // The map size is the same regardless of which indexes are shifted.
            if (this.staggerX) {
                bounds.resize(
                    this.cols * this.columnwidth + this.sideoffsetx,
                    this.rows * (this.tileheight + this.sidelengthy)
                );
                if (bounds.width > 1) {
                    bounds.height += this.rowheight;
                }
            } else {
                bounds.resize(
                    this.cols * (this.tilewidth + this.sidelengthx),
                    this.rows * this.rowheight + this.sideoffsety
                );
                if (bounds.height > 1) {
                    bounds.width += this.columnwidth;
                }
            }
            return bounds;
        }
279384
function computeRectIntersection(rect1, rect2) {
        var top = Math.max(rect1.top, rect2.top);
        var bottom = Math.min(rect1.bottom, rect2.bottom);
        var left = Math.max(rect1.left, rect2.left);
        var right = Math.min(rect1.right, rect2.right);
        var width = right - left;
        var height = bottom - top;

        return (width >= 0 && height >= 0) && {
            top: top,
            bottom: bottom,
            left: left,
            right: right,
            width: width,
            height: height
        };
    }
1125575
def rect(self, x, y, width, height, color, *, fill=False):
        """"""
        # pylint: disable=too-many-arguments
        if self.rotation == 1:
            x, y = y, x
            width, height = height, width
            x = self.width - x - width
        if self.rotation == 2:
            x = self.width - x - width
            y = self.height - y - height
        if self.rotation == 3:
            x, y = y, x
            width, height = height, width
            y = self.height - y - height

        # pylint: disable=too-many-boolean-expressions
        if width < 1 or height < 1 or (x + width) <= 0 or (y + height) <= 0 or \
                y >= self.height or x >= self.width:
            return
        x_end = min(self.width-1, x + width-1)
        y_end = min(self.height-1, y + height-1)
        x = max(x, 0)
        y = max(y, 0)
        if fill:
            self.format.fill_rect(self, x, y, x_end-x+1, y_end-y+1, color)
        else:
            self.format.fill_rect(self, x, y, x_end-x+1, 1, color)
            self.format.fill_rect(self, x, y, 1, y_end-y+1, color)
            self.format.fill_rect(self, x, y_end, x_end-x+1, 1, color)
            self.format.fill_rect(self, x_end, y, 1, y_end-y+1, color)
846823
public static boolean checkCollision(CmsPositionBean posA, CmsPositionBean posB, int margin) {

        // check for non collision is easier
        if ((posA.getLeft() - margin) >= (posB.getLeft() + posB.getWidth())) {
            // posA is right of posB
            return false;
        }
        if ((posA.getLeft() + posA.getWidth()) <= (posB.getLeft() - margin)) {
            // posA is left of posB
            return false;
        }
        if ((posA.getTop() - margin) >= (posB.getTop() + posB.getHeight())) {
            // posA is bellow posB
            return false;
        }
        if ((posA.getTop() + posA.getHeight()) <= (posB.getTop() - margin)) {
            // posA is above posB
            return false;
        }

        // in any other case the position rectangles collide
        return true;
    }
1232452
def fill_rect(framebuf, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments
        while height > 0:
            index = (y >> 3) * framebuf.stride + x
            offset = y & 0x07
            for w_w in range(width):
                framebuf.buf[index + w_w] = (framebuf.buf[index + w_w] & ~(0x01 << offset)) |\
                                           ((color != 0) << offset)
            y += 1
            height -= 1
714619
function(pos) {
            var obj, i, intersectionOffset, shape;

            if(this.hitGraphEnabled() && this.isVisible()) {
                for (i=0; i<INTERSECTION_OFFSETS_LEN; i++) {
                    intersectionOffset = INTERSECTION_OFFSETS[i];
                    obj = this._getIntersection({
                        x: pos.x + intersectionOffset.x,
                        y: pos.y + intersectionOffset.y
                    });
                    shape = obj.shape;
                    if (shape) {
                        return shape;
                    }
                    else if (!obj.antialiased) {
                        return null;
                    }
                }
            }
            else {
                return null;
            }
        }
877572
def collide(cls, data, params):
        
        xminmax = ['xmin', 'xmax']
        data, width = cls._collide_setup(data, params)
        if params.get('width', None) is None:
            params['width'] = width

        # Reorder by x position then on group, relying on stable sort to
        # preserve existing ordering. The default stacking order reverses
        # the group in order to match the legend order.
        if params and 'reverse' in params and params['reverse']:
            idx = data.sort_values(
                ['xmin', 'group'], kind='mergesort').index
        else:
            data['-group'] = -data['group']
            idx = data.sort_values(
                ['xmin', '-group'], kind='mergesort').index
            del data['-group']

        data = data.loc[idx, :]

        # Check for overlap
        intervals = data[xminmax].drop_duplicates().values.flatten()
        intervals = intervals[~np.isnan(intervals)]

        if (len(np.unique(intervals)) > 1 and
                any(np.diff(intervals - intervals.mean()) < -1e-6)):
            msg = "{} requires non-overlapping x intervals"
            warn(msg.format(cls.__name__), PlotnineWarning)

        if 'ymax' in data:
            data = groupby_apply(data, 'xmin', cls.strategy, params)
        elif 'y' in data:
            data['ymax'] = data['y']
            data = groupby_apply(data, 'xmin', cls.strategy, params)
            data['y'] = data['ymax']
        else:
            raise PlotnineError('Neither y nor ymax defined')

        return data
273632
def overlap(r1: 'Rectangle', r2: 'Rectangle'):
        
        h_overlaps = (r1.left <= r2.right) and (r1.right >= r2.left)
        v_overlaps = (r1.bottom >= r2.top) and (r1.top <= r2.bottom)
        return h_overlaps and v_overlaps
1297426
function (x, y, width, height) {
    return new BVG('rect', x.constructor.name === 'Object' ? x : {
      x: x,
      y: y,
      width: width,
      height: height
    });
  }
739117
function offset (ev, target) {
  var cx = ev.clientX || 0
  var cy = ev.clientY || 0
  var rect = bounds(target)
  return [ cx - rect.left, cy - rect.top ]
}