# SegmentGeometry

> The geometry of a line segment. See PhysicsBody.CreateShape.

## Definition

* **Type:** Struct
* **Namespace:** [Unity.U2D.Physics](/engine/6000.7/script-reference/unity/u2d/physics.md)
* **Assembly:** UnityEngine.PhysicsCore2DModule
* **Implements:** [IEquatable\<SegmentGeometry>](https://learn.microsoft.com/dotnet/api/system.iequatable-1)

```csharp
public struct SegmentGeometry : IEquatable<SegmentGeometry>
```

## Static Fields

| Value                                                                                                   | Description                                                             |
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [defaultGeometry](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/defaultgeometry.md) | Get the default Segment. The line segment is directed towards the left. |

## Constructors

| Constructor                                                                                    | Description                                                                                                                              |
| ---------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| [SegmentGeometry()](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/ctor.md) | Create a default Segment. See [\_defaultGeometry](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/defaultgeometry.md). |

## Properties

| Property                                                                                            | Description                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [areEdgesValid](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/areedgesvalid.md) | Whether [\_point1](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point1.md) and [\_point2](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point2.md) are far enough apart to form a valid edge.                                                                         |
| [backward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/backward.md)           | Calculate the vector from [\_point2](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point2.md) to [\_point1](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point1.md). See [\_forward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/forward.md).   |
| [forward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/forward.md)             | Calculate the vector from [\_point1](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point1.md) to [\_point2](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point2.md). See [\_backward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/backward.md). |
| [isValid](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/isvalid.md)             | Whether the geometry describes a segment that can be used.                                                                                                                                                                                                                                                     |
| [midPoint](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/midpoint.md)           | The mid-point between [\_point1](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point1.md) and [\_point2](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point2.md).                                                                                                     |
| [point1](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point1.md)               | The first point.                                                                                                                                                                                                                                                                                               |
| [point2](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/point2.md)               | The second point.                                                                                                                                                                                                                                                                                              |

## Methods

| Method                                                                                                    | Description                                                                                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [CalculateAABB](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/calculateaabb.md)       | Calculate the AABB of the geometry.                                                                                                                                                                                                                                                                                                                                                                     |
| [CastRay](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/castray.md)                   | Calculate if a world ray intersects the geometry. See [PhysicsQuery.CastResult](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castresult.md).                                                                                                                                                                                                                                          |
| [CastShape](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/castshape.md)               | Calculate if a cast shape intersects the geometry. Initially touching shapes are treated as a miss. You should check for overlap first if initial overlap is required. See [PhysicsQuery.CastShapeInput](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castshapeinput.md) and [PhysicsQuery.CastResult](/engine/6000.7/script-reference/unity/u2d/physics/physicsquery/castresult.md). |
| [ClosestPoint](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/closestpoint.md)         | Calculate the closest point on this geometry to the specified point.                                                                                                                                                                                                                                                                                                                                    |
| [CreateShapeProxy](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/createshapeproxy.md) | Create a shape proxy from the geometry.                                                                                                                                                                                                                                                                                                                                                                 |
| [Intersect](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/intersect.md)               | Check the intersection between this geometry and another.                                                                                                                                                                                                                                                                                                                                               |
| [InverseTransform](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/inversetransform.md) | Inverse-Transform the geometry.                                                                                                                                                                                                                                                                                                                                                                         |
| [Scale](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/scale.md)                       | Scale the geometry along the [\_forward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/forward.md) and [\_backward](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/backward.md) direction.                                                                                                                                                                       |
| [Transform](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/transform.md)               | Transform the geometry.                                                                                                                                                                                                                                                                                                                                                                                 |

## Static Methods

| Method                                                                                                    | Description                                     |
| --------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
| [Create](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/create.md)                     | Create a Segment.                               |
| [InverseTransform](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/inversetransform.md) | Inverse-Transform a batch of geometry in place. |
| [Transform](/engine/6000.7/script-reference/unity/u2d/physics/segmentgeometry/transform.md)               | Transform a batch of geometry in place.         |
