コード例 #1
0
 /// <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);
 }
コード例 #2
0
 public PointCollider(PointCollider point)
     : this(point.X, point.Y)
 {
 }
コード例 #3
0
 /// <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);
 }
コード例 #4
0
 /// <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));
 }
コード例 #5
0
 /// <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);
 }