/**
 * Copyright (c) 2021 Dominic Masters
 * 
 * This software is released under the MIT License.
 * https://opensource.org/licenses/MIT
 */

#pragma once
#include "../libs.h"
#include "sphere.h"
#include "../input/input.h"
#include "../util/math.h"

typedef struct {
  float hitX;
  float hitY;

  float normalX;
  float normalY;
} aabbpointhit2d_t;

typedef struct {
  float time;
  
  float normalX;
  float normalY;

  float hitX;
  float hitY;
} aabbvectorhit2d_t;

/**
 * Perform a test against a point and an AABB.
 * 
 * @param pointX Point X coordinate.
 * @param pointY Point Y coordinate.
 * @param x Box X coordinate.
 * @param y Box Y coordinate.
 * @param width Box width.
 * @param height Box height.
 * @param hit Pointer to hit information to store result in, or NULL for none.
 * @return True if a hit occured, otherwise false.
 */
bool aabbPoint2D(
  float pointX, float pointY,
  float x, float y, float width, float height,
  aabbpointhit2d_t *hit
);