Join this triangulation with another. If the points are known to have no duplicates, then
        set unique=False to skip the testing and duplicate removal
190052
def join(self, t2, unique=False):
        

        x_v1 = np.concatenate((self.x, t2.x), axis=0)
        y_v1 = np.concatenate((self.y, t2.y), axis=0)

        ## remove any duplicates

        if not unique:
            a = np.ascontiguousarray(np.vstack((x_v1, y_v1)).T)
            unique_a = np.unique(a.view([('', a.dtype)]*a.shape[1]))
            unique_coords = unique_a.view(a.dtype).reshape((unique_a.shape[0], a.shape[1]))

            x_v1 = unique_coords[:,0]
            y_v1 = unique_coords[:,1]

        return x_v1, y_v1
1000269
function freeJoin(p1, p2, bbox) {

        var p = new g.Point(p1.x, p2.y);
        if (bbox.containsPoint(p)) p = new g.Point(p2.x, p1.y);
        // kept for reference
        // if (bbox.containsPoint(p)) p = null;

        return p;
    }
806590
private void markNeighbor( TriangulationPoint p1, 
                               TriangulationPoint p2, 
                               DelaunayTriangle t )
    {
        if( ( p1 == points[2] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[2] ) )
        {
            neighbors[0] = t;
        }
        else if( ( p1 == points[0] && p2 == points[2] ) || ( p1 == points[2] && p2 == points[0] ) )
        {
            neighbors[1] = t;
        }
        else if( ( p1 == points[0] && p2 == points[1] ) || ( p1 == points[1] && p2 == points[0] ) )
        {
            neighbors[2] = t;
        }
        else
        {
            logger.error( "Neighbor error, please report!" );
            // throw new Exception("Neighbor error, please report!");
        }
    }
261028
def _adjacent_tri(self, edge, i):
        
        if not np.isscalar(i):
            i = [x for x in i if x not in edge][0]

        try:
            pt1 = self._edges_lookup[edge]
            pt2 = self._edges_lookup[(edge[1], edge[0])]
        except KeyError:
            return None
            
        if pt1 == i:
            return (edge[1], edge[0], pt2)
        elif pt2 == i:
            return (edge[1], edge[0], pt1)
        else:
            raise RuntimeError("Edge %s and point %d do not form a triangle "
                               "in this mesh." % (edge, i))
967911
def object_merge(old, new, unique=False):
    
    if isinstance(old, list) and isinstance(new, list):
        if old == new:
            return
        for item in old[::-1]:
            if unique and item in new:
                continue
            new.insert(0, item)
    if isinstance(old, dict) and isinstance(new, dict):
        for key, value in old.items():
            if key not in new:
                new[key] = value
            else:
                object_merge(value, new[key])
40472
public TriangulationPoint pointCW( TriangulationPoint point )
    {
        if( point == points[0] )
        {
            return points[2];
        }
        else if( point == points[1] )
        {
            return points[0];
        }
        else if( point == points[2] )
        {
            return points[1];
        }
        logger.error( "point location error" );
        throw new RuntimeException("[FIXME] point location error");
    }
1079196
def join(self, t2, unique=False):
        

        lonv1 = np.concatenate((self.lons, t2.lons), axis=0)
        latv1 = np.concatenate((self.lats, t2.lats), axis=0)

        ## remove any duplicates

        if not unique:
            lonv1, latv1 = remove_duplicate_lonlat(lonv1, latv1)

        return lonv1, latv1
278906
public void markConstrainedEdge( TriangulationPoint p, TriangulationPoint q )
    {
        if( ( q == points[0] && p == points[1] ) || ( q == points[1] && p == points[0] ) )
        {
            cEdge[2] = true;
        }
        else if( ( q == points[0] && p == points[2] ) || ( q == points[2] && p == points[0] ) )
        {
            cEdge[1] = true;
        }
        else if( ( q == points[1] && p == points[2] ) || ( q == points[2] && p == points[1] ) )
        {
            cEdge[0] = true;
        }
    }
194070
private List<Point2D> merge(final List<Point2D> one, final List<Point2D> two) {
        final Set<Point2D> oneSet = new HashSet<Point2D>(one);
        for (Point2D item : two) {
            if (!oneSet.contains(item)) {
                one.add(item);
            }
        }
        return one;
    }
420503
def intersection_update(self, other):
        
        if not isinstance(other, Set):
            raise ValueError('other must be a Set instance')
        if self is other:
            return
        # we make a copy of the list so that we can remove items from
        # the list without breaking the iterator.
        for item in list(self.items):
            if item not in other.items:
                self.items.remove(item)
764913
public List<Triangle> triangulate(List<Vector3> points) {
		init(points.size());

		Set<Vector3> vertices = new TreeSet<Vector3>(new PointComparator());

		bbMin = new Vector3(points.get(0));
		bbMax = new Vector3(points.get(0));

		//Insert Points
		for (Vector3 point:points) {
			this.insertPoint(vertices, point);
		}

		List<Triangle> triangles = null;

		if (modCount != modCount2 && vertices.size() > 2) {
			triangles = generateTriangles();
		}

		return triangles;
	}
1245338
def add_to_point(other)
      check_group! other

      # Assertions:
      # raise "point given (#{point.inspect}) does not belong to #{group.name}" if !group.include?(point)
      # raise "point (#{inspect}) does not belong to #{group.name}" if !group.include?(self)

      # Rules 1 and 2
      return other if infinity?
      return self if other.infinity?

      # Rule 3
      return group.infinity if x == other.x && y == field.mod(-other.y)

      # Rule 4
      if x != other.x
        gamma = field.mod((other.y - y) * field.inverse(other.x - x))
        sum_x = field.mod(gamma * gamma - x - other.x)
        sum_y = field.mod(gamma * (x - sum_x) - y)
        return self.class.new(group, sum_x, sum_y)
      end

      # Rule 5
      return double if self == other

      raise "Failed to add #{inspect} to #{other.inspect}: No addition rules matched."
    end
583369
def get_next_triangle(mesh, T, plane, intersection, dist_tol):
    
    if intersection[0] == INTERSECT_EDGE:
        tris = mesh.triangles_for_edge(intersection[2])
    elif intersection[0] == INTERSECT_VERTEX:
        tris = mesh.triangles_for_vert(intersection[2])
    else:
        assert False, 'Invalid intersection[0] value : %d' % intersection[0]

    # Knowing where we come from is not enough. If an edge of the triangle
    # lies exactly on the plane, i.e. :
    #
    #   /t1\
    # -v1---v2-
    #   \t2/
    #
    # With v1, v2 being the vertices and t1, t2 being the triangles, then
    # if you just try to go to the next connected triangle that intersect,
    # you can visit v1 -> t1 -> v2 -> t2 -> v1 .
    # Therefore, we need to limit the new candidates to the set of unvisited
    # triangles and once we've visited a triangle and decided on a next one,
    # remove all the neighbors of the visited triangle so we don't come
    # back to it

    T = set(T)
    for tid in tris:
        if tid in T:
            intersections = compute_triangle_plane_intersections(
                    mesh, tid, plane, dist_tol)
            if len(intersections) == 2:
                T = T.difference(tris)
                return tid, intersections, T
    return None, [], T
655685
private static void checkDuplicates(ImmutableList<SQLPPTriplesMap> mappings)
            throws DuplicateMappingException {

        Set<SQLPPTriplesMap> mappingSet = new HashSet<>(mappings);

        int duplicateCount = mappings.size() - mappingSet.size();

        /**
         * If there are some triplesMaps, finds them
         */
        if (duplicateCount > 0) {
            Set<String> duplicateIds = new HashSet<>();
            int remaining = duplicateCount;
            for (SQLPPTriplesMap mapping : mappings) {
                if (mappingSet.contains(mapping)) {
                    mappingSet.remove(mapping);
                }
                /**
                 * Duplicate
                 */
                else {
                    duplicateIds.add(mapping.getId());
                    if (--remaining == 0)
                        break;
                }
            }
            //TODO: indicate the source
            throw new DuplicateMappingException(String.format("Found %d duplicates in the following ids: %s",
                    duplicateCount, duplicateIds.toString()));
        }
    }
778991
boolean hasPointFeatures()
    {
      for (int geometry = getFirstGeometry(); geometry != -1; geometry = getNextGeometry(geometry))
      {
        if (!Geometry.isMultiPath(getGeometryType(geometry)))
          return true;
      }
      return false;
    }
976913
public void clear()
    {
        DelaunayTriangle t;
        for( int i=0; i<3; i++ )
        {
            t = neighbors[i];
            if( t != null )
            {
                t.clearNeighbor( this );
            }
        }
        clearNeighbors();
        points[0]=points[1]=points[2]=null;
    }
603292
def edge_refine_triangulation_by_vertices(self, vertices):
        

        triangles = self.identify_vertex_triangles(vertices)

        return self.edge_refine_triangulation_by_triangles(triangles)