collision handle
163159
function (response) {
        // res.y >0 means touched by something on the bottom
        // which mean at top position for this one
        if (this.alive && (response.overlapV.y > 0) && response.a.body.falling) {
            // make it dead
            this.alive = false;
            //avoid further collision and delete it
            this.body.setCollisionMask(me.collision.types.NO_OBJECT);
            // set dead animation
            this.renderable.setCurrentAnimation("dead");
            // make it flicker and call destroy once timer finished
            var self = this;
            this.renderable.flicker(750, function () {
                me.game.world.removeChild(self);
            });
            // dead sfx
            me.audio.play("enemykill", false);
            // give some score
            game.data.score += 150;
        }

        return false;
    }
1238295
function handleBlock(startArr, startOffsetM, startOffsetNextM, destArr, destOffsetM, destOffsetNextM, undefined){

  // slice out the block we need
  var startArrTemp = startArr.slice(startOffsetM, startOffsetNextM || undefined)
    ,  destArrTemp =  destArr.slice( destOffsetM,  destOffsetNextM || undefined)

  var i = 0
    , posStart = {pos:[0,0], start:[0,0]}
    , posDest  = {pos:[0,0], start:[0,0]}

  do{

    // convert shorthand types to long form
    startArrTemp[i] = simplyfy.call(posStart, startArrTemp[i])
     destArrTemp[i] = simplyfy.call(posDest ,  destArrTemp[i])

    // check if both shape types match
    // 2 elliptical arc curve commands ('A'), are considered different if the
    // flags (large-arc-flag, sweep-flag) don't match
    if(startArrTemp[i][0] != destArrTemp[i][0] || startArrTemp[i][0] == 'M' ||
        (startArrTemp[i][0] == 'A' &&
          (startArrTemp[i][4] != destArrTemp[i][4] || startArrTemp[i][5] != destArrTemp[i][5])
        )
      ) {

      // if not, convert shapes to beziere
      Array.prototype.splice.apply(startArrTemp, [i, 1].concat(toBeziere.call(posStart, startArrTemp[i])))
       Array.prototype.splice.apply(destArrTemp, [i, 1].concat(toBeziere.call(posDest, destArrTemp[i])))

    } else {

      // only update positions otherwise
      startArrTemp[i] = setPosAndReflection.call(posStart, startArrTemp[i])
       destArrTemp[i] = setPosAndReflection.call(posDest ,  destArrTemp[i])

    }

    // we are at the end at both arrays. stop here
    if(++i == startArrTemp.length && i == destArrTemp.length) break

    // destArray is longer. Add one element
    if(i == startArrTemp.length){
      startArrTemp.push([
        'C',
        posStart.pos[0],
        posStart.pos[1],
        posStart.pos[0],
        posStart.pos[1],
        posStart.pos[0],
        posStart.pos[1],
      ])
    }

    // startArr is longer. Add one element
    if(i == destArrTemp.length){
      destArrTemp.push([
        'C',
        posDest.pos[0],
        posDest.pos[1],
        posDest.pos[0],
        posDest.pos[1],
        posDest.pos[0],
        posDest.pos[1]
      ])
    }


  }while(true)

  // return the updated block
  return {start:startArrTemp, dest:destArrTemp}
}
391704
def collide2(cls, data, params):
        
        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']:
            data['-group'] = -data['group']
            idx = data.sort_values(
                ['x', '-group'], kind='mergesort').index
            del data['-group']
        else:
            idx = data.sort_values(
                ['x', 'group'], kind='mergesort').index

        data = data.loc[idx, :]
        data.reset_index(inplace=True, drop=True)
        return cls.strategy(data, params)
213319
public Collision getCollision(String name)
    {
        if (collisions.containsKey(name))
        {
            return collisions.get(name);
        }
        throw new LionEngineException(ERROR_COLLISION_NOT_FOUND + name);
    }
1149958
function (i, next) {
    // @todo We should add a property to define if the collisionEntity is dynamic or static
    // If static we should do the map just once, otherwise we're recreating the array in every
    // loop when aiming.
    var meshes;
    if (!this.data.collisionEntities) {
      meshes = this.defaultCollisionMeshes;
    } else {
      meshes = this.collisionEntities.map(function (entity) {
        return entity.getObject3D('mesh');
      }).filter(function (n) { return n; });
      meshes = meshes.length ? meshes : this.defaultCollisionMeshes;
    }

    var intersects = this.raycaster.intersectObjects(meshes, true);
    if (intersects.length > 0 && !this.hit &&
        this.isValidNormalsAngle(intersects[0].face.normal)) {
      var point = intersects[0].point;

      this.line.material.color.set(this.curveHitColor);
      this.line.material.opacity = this.data.hitOpacity;
      this.line.material.transparent= this.data.hitOpacity < 1;
      this.hitEntity.setAttribute('position', point);
      this.hitEntity.setAttribute('visible', true);

      this.hit = true;
      this.hitPoint.copy(intersects[0].point);

      // If hit, just fill the rest of the points with the hit point and break the loop
      for (var j = i; j < this.line.numPoints; j++) {
        this.line.setPoint(j, this.hitPoint);
      }
      return true;
    } else {
      this.line.setPoint(i, next);
      return false;
    }
  }
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
906710
def remove_object(collision_object):
        """"""
        global collidable_objects
        if isinstance(collision_object, CollidableObj):
            # print "Collision object of type ", type(collision_object), " removed from the collision manager."
            try:
                collidable_objects.remove(collision_object)
            except:
                print
                "Ragnarok Says: Collision_Object with ID # " + str(
                    collision_object.obj_id) + " could not be found in the Collision Manager. Skipping over..."
777401
def is_colliding(self, other):
        """"""
        if isinstance(other, AABoundingBox):
            if self.rect.colliderect(other.rect):
                return True
            return False
532465
function Collision(edit, hash, children) {
    return {
        type: COLLISION,
        edit: edit,
        hash: hash,
        children: children,
        _modify: Collision__modify
    };
}
20487
def nameop_put_collision( cls, collisions, nameop ):
        
        # these are supposed to have been put here by nameop_set_collided
        history_id_key = nameop.get('__collided_history_id_key__', None)
        history_id = nameop.get('__collided_history_id__', None)

        try:
            assert cls.nameop_is_collided( nameop ), "Nameop not collided"
            assert history_id_key is not None, "Nameop missing collision info"
            assert history_id is not None, "Nameop missing collision info"
        except Exception, e:
            log.exception(e)
            log.error("FATAL: BUG: bad collision info")
            os.abort()

        if not collisions.has_key(history_id_key):
            collisions[history_id_key] = [history_id]
        else:
            collisions[history_id_key].append( history_id )
791243
@SuppressWarnings("unchecked")
    private void insertPair(ReflectedHandle<K, V> handle1, ReflectedHandle<K, V> handle2) {
        int c;
        if (comparator == null) {
            c = ((Comparable<? super K>) handle1.key).compareTo(handle2.key);
        } else {
            c = comparator.compare(handle1.key, handle2.key);
        }

        AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle1;
        AddressableHeap.Handle<K, HandleMap<K, V>> innerHandle2;

        if (c <= 0) {
            innerHandle1 = minHeap.insert(handle1.key);
            handle1.minNotMax = true;
            innerHandle2 = maxHeap.insert(handle2.key);
            handle2.minNotMax = false;
        } else {
            innerHandle1 = maxHeap.insert(handle1.key);
            handle1.minNotMax = false;
            innerHandle2 = minHeap.insert(handle2.key);
            handle2.minNotMax = true;
        }
        handle1.inner = innerHandle1;
        handle2.inner = innerHandle2;

        innerHandle1.setValue(new HandleMap<K, V>(handle1, innerHandle2));
        innerHandle2.setValue(new HandleMap<K, V>(handle2, innerHandle1));
    }
168468
function(e, win) {
      var event = $.event.get(e, win);
      var wheel = $.event.getWheel(event);
      that.handleEvent('MouseWheel', e, win, wheel);
    }
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)
537920
function addPathHandle($canvas, parent, xProp, yProp) {

	var handle = $.extend({
		cursors: {
			mouseover: 'grab',
			mousedown: 'grabbing',
			mouseup: 'grab'
		}
	}, parent.handle, {
		// Define constant properties for handle
		layer: true,
		draggable: true,
		x: parent[xProp],
		y: parent[yProp],
		_parent: parent,
		_xProp: xProp,
		_yProp: yProp,
		fromCenter: true,
		// Adjust line path when dragging a handle
		dragstart: function (layer) {
			$(this).triggerLayerEvent(layer._parent, 'handlestart');
		},
		drag: function (layer) {
			var parent = layer._parent;
			parent[layer._xProp] = layer.x - parent.x;
			parent[layer._yProp] = layer.y - parent.y;
			updatePathGuides(parent);
			$(this).triggerLayerEvent(parent, 'handlemove');
		},
		dragstop: function (layer) {
			$(this).triggerLayerEvent(layer._parent, 'handlestop');
		},
		dragcancel: function (layer) {
			$(this).triggerLayerEvent(layer._parent, 'handlecancel');
		}
	});
	$canvas.draw(handle);
	// Add handle to parent layer's list of handles
	parent._handles.push($canvas.getLayer(-1));
}
1150755
def check_name_collision( self, name, block_id, checked_ops ):
        

        return self.check_collision( "name", name, block_id, checked_ops, OPCODE_NAME_STATE_CREATIONS )
467197
function intersectStepAbove([entry]) {
    updateDirection();
    const { isIntersecting, boundingClientRect, target } = entry;

    // bottom = bottom edge of element from top of viewport
    // bottomAdjusted = bottom edge of element from trigger
    const { top, bottom } = boundingClientRect;
    const topAdjusted = top - offsetMargin;
    const bottomAdjusted = bottom - offsetMargin;
    const index = getIndex(target);
    const ss = stepStates[index];

    // entering above is only when topAdjusted is negative
    // and bottomAdjusted is positive
    if (
      isIntersecting &&
      topAdjusted <= 0 &&
      bottomAdjusted >= 0 &&
      direction === 'down' &&
      ss.state !== 'enter'
    )
      notifyStepEnter(target, direction);

    // exiting from above is when topAdjusted is positive and not intersecting
    if (
      !isIntersecting &&
      topAdjusted > 0 &&
      direction === 'up' &&
      ss.state === 'enter'
    )
      notifyStepExit(target, direction);
  }
1369612
function TouchDispatcher () {
    this.standardHandlers = []
    this.targetedHandlers = []

    this._toRemove = false
    this._toAdd    = false
    this._toQuit   = false
    this._locked   = false

    this._handlersToAdd = []
    this._handlersToRemove = []
}