Java Code Examples for org.apache.commons.math3.geometry.euclidean.twod.Line#getTransform()

The following examples show how to use org.apache.commons.math3.geometry.euclidean.twod.Line#getTransform() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0), 1.0e-10);
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0), 1.0e-10);
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 2
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 3
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 4
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 5
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 6
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 7
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0));
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0));
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}
 
Example 8
Source File: LineTest.java    From astor with GNU General Public License v2.0 6 votes vote down vote up
@Test
public void testTransform() throws MathIllegalArgumentException {

    Line l1 = new Line(new Vector2D(1.0 ,1.0), new Vector2D(4.0 ,1.0), 1.0e-10);
    Transform<Euclidean2D, Euclidean1D> t1 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(0.5 * FastMath.PI,
                        ((Line) t1.apply(l1)).getAngle(),
                        1.0e-10);

    Line l2 = new Line(new Vector2D(0.0, 0.0), new Vector2D(1.0, 1.0), 1.0e-10);
    Transform<Euclidean2D, Euclidean1D> t2 =
        Line.getTransform(new AffineTransform(0.0, 0.5, -1.0, 0.0, 1.0, 1.5));
    Assert.assertEquals(FastMath.atan2(1.0, -2.0),
                        ((Line) t2.apply(l2)).getAngle(),
                        1.0e-10);

}