// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/line/LinePoints2d.java
// public class LinePoints2d {
//     /**
//      * Start point A. XXX rename to A ?
//      */
//     Point2d p1;
//     /**
//      * End point B. XXX rename to B ?
//      */
//     Point2d p2;
// 
//     public LinePoints2d(Point2d p1, Point2d p2) {
//         this.p1 = p1;
//         this.p2 = p2;
//     }
// 
//     public Point2d getP1() {
//         return this.p1;
//     }
// 
//     public void setP1(Point2d p1) {
//         this.p1 = p1;
//     }
// 
//     public Point2d getP2() {
//         return this.p2;
//     }
// 
//     public void setP2(Point2d p2) {
//         this.p2 = p2;
//     }
// 
//     /**
//      * Starting Point A from parametric description.
//      *
//      * @return starting point A.
//      */
//     Point2d getPointA() {
//         return this.p1;
//     }
// 
//     /**
//      * Direction vector U from parametric description.
//      *
//      * @return direction vector U.
//      */
//     Vector2d getVectorU() {
//         Vector2d u = new Vector2d(this.p2);
//         u.sub(this.p1);
//         return u;
//     }
// 
//     public LineParametric2d getLineParametric2d() {
//         return new LineParametric2d(getPointA(), getVectorU());
//     }
// 
// 
//     /** Determinate if point is over line or on line.
//      * @param pPoint point
//      * @return point is over line or on line
//      * TODO RENAME TO POINT_IN_FRONT
//      */
//     public boolean inFront(Tuple2d pPoint) {
//         return LineUtil.matrixDet(this.p1, this.p2, pPoint) >= 0;
//     }
// 
//     /**
//      * {@inheritDoc}
//      *
//      * @see java.lang.Object#toString()
//      */
//     @Override
//     public String toString() {
//         return "L (" + this.p1 + ") -> (" + this.p2 + ")";
//     }
// 
// 
// 
// 
// }
// 
// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/polygon/split/PlygonSplitUtil.java
// protected static class Close {
//     public List<Node> chain;
//     public double beginDistance;
//     public double endDistance;
//     public boolean direction;
//     public boolean removed;
// 
//     /*
//      * (non-Javadoc)
//      * @see java.lang.Object#toString()
//      */
//     @Override
//     public String toString() {
//         return "Close [beginDistance=" + beginDistance + ", endDistance=" + endDistance + ", direction=" + direction
//                 + ", removed=" + removed + ", chain=" + chain + "]";
//     }
// 
// }
// 
// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/polygon/split/PlygonSplitUtil.java
// protected static class Node {
//     private final Point2d point;
//     private final double det;
// 
//     /**
//      * The node.
//      *
//      * @param point
//      *            polygon point
//      * @param det
//      *            determinant from splitting line
//      */
//     public Node(Point2d point, double det) {
//         this.point = point;
//         this.det = det;
//     }
// 
//     /**
//      * Checks if point is lies on splitting line.
//      *
//      * @return is point on splitting line
//      */
//     public boolean isOnSplittingLine() {
//         return det == ZERO;
//     }
// 
//     @Override
//     public String toString() {
//         return "Node [point=" + point + ", det=" + det + "]";
//     }
// }


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.vecmath.Point2d;
import kendzi.math.geometry.line.LinePoints2d;
import kendzi.math.geometry.polygon.split.PlygonSplitUtil.Close;
import kendzi.math.geometry.polygon.split.PlygonSplitUtil.Node;
import org.junit.Test;


        List<List<Node>> left = new ArrayList<List<Node>>();
        List<List<Node>> right = new ArrayList<List<Node>>();

        PlygonSplitUtil.findRightAndLeftParts(list, left, right);

        List<Node> leftPolygon = left.get(0);
        List<Node> rightPolygon = right.get(0);

        assertEquals(4, leftPolygon.size());
        assertEquals(4, rightPolygon.size());

        assertEquals(Arrays.asList(n5, n0, n1, n2), rightPolygon);
        assertEquals(Arrays.asList(n2, n3, n4, n5), leftPolygon);
    }

    private Node detNode(final String name, double d) {
        Node n = new Node(null, d) {
            @Override
            public String toString() {
                return name;
            }
        };
        return n;
    }

    private Point2d debugPoint(int name, double x, double y) {
        return debugPoint("p" + name, x, y);
    }


// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/line/LinePoints2d.java
// public class LinePoints2d {
//     /**
//      * Start point A. XXX rename to A ?
//      */
//     Point2d p1;
//     /**
//      * End point B. XXX rename to B ?
//      */
//     Point2d p2;
// 
//     public LinePoints2d(Point2d p1, Point2d p2) {
//         this.p1 = p1;
//         this.p2 = p2;
//     }
// 
//     public Point2d getP1() {
//         return this.p1;
//     }
// 
//     public void setP1(Point2d p1) {
//         this.p1 = p1;
//     }
// 
//     public Point2d getP2() {
//         return this.p2;
//     }
// 
//     public void setP2(Point2d p2) {
//         this.p2 = p2;
//     }
// 
//     /**
//      * Starting Point A from parametric description.
//      *
//      * @return starting point A.
//      */
//     Point2d getPointA() {
//         return this.p1;
//     }
// 
//     /**
//      * Direction vector U from parametric description.
//      *
//      * @return direction vector U.
//      */
//     Vector2d getVectorU() {
//         Vector2d u = new Vector2d(this.p2);
//         u.sub(this.p1);
//         return u;
//     }
// 
//     public LineParametric2d getLineParametric2d() {
//         return new LineParametric2d(getPointA(), getVectorU());
//     }
// 
// 
//     /** Determinate if point is over line or on line.
//      * @param pPoint point
//      * @return point is over line or on line
//      * TODO RENAME TO POINT_IN_FRONT
//      */
//     public boolean inFront(Tuple2d pPoint) {
//         return LineUtil.matrixDet(this.p1, this.p2, pPoint) >= 0;
//     }
// 
//     /**
//      * {@inheritDoc}
//      *
//      * @see java.lang.Object#toString()
//      */
//     @Override
//     public String toString() {
//         return "L (" + this.p1 + ") -> (" + this.p2 + ")";
//     }
// 
// 
// 
// 
// }
// 
// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/polygon/split/PlygonSplitUtil.java
// protected static class Close {
//     public List<Node> chain;
//     public double beginDistance;
//     public double endDistance;
//     public boolean direction;
//     public boolean removed;
// 
//     /*
//      * (non-Javadoc)
//      * @see java.lang.Object#toString()
//      */
//     @Override
//     public String toString() {
//         return "Close [beginDistance=" + beginDistance + ", endDistance=" + endDistance + ", direction=" + direction
//                 + ", removed=" + removed + ", chain=" + chain + "]";
//     }
// 
// }
// 
// Path: kendzi-math-geometry/src/main/java/kendzi/math/geometry/polygon/split/PlygonSplitUtil.java
// protected static class Node {
//     private final Point2d point;
//     private final double det;
// 
//     /**
//      * The node.
//      *
//      * @param point
//      *            polygon point
//      * @param det
//      *            determinant from splitting line
//      */
//     public Node(Point2d point, double det) {
//         this.point = point;
//         this.det = det;
//     }
// 
//     /**
//      * Checks if point is lies on splitting line.
//      *
//      * @return is point on splitting line
//      */
//     public boolean isOnSplittingLine() {
//         return det == ZERO;
//     }
// 
//     @Override
//     public String toString() {
//         return "Node [point=" + point + ", det=" + det + "]";
//     }
// }


// Path: kendzi-math-geometry/src/test/java/kendzi/math/geometry/polygon/split/PlygonSplitUtilInternalTest.java
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.vecmath.Point2d;
import kendzi.math.geometry.line.LinePoints2d;
import kendzi.math.geometry.polygon.split.PlygonSplitUtil.Close;
import kendzi.math.geometry.polygon.split.PlygonSplitUtil.Node;
import org.junit.Test;


        List<List<Node>> left = new ArrayList<List<Node>>();
        List<List<Node>> right = new ArrayList<List<Node>>();

        PlygonSplitUtil.findRightAndLeftParts(list, left, right);

        List<Node> leftPolygon = left.get(0);
        List<Node> rightPolygon = right.get(0);

        assertEquals(4, leftPolygon.size());
        assertEquals(4, rightPolygon.size());

        assertEquals(Arrays.asList(n5, n0, n1, n2), rightPolygon);
        assertEquals(Arrays.asList(n2, n3, n4, n5), leftPolygon);
    }

    private Node detNode(final String name, double d) {
        Node n = new Node(null, d) {
            @Override
            public String toString() {
                return name;
            }
        };
        return n;
    }

    private Point2d debugPoint(int name, double x, double y) {
        return debugPoint("p" + name, x, y);
    }


    private Point2d debugPoint(final String name, double x, double y) {
