Skip to content
Harsh Singh edited this page Nov 29, 2021 · 8 revisions

circleInCircle

Params

  • x1 - center of first circle
  • y1 - center of first circle
  • r1 - radius of first circle
  • x2 - center of second circle
  • y2 - center of second circle
  • r2 - radius of second circle

Example

circleInCircle(0, 0, 50, 10, 10, 50); // returns true
circleInCircle(0, 0, 50, 100, 100, 50); // returns false

pointInCircle

Params

  • x1 - point's x coord
  • y1 - point's y coord
  • cx - center of circle
  • cy - center of circle
  • r - radius of circle

Example

pointInCircle(20, 20, 10, 10, 50); // returns true
pointInCircle(-190, -180, 10, 10, 50); // returns false

rectInRect

Params

  • x1 - left of rect1
  • y1 - top of rect1
  • w1 - width of rect1
  • h1 - height of rect1
  • x2 - left of rect2
  • y2 - top of rect2
  • w2 - width of rect2
  • h2 - height of rect2

Example

rectInRect(0, 0, 100, 100, 50, 0, 100, 100); // true
rectInRect(-500, 0, 100, 100, 50, 0, 100, 100); // false

pointInRect

Params

  • x - point's x coord
  • y - point's y coord
  • rx - left of rect
  • ry - top of rect
  • rw - width of rect
  • rh - height of rect

Example

pointInRect(0, 0, 100, 100, 50, 0, 100, 100); // true
pointInRect(-500, 0, 100, 100, 50, 0, 100, 100); // false

circleInRect

Params

  • cx - center of circle
  • cy - center of circle
  • r - radius of circle
  • rx - left of rect
  • ry - top of rect
  • rw - width of rect
  • rh - height of rect

Example

circleInRect(0, 0, 50, 0, 0, 100, 100); // returns true
circleInRect(0, 0, 50, 300, 200, 100, 100); // returns false
Clone this wiki locally