/// <summary> /// Check if this EllipseCollider is colliding with the given PointCollider. /// </summary> /// <param name="point"></param> /// <returns></returns> public CollisionResponse CollidingWith(PointCollider point) { return new CollisionResponse(this, point, Math.Pow((point.X - X) / A, 2.0) + Math.Pow((point.Y - Y) / B, 2.0) <= 1); }
public PointCollider(PointCollider point) : this(point.X, point.Y) { }
/// <summary> /// Check if this RectCollider is colliding with the given PointCollider. /// </summary> /// <param name="point"></param> /// <returns></returns> public CollisionResponse CollidingWith(PointCollider point) { bool inside = X <= point.X && point.X <= X + W && Y <= point.Y && point.Y <= Y + H; return new CollisionResponse(this, point, inside); }
/// <summary> /// Check if this PointCollider is colliding with the given PointCollider. /// </summary> /// <param name="other"></param> /// <returns></returns> public CollisionResponse CollidingWith(PointCollider other) { return new CollisionResponse(this, other, _eq(other.X, other.Y)); }
/// <summary> /// Check if this SegmentCollider is colliding with the given PointCollider. /// </summary> /// <param name="point"></param> /// <returns></returns> public CollisionResponse CollidingWith(PointCollider point) { var result = LinearUtils.PointOnLine(point.X, point.Y, Start.X, Start.Y, End.X, End.Y); return new CollisionResponse(this, point, result); }