# SegmentDistance(SegmentGeometry, PhysicsTransform, SegmentGeometry, PhysicsTransform)

> Calculate the distance and closest points between two segments.

## Definition

* **Type:** Method
* **Namespace:** [Unity.U2D.Physics](/engine/6000.5/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule

```csharp
public static PhysicsQuery.SegmentDistanceResult SegmentDistance(SegmentGeometry geometryA, PhysicsTransform transformA, SegmentGeometry geometryB, PhysicsTransform transformB)
```

### Parameters

**** (\[SegmentGeometry]\(/engine/6000.5/script-reference/unity/u2d/physics/segmentgeometry)): The first geometry to use.**** (\[PhysicsTransform]\(/engine/6000.5/script-reference/unity/u2d/physics/physicstransform)): The transform used to specify where the first geometry is positioned.**** (\[SegmentGeometry]\(/engine/6000.5/script-reference/unity/u2d/physics/segmentgeometry)): The second geometry to use.**** (\[PhysicsTransform]\(/engine/6000.5/script-reference/unity/u2d/physics/physicstransform)): The transform used to specify where the second geometry is positioned.

### Returns

| Type                                                                                                             | Description                   |
| ---------------------------------------------------------------------------------------------------------------- | ----------------------------- |
| [SegmentDistanceResult](/engine/6000.5/script-reference/unity/u2d/physics/physicsquery/segmentdistanceresult.md) | The segment distance results. |
