use of georegression.struct.line.LineParametric2D_F64 in project BoofCV by lessthanoptimal.
the class TestRefinePolyLineCorner method distanceSum.
@Test
public void distanceSum() {
RefinePolyLineCorner alg = new RefinePolyLineCorner(true);
List<Point2D_I32> contour = new ArrayList<>();
for (int i = 0; i < 20; i++) {
contour.add(new Point2D_I32(i, 2));
}
LineGeneral2D_F64 line = UtilLine2D_F64.convert(new LineParametric2D_F64(0, 0, 1, 0), (LineGeneral2D_F64) null);
// normal case
assertEquals(2 * 16, alg.distanceSum(line, 2, 17, contour), 1e-8);
// boundary case
assertEquals(2 * 15, alg.distanceSum(line, 10, 4, contour), 1e-8);
}
use of georegression.struct.line.LineParametric2D_F64 in project BoofCV by lessthanoptimal.
the class TestPolylineSplitMerge method assignLine_parametric.
@Test
public void assignLine_parametric() {
List<Point2D_I32> contour = new ArrayList<>();
for (int i = 0; i < 20; i++) {
contour.add(new Point2D_I32(i, 2));
}
// make these points offset from all the others. That way if it grabs the wrong points the line will be wrong
contour.get(1).set(1, 5);
contour.get(9).set(9, 5);
LineParametric2D_F64 line = new LineParametric2D_F64();
PolylineSplitMerge.assignLine(contour, 1, 9, line);
assertEquals(0, Distance2D_F64.distanceSq(line, 0, 5), GrlConstants.TEST_F64);
assertEquals(0, Distance2D_F64.distanceSq(line, 1, 5), GrlConstants.TEST_F64);
assertEquals(0, Distance2D_F64.distanceSq(line, 9, 5), GrlConstants.TEST_F64);
}
Aggregations