> ## Documentation Index
> Fetch the complete documentation index at: https://developer.synopsys.com/llms.txt
> Use this file to discover all available pages before exploring further.

# IRockySPHTriangleInteraction Struct Reference

`#include <rocky_sph_interaction_api.hpp>`

## Public Member Functions

| Type | Name |
| - | - |
| ROCKY\_FUNCTIONS [IRockySPHElement](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockySPHElement.md) | [get\_home\_element](#ae83d8750e222b2a46e6f901fd20b80d5) () const |
| ROCKY\_FUNCTIONS [IRockyGeometryTriangle](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockyGeometryTriangle.md) | [get\_near\_triangle](#a469b4ac53234c9e707fee62725b0470a) () const |
| ROCKY\_FUNCTIONS float | [calculate\_element\_triangle\_distance](#a6bfc347dab63cdbb89a8045f878ba16f) () const |
| ROCKY\_FUNCTIONS float3 | [get\_orthogonal\_projection](#a665a945d4045772b3a4759b76daf697b) () const |
| ROCKY\_FUNCTIONS float3 | [get\_unit\_vector](#a23aa813897c50610e3989dc625f1993a) () const |
| ROCKY\_FUNCTIONS float3 | [get\_home\_element\_velocity](#afc2786e2e46e3b025371c17290a88f45) () const |
| ROCKY\_FUNCTIONS float3 | [get\_boundary\_velocity](#ab240320819db1ece083e25b69f305e12) () const |
| ROCKY\_FUNCTIONS real\_sph | [get\_normal\_relative\_velocity](#a9df83c2a83bd932798eba6a099398ce4) () const |
| ROCKY\_FUNCTIONS real\_sph | [get\_tangential\_relative\_velocity](#a5ff11979743a9bd389afbc153b7124d9) () const |
| ROCKY\_FUNCTIONS void | [add\_force](#a749ae0224b1bd279d33404b3d0b84010) (float3 force) |
| ROCKY\_FUNCTIONS void | [add\_acceleration](#a1578dfd6da083096eb169fe24913dd5b) (float3 acceleration) |

## Detailed Description

[`IRockySPHTriangleInteraction`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockySPHTriangleInteraction) 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

### add\_acceleration()

```cpp theme={null}
ROCKY_FUNCTIONS void IRockySPHTriangleInteraction::add_acceleration(float3 acceleration)
```

**By using this method, a SPH module can pass custom calculated accelerations to the Rocky**

solver, so they are added to the SPH element and the geometry triangle in the referred *SPH triangle interaction*.

**Parameters**

| Name | Description |
| - | - |
| acceleration | The acceleration to be added to the SPH element in the *SPH triangle interaction*, and its triangle counterpart, expressed in Cartesian coordinates. |

### add\_force()

```cpp theme={null}
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**

| Name | Description |
| - | - |
| force | The force to be applied to the SPH element in the *SPH triangle interaction*, and its triangle counterpart, expressed in Cartesian coordinates. |

### calculate\_element\_triangle\_distance()

```cpp theme={null}
ROCKY_FUNCTIONS float IRockySPHTriangleInteraction::calculate_element_triangle_distance() const
```

**Returns**

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

### get\_boundary\_velocity()

```cpp theme={null}
ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_boundary_velocity() const
```

**Returns**

The 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.

### get\_home\_element()

```cpp theme={null}
ROCKY_FUNCTIONS IRockySPHElement IRockySPHTriangleInteraction::get_home_element() const
```

**Returns**

An [`IRockySPHElement`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockySPHElement) object representing the SPH element labeled as *home* in the *SPH interaction*.

### get\_home\_element\_velocity()

```cpp theme={null}
ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_home_element_velocity() const
```

**Returns**

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

### get\_near\_triangle()

```cpp theme={null}
ROCKY_FUNCTIONS IRockyGeometryTriangle IRockySPHTriangleInteraction::get_near_triangle() const
```

**Returns**

An [`IRockyGeometryTriangle`](https://developer.synopsys.com/docs/rocky/rocky-solver-sdk/2025-r1/structIRockyGeometryTriangle) object representing the geometry triangle labeled as *near* in the *SPH triangle interaction*.

### get\_normal\_relative\_velocity()

```cpp theme={null}
ROCKY_FUNCTIONS real_sph IRockySPHTriangleInteraction::get_normal_relative_velocity() const
```

**Returns**

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

### get\_orthogonal\_projection()

```cpp theme={null}
ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_orthogonal_projection() const
```

**Returns**

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

### get\_tangential\_relative\_velocity()

```cpp theme={null}
ROCKY_FUNCTIONS real_sph IRockySPHTriangleInteraction::get_tangential_relative_velocity() const
```

**Returns**

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

### get\_unit\_vector()

```cpp theme={null}
ROCKY_FUNCTIONS float3 IRockySPHTriangleInteraction::get_unit_vector() const
```

**Returns**

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