package electrosphere.server.pathfinding.navmesh;

import java.util.LinkedList;
import java.util.List;
import org.joml.Vector3d;

/**
 *
 * @author satellite
 */

/**
 * Axis aligned bounding boxes used as nodes in pathfinding navmeshes
 * Inclusive of boundary points on both minimum and maximum
 */

public class NavCube extends NavShape {
    
    Vector3d minPoint;
    Vector3d maxPoint;
    
    List<NavShape> neighbors = new LinkedList<NavShape>();
    
    
    public NavCube(double minX, double minY, double minZ, double maxX, double maxY, double maxZ){
        minPoint = new Vector3d(minX, minY, minZ);
        maxPoint = new Vector3d(maxX, maxY, maxZ);
    }
    
    @Override
    public void addNodeNeighbor(NavShape neighbor){
        neighbors.add(neighbor);
    }
    
    @Override
    public List<NavShape> getNodeNeighbors(){
        return neighbors;
    }
    
    @Override
    public boolean containsPoint(double x, double y, double z){
        return x >= minPoint.x && y >= minPoint.y && z >= minPoint.z && x <= maxPoint.x && y <= maxPoint.y && z <= maxPoint.z;
    }
    
    public Vector3d getMinPoint(){
        return minPoint;
    }
    
    public Vector3d getMaxPoint(){
        return maxPoint;
    }
    
    
}
