# ImmutableSegment

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/ImmutableSegment.kt+class:androidx.ink.geometry.ImmutableSegment) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class ImmutableSegment : Segment
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.ink.geometry.Segment](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment) ||
|   | ↳ | [androidx.ink.geometry.ImmutableSegment](https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment) |

*** ** * ** ***

Represents a directed line segment between two points. See `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableSegment` for mutable alternative.

## Summary

| ### Public constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#ImmutableSegment(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)(start: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec, end: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)` | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#hashCode()()` | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#toImmutable()()` Returns an immutable copy of this object. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#end()` | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableSegment#start()` | Cmn |

### Inherited functions

From [androidx.ink.geometry.Segment](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment) `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeBoundingBox()()`

Returns the minimum bounding box containing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment`.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeBoundingBox(androidx.ink.geometry.MutableBox)(outBox: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox)`

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeBoundingBox(androidx.ink.geometry.MutableBox)` with the minimum bounding box containing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment`.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeDisplacement()()`

Returns an ImmutableVec with the displacement from start to end.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeDisplacement(androidx.ink.geometry.MutableVec)(outVec: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)`

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeDisplacement(androidx.ink.geometry.MutableVec)` with the displacement from start to end.
Cmn `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeLength()()`

The length of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment`.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeLerpPoint(kotlin.Float)(ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Returns the point on the segment at the given ratio of the segment's length, measured from the start point.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeLerpPoint(kotlin.Float,androidx.ink.geometry.MutableVec)(ratio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, outVec: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)`

Fills `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeLerpPoint(kotlin.Float,androidx.ink.geometry.MutableVec)` with the point on the segment at the given ratio of the segment's length, measured from the start point.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeMidpoint()()`

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` that lies halfway along the segment.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeMidpoint(androidx.ink.geometry.MutableVec)(outVec: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)`

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#computeMidpoint(androidx.ink.geometry.MutableVec)` with the point halfway along the segment.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#isAlmostEqual(androidx.ink.geometry.Segment,kotlin.Float)(other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment, tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Compares this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#isAlmostEqual(androidx.ink.geometry.Segment,kotlin.Float)`, and returns true if both `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#start()` points are considered almost equal with the given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#isAlmostEqual(androidx.ink.geometry.Segment,kotlin.Float)`, and likewise for both `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#end()` points.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#project(androidx.ink.geometry.Vec)(pointToProject: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)`

Returns the multiple of the segment's length at which the infinite extrapolation of this segment is closest to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Segment#project(androidx.ink.geometry.Vec)`.
Cmn

## Public constructors

### ImmutableSegment

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
ImmutableSegment(start: Vec, end: Vec)
```

## Public functions

### equals

Cmn

```
open operator fun equals(other: Any?): Boolean
```

### hashCode

Cmn

```
open fun hashCode(): Int
```

### toImmutable

Cmn

```
open fun toImmutable(): ImmutableSegment
```

Returns an immutable copy of this object. This will return itself if called on an immutable instance.

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### end

Cmn

```
open val end: ImmutableVec
```

### start

Cmn

```
open val start: ImmutableVec
```