@bnidev/js-utils
    Preparing search index...

    Function pointInCircle

    • Checks if a point is inside or on the boundary of a circle.

      Parameters

      • pointX: number

        The x-coordinate of the point.

      • pointY: number

        The y-coordinate of the point.

      • circleX: number

        The x-coordinate of the circle's center.

      • circleY: number

        The y-coordinate of the circle's center.

      • radius: number

        The radius of the circle.

      Returns boolean

      True if the point is inside or on the boundary of the circle, false otherwise.

      If any parameter is missing or not a number.

      // ES Module
      import { pointInCircle } from '@bnidev/js-utils'

      // CommonJS
      const { pointInCircle } = require('@bnidev/js-utils')
      const isInside = pointInCircle(1, 1, 0, 0, 2) // true, since (1,1) is inside the circle centered at (0,0) with radius 2
      const isOnBoundary = pointInCircle(2, 0, 0, 0, 2)