Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Vous êtes un professionnel et vous avez besoin d'une formation ? Calcul scientifique
avec Python
Voir le programme détaillé
Module « scipy.spatial »

Fonction tsearch - module scipy.spatial

Signature de la fonction tsearch

def tsearch(tri, xi) 

Description

help(scipy.spatial.tsearch)

    tsearch(tri, xi)

    Find simplices containing the given points. This function does the
    same thing as `Delaunay.find_simplex`.

    Parameters
    ----------
    tri : DelaunayInfo
        Delaunay triangulation
    xi : ndarray of double, shape (..., ndim)
        Points to locate

    Returns
    -------
    i : ndarray of int, same shape as `xi`
        Indices of simplices containing each point.
        Points outside the triangulation get the value -1.

    See Also
    --------
    Delaunay.find_simplex

    Notes
    -----
    .. versionadded:: 0.9

    Examples
    --------
    >>> import numpy as np
    >>> import matplotlib.pyplot as plt
    >>> from scipy.spatial import Delaunay, delaunay_plot_2d, tsearch
    >>> rng = np.random.default_rng()

    The Delaunay triangulation of a set of random points:

    >>> pts = rng.random((20, 2))
    >>> tri = Delaunay(pts)
    >>> _ = delaunay_plot_2d(tri)

    Find the simplices containing a given set of points:

    >>> loc = rng.uniform(0.2, 0.8, (5, 2))
    >>> s = tsearch(tri, loc)
    >>> plt.triplot(pts[:, 0], pts[:, 1], tri.simplices[s], 'b-', mask=s==-1)
    >>> plt.scatter(loc[:, 0], loc[:, 1], c='r', marker='x')
    >>> plt.show()

    


Vous êtes un professionnel et vous avez besoin d'une formation ? Sensibilisation à
l'Intelligence Artificielle
Voir le programme détaillé