    

 ## On this page

  

 

 # IRockySPHTriangleInteraction Struct Reference

 Last update: 17.07.2025 

`#include <<a class="el" href="rocky__sph__interaction__api_8hpp_source.xhtml">rocky_sph_interaction_api.hpp</a>>`

## <a id="pub-methods" name="pub-methods"></a>Public Member Functions

ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) [get\_home\_element](structIRockySPHTriangleInteraction.xhtml#ae83d8750e222b2a46e6f901fd20b80d5) () const ROCKY\_FUNCTIONS [IRockyGeometryTriangle](structIRockyGeometryTriangle.xhtml) [get\_near\_triangle](structIRockySPHTriangleInteraction.xhtml#a469b4ac53234c9e707fee62725b0470a) () const ROCKY\_FUNCTIONS float [calculate\_element\_triangle\_distance](structIRockySPHTriangleInteraction.xhtml#a6bfc347dab63cdbb89a8045f878ba16f) () const ROCKY\_FUNCTIONS float3 [get\_orthogonal\_projection](structIRockySPHTriangleInteraction.xhtml#a665a945d4045772b3a4759b76daf697b) () const ROCKY\_FUNCTIONS float3 [get\_unit\_vector](structIRockySPHTriangleInteraction.xhtml#a23aa813897c50610e3989dc625f1993a) () const ROCKY\_FUNCTIONS float3 [get\_home\_element\_velocity](structIRockySPHTriangleInteraction.xhtml#afc2786e2e46e3b025371c17290a88f45) () const ROCKY\_FUNCTIONS float3 [get\_boundary\_velocity](structIRockySPHTriangleInteraction.xhtml#ab240320819db1ece083e25b69f305e12) () const ROCKY\_FUNCTIONS real\_sph [get\_normal\_relative\_velocity](structIRockySPHTriangleInteraction.xhtml#a9df83c2a83bd932798eba6a099398ce4) () const ROCKY\_FUNCTIONS real\_sph [get\_tangential\_relative\_velocity](structIRockySPHTriangleInteraction.xhtml#a5ff11979743a9bd389afbc153b7124d9) () const ROCKY\_FUNCTIONS void [add\_force](structIRockySPHTriangleInteraction.xhtml#a749ae0224b1bd279d33404b3d0b84010) (float3 force) ROCKY\_FUNCTIONS void [add\_acceleration](structIRockySPHTriangleInteraction.xhtml#a1578dfd6da083096eb169fe24913dd5b) (float3 acceleration) <a id="details" name="details"></a>## Detailed Description

`<a class="el" href="structIRockySPHTriangleInteraction.xhtml">IRockySPHTriangleInteraction</a>` is a code representation of a pair of neighbor SPH element / geometry triangle with a force interaction. Within Rocky, this pair is usually called *SPH triangle interaction*.



## Member Function Documentation

<a id="a1578dfd6da083096eb169fe24913dd5b" name="a1578dfd6da083096eb169fe24913dd5b"></a>## [◆ ](#a1578dfd6da083096eb169fe24913dd5b)add\_acceleration()

 ROCKY\_FUNCTIONS void IRockySPHTriangleInteraction::add\_acceleration  ( float3  *acceleration*) 

By using this method, a SPH module can pass custom calculated accelerations to the Rockysolver, so they are added to the SPH element and the geometry triangle in the referred *SPH triangle interaction*.Parameters accelerationThe acceleration to be added to the SPH element in the *SPH triangle interaction*, and its triangle counterpart, expressed in Cartesian coordinates. 



<a id="a749ae0224b1bd279d33404b3d0b84010" name="a749ae0224b1bd279d33404b3d0b84010"></a>## [◆ ](#a749ae0224b1bd279d33404b3d0b84010)add\_force()

 ROCKY\_FUNCTIONS void IRockySPHTriangleInteraction::add\_force  ( float3  *force*) 

By using this method, a SPH module can pass custom calculated forces to the Rocky solver,so they are applied to the SPH element and the geometry triangle in the referred *SPH triangle interaction*.Parameters forceThe force to be applied to the SPH element in the *SPH triangle interaction*, and its triangle counterpart, expressed in Cartesian coordinates. 



<a id="a6bfc347dab63cdbb89a8045f878ba16f" name="a6bfc347dab63cdbb89a8045f878ba16f"></a>## [◆ ](#a6bfc347dab63cdbb89a8045f878ba16f)calculate\_element\_triangle\_distance()

 ROCKY\_FUNCTIONS float IRockySPHTriangleInteraction::calculate\_element\_triangle\_distance  ( )  const

ReturnsThe distance between the SPH element and the near geometry triangle, measured in the normal direction to the triangle's plane. 



<a id="ab240320819db1ece083e25b69f305e12" name="ab240320819db1ece083e25b69f305e12"></a>## [◆ ](#ab240320819db1ece083e25b69f305e12)get\_boundary\_velocity()

 ROCKY\_FUNCTIONS float3 IRockySPHTriangleInteraction::get\_boundary\_velocity  ( )  const

ReturnsThe instantaneous velocity of the point that coincides with the orthogonal projection of the SPH element position onto the near geometry triangle, expressed in Cartesian coordinates. 



<a id="ae83d8750e222b2a46e6f901fd20b80d5" name="ae83d8750e222b2a46e6f901fd20b80d5"></a>## [◆ ](#ae83d8750e222b2a46e6f901fd20b80d5)get\_home\_element()

 ROCKY\_FUNCTIONS [IRockySPHElement](structIRockySPHElement.xhtml) IRockySPHTriangleInteraction::get\_home\_element  ( )  const

ReturnsAn `<a class="el" href="structIRockySPHElement.xhtml">IRockySPHElement</a>` object representing the SPH element labeled as *home* in the *SPH interaction*. 



<a id="afc2786e2e46e3b025371c17290a88f45" name="afc2786e2e46e3b025371c17290a88f45"></a>## [◆ ](#afc2786e2e46e3b025371c17290a88f45)get\_home\_element\_velocity()

 ROCKY\_FUNCTIONS float3 IRockySPHTriangleInteraction::get\_home\_element\_velocity  ( )  const

ReturnsThe velocity vector of the SPH element labeled as *home* in the SPH interaction. 



<a id="a469b4ac53234c9e707fee62725b0470a" name="a469b4ac53234c9e707fee62725b0470a"></a>## [◆ ](#a469b4ac53234c9e707fee62725b0470a)get\_near\_triangle()

 ROCKY\_FUNCTIONS [IRockyGeometryTriangle](structIRockyGeometryTriangle.xhtml) IRockySPHTriangleInteraction::get\_near\_triangle  ( )  const

ReturnsAn `<a class="el" href="structIRockyGeometryTriangle.xhtml">IRockyGeometryTriangle</a>` object representing the geometry triangle labeled as *near* in the *SPH triangle interaction*. 



<a id="a9df83c2a83bd932798eba6a099398ce4" name="a9df83c2a83bd932798eba6a099398ce4"></a>## [◆ ](#a9df83c2a83bd932798eba6a099398ce4)get\_normal\_relative\_velocity()

 ROCKY\_FUNCTIONS real\_sph IRockySPHTriangleInteraction::get\_normal\_relative\_velocity  ( )  const

ReturnsThe normal component of the SPH element's velocity relative to the the velocity of the nearest point on that triangle. 



<a id="a665a945d4045772b3a4759b76daf697b" name="a665a945d4045772b3a4759b76daf697b"></a>## [◆ ](#a665a945d4045772b3a4759b76daf697b)get\_orthogonal\_projection()

 ROCKY\_FUNCTIONS float3 IRockySPHTriangleInteraction::get\_orthogonal\_projection  ( )  const

ReturnsThe Cartesian coordinates of the orthogonal projection of the home SPH element position onto the near geometry triangle. 



<a id="a5ff11979743a9bd389afbc153b7124d9" name="a5ff11979743a9bd389afbc153b7124d9"></a>## [◆ ](#a5ff11979743a9bd389afbc153b7124d9)get\_tangential\_relative\_velocity()

 ROCKY\_FUNCTIONS real\_sph IRockySPHTriangleInteraction::get\_tangential\_relative\_velocity  ( )  const

ReturnsThe tangential component of the SPH element's velocity relative to the the velocity of the nearest point on that triangle. 



<a id="a23aa813897c50610e3989dc625f1993a" name="a23aa813897c50610e3989dc625f1993a"></a>## [◆ ](#a23aa813897c50610e3989dc625f1993a)get\_unit\_vector()

 ROCKY\_FUNCTIONS float3 IRockySPHTriangleInteraction::get\_unit\_vector  ( )  const

ReturnsThe unit vector normal to the near geometry triangle. This vector always points to the position of the home SPH element.