Basics

Guides

API Reference

Menu

Basics

Guides

API Reference

class: Distances

[13:14] static extends: object

Static helper for FXGL's Distances utility object (com.almasb.fxgl.core.math.Distances). Provides the rectangle- to-rectangle distance helper that FXGLMath also delegates to for AABB checks.

Methods

  • distance (double X1, double Y1, double W1, double H1, double X2, double Y2, double W2, double H2)

    Returns the shortest distance between two axis-aligned rectangles. Returns 0.0 when they overlap.

    • @p X1 is the first rect's X.
    • @p Y1 is the first rect's Y.
    • @p W1 is the first rect's width.
    • @p H1 is the first rect's height.
    • @p X2 is the second rect's X.
    • @p Y2 is the second rect's Y.
    • @p W2 is the second rect's width.
    • @p H2 is the second rect's height.
    • @r A double.