Search in sources :

Example 1 with Shape

use of com.xenoage.utils.math.geom.Shape in project Zong by Xenoage.

the class StaffStampingTest method containsPoint.

@Test
public void containsPoint() {
    StaffStamping staff = new StaffStamping(null, 0, new Point2f(40, 80), 160, 5, 1);
    Shape shape = staff.getBoundingShape();
    // don't hit it
    assertFalse(shape.contains(new Point2f(39, 81)));
    assertFalse(shape.contains(new Point2f(42, 79)));
    assertFalse(shape.contains(new Point2f(201, 81)));
    assertFalse(shape.contains(new Point2f(100, 85)));
    // hit it
    assertTrue(shape.contains(new Point2f(40, 81)));
    assertTrue(shape.contains(new Point2f(41, 80)));
    assertTrue(shape.contains(new Point2f(200, 81)));
    assertTrue(shape.contains(new Point2f(100, 84)));
}
Also used : Point2f(com.xenoage.utils.math.geom.Point2f) Shape(com.xenoage.utils.math.geom.Shape) Test(org.junit.Test)

Aggregations

Point2f (com.xenoage.utils.math.geom.Point2f)1 Shape (com.xenoage.utils.math.geom.Shape)1 Test (org.junit.Test)1