Search in sources :

Example 1 with Vector2D_F64

use of georegression.struct.point.Vector2D_F64 in project BoofCV by lessthanoptimal.

the class TestSnapToLineEdge method differentInitial.

private void differentInitial(SnapToLineEdge alg, LineSegment2D_F64 segment) {
    Vector2D_F64 v = new Vector2D_F64();
    v.x = -segment.slopeY();
    v.y = segment.slopeX();
    v.normalize();
    LineGeneral2D_F64 found = new LineGeneral2D_F64();
    // try
    for (int i = -1; i <= 1; i++) {
        LineSegment2D_F64 work = segment.copy();
        work.a.x += i * v.x;
        work.a.y += i * v.y;
        work.b.x += i * v.x;
        work.b.y += i * v.y;
        assertTrue(alg.refine(work.a, work.b, found));
        checkIdentical(segment, found);
        // do it in the other direction. shouldn't matter
        assertTrue(alg.refine(work.b, work.a, found));
        checkIdentical(segment, found);
    }
}
Also used : LineSegment2D_F64(georegression.struct.line.LineSegment2D_F64) LineGeneral2D_F64(georegression.struct.line.LineGeneral2D_F64) Vector2D_F64(georegression.struct.point.Vector2D_F64)

Aggregations

LineGeneral2D_F64 (georegression.struct.line.LineGeneral2D_F64)1 LineSegment2D_F64 (georegression.struct.line.LineSegment2D_F64)1 Vector2D_F64 (georegression.struct.point.Vector2D_F64)1