.. include:: ../substitutions

.. oe:namespace:: OEDepict

.. meta::
   :keywords: OEGetNearestBond

.. _OEDepict_OEGetNearestBond:


.. oe:function:: OEGetNearestBond

   .. oe:language:: c++ java csharp

      .. oe:api::

         OENearestBond OEGetNearestBond(const OE2DMolDisplay& disp,
                                        const OE2DPoint& point)

   .. oe:language:: python

      .. oe:api:: python

         OEGetNearestBond(disp: OE2DMolDisplay, p: OE2DPoint) -> OENearestBond

   Returns an :ref:`OENearestBond <OEDepict_OENearestBond>` object that stores a pointer
   of the bond which is depicted nearest to a given 2D display coordinates.

   .. figure:: ../images/OEGetNearestBond.*
      :align:  center

      **Example of using the OEGetNearestBond function
      to determine the nearest bond to a specific 2D point on the canvas**

   *disp*
      The :ref:`OE2DMolDisplay <OEDepict_OE2DMolDisplay>` object of which bonds are being
      considered.
      Only bonds of which bond display is visible are examined
      (:oe:meth:`OEDepict::OEBondDisplayBase::IsVisible`)

   *point*
      Specifies the 2D display coordinates.

   .. seealso::

      * :ref:`OENearestBond <OEDepict_OENearestBond>` class
      * :oe:func:`OEDepict::OEGetNearbyBond` function
