package electrosphere.util.math;

import static org.junit.jupiter.api.Assertions.*;

import org.joml.Vector3d;

import electrosphere.test.annotations.UnitTest;

/**
 * Tests for geometry utils
 */
public class GeomUtilsTests {
    
    @UnitTest
    public void test_getMinDistanceAABB_center_0(){
        assertEquals(0, GeomUtils.getMinDistanceAABB(new Vector3d(1,1,1), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

    @UnitTest
    public void test_getMinDistanceAABB_xSide_1(){
        assertEquals(1, GeomUtils.getMinDistanceAABB(new Vector3d(3,0,0), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

    @UnitTest
    public void test_getMinDistanceAABB_ySide_1(){
        assertEquals(1, GeomUtils.getMinDistanceAABB(new Vector3d(0,3,0), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

    @UnitTest
    public void test_getMinDistanceAABB_zSide_1(){
        assertEquals(1, GeomUtils.getMinDistanceAABB(new Vector3d(0,0,3), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

    @UnitTest
    public void test_getMinDistanceAABB_angle_1(){
        assertEquals(Math.sqrt(2), GeomUtils.getMinDistanceAABB(new Vector3d(3,3,1), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

    @UnitTest
    public void test_getMinDistanceAABB_angle_2(){
        assertEquals(Math.sqrt(3), GeomUtils.getMinDistanceAABB(new Vector3d(3,3,3), new Vector3d(0,0,0), new Vector3d(2,2,2)));
    }

}
