001/**
002 * Copyright (c) 2008-2014 Ardor Labs, Inc.
003 *
004 * This file is part of Ardor3D.
005 *
006 * Ardor3D is free software: you can redistribute it and/or modify it
007 * under the terms of its license which may be found in the accompanying
008 * LICENSE file or at <http://www.ardor3d.com/LICENSE>.
009 */
010
011package com.ardor3d.extension.terrain.util;
012
013import org.junit.Assert;
014import org.junit.Test;
015
016public class TestRegion {
017    @Test
018    public void testIntersects() throws Exception {
019        final Region r1 = new Region(0, 0, 20, 20);
020        final Region r2 = new Region(5, 5, 10, 10);
021
022        Assert.assertTrue(r1.intersects(r2));
023        Assert.assertTrue(r2.intersects(r1));
024
025        Assert.assertEquals(new Region(5, 5, 10, 10), r2.intersection(r1));
026
027        final Region r3 = new Region(0, 0, 20, 20);
028        Assert.assertEquals(new Region(5, 5, 10, 10), r3.intersection(r2));
029    }
030}