private static void addPointToList(PointF point,List<PointF> nodes,List<PointF> nodesContact){
  if (point != null) {
    PointF pV=null;
    int po1=0, po2=0;
    float min1=INF;
    for (int i=0; i < nodesContact.size() - 1; i++) {
      PointF p1=nodes.get((int)nodesContact.get(i).x);
      PointF p2=nodes.get((int)nodesContact.get(i).y);
      if (!MapMath.isObtuseAnglePointAndLine(point,p1,p2)) {
        float minDis=MapMath.getDistanceFromPointToLine(point,p1,p2);
        if (min1 > minDis) {
          pV=MapMath.getIntersectionCoordinatesFromPointToLine(point,p1,p2);
          min1=minDis;
          po1=(int)nodesContact.get(i).x;
          po2=(int)nodesContact.get(i).y;
        }
      }
    }
    nodes.add(pV);
    nodesContact.add(new PointF(po1,nodes.size() - 1));
    nodesContact.add(new PointF(po2,nodes.size() - 1));
  }
}

private static void addPointToList ( PointF point , List < PointF > nodes , List < PointF > nodesContact ) { if ( point != null ) { PointF pV = null ; int po1 = 0 , po2 = 0 ; float min1 = INF ; for ( int i = 0 ; i < nodesContact . size ( ) - 1 ; i ++ ) { PointF p1 = nodes . get ( ( int ) nodesContact . get ( i ) . x ) ; PointF p2 = nodes . get ( ( int ) nodesContact . get ( i ) . y ) ; if ( ! MapMath . isObtuseAnglePointAndLine ( point , p1 , p2 ) ) { float minDis = MapMath . getDistanceFromPointToLine ( point , p1 , p2 ) ; if ( min1 > minDis ) { pV = MapMath . getIntersectionCoordinatesFromPointToLine ( point , p1 , p2 ) ; min1 = minDis ; po1 = ( int ) nodesContact . get ( i ) . x ; po2 = ( int ) nodesContact . get ( i ) . y ; } } } nodes . add ( pV ) ; nodesContact . add ( new PointF ( po1 , nodes . size ( ) - 1 ) ) ; nodesContact . add ( new PointF ( po2 , nodes . size ( ) - 1 ) ) ; } }
add point to list
