.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/example_kdtree.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_example_kdtree.py: .. _example_kdtree: =================================== KDTree in slam =================================== .. GENERATED FROM PYTHON SOURCE LINES 8-17 .. code-block:: default # Authors: # Guillaume Auzias # Julien Barrès # License: BSD (3-clause) # sphinx_gallery_thumbnail_number = 2 .. GENERATED FROM PYTHON SOURCE LINES 18-19 Importation of slam modules .. GENERATED FROM PYTHON SOURCE LINES 19-23 .. code-block:: default import slam.io as sio mesh = sio.load_mesh("../examples/data/example_mesh.gii") .. GENERATED FROM PYTHON SOURCE LINES 24-26 kdtree serves to compute distances to mesh vertices efficiently here we compute the distance between a vector of two points and the mesh .. GENERATED FROM PYTHON SOURCE LINES 26-29 .. code-block:: default distance, index = mesh.kdtree.query([[0.0, 0.0, 0.0], [0.0, 0.0, 1.0]]) distance index .. rst-class:: sphx-glr-script-out Out: .. code-block:: none array([2132, 2132]) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.006 seconds) .. _sphx_glr_download_auto_examples_example_kdtree.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: example_kdtree.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: example_kdtree.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_