# ImmutableVec.Companion

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/ImmutableVec.kt+class:androidx.ink.geometry.ImmutableVec.Companion) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  object ImmutableVec.Companion
  ```

*** ** * ** ***

## Summary

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec#fromDirectionInDegreesAndMagnitude(kotlin.Float,kotlin.Float)( directionDegrees: @https://developer.android.com/reference/kotlin/androidx/ink/geometry/AngleDegreesFloat https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, magnitude: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the given magnitude and direction in degrees rotated from the positive x-axis in the direction of positive y-axis. | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec.Companion.https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec.Companion#(androidx.ink.geometry.ImmutableVec.Companion).from(android.graphics.PointF)(point: https://developer.android.com/reference/android/graphics/PointF.html)` Constructs an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableVec.Companion).from(android.graphics.PointF)`. | android |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec.Companion.https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec.Companion#(androidx.ink.geometry.ImmutableVec.Companion).from(androidx.compose.ui.geometry.Offset)(offset: https://developer.android.com/reference/kotlin/androidx/compose/ui/geometry/Offset)` Constructs an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.ImmutableVec.Companion).from(androidx.compose.ui.geometry.Offset)`. | android |

## Public functions

### fromDirectionInDegreesAndMagnitude

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

```
fun fromDirectionInDegreesAndMagnitude(
    directionDegrees: @AngleDegreesFloat Float,
    magnitude: Float
): ImmutableVec
```

Returns an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the given magnitude and direction in degrees rotated from the positive x-axis in the direction of positive y-axis.

## Extension functions

### ImmutableVec.Companion.from

android 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/AndroidGraphicsConversionExtensions.android.kt+function:from)

```
fun ImmutableVec.Companion.from(point: PointF): ImmutableVec
```

Constructs an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.ImmutableVec.Companion).from(android.graphics.PointF)`.

Java callers should prefer `AndroidGraphicsConverter.createVec(PointF)`(`https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#createVec(android.graphics.PointF)`).

### ImmutableVec.Companion.from

android Artifact: [androidx.ink:ink-geometry-compose](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/compose/ComposeConversionExtensions.kt+function:from)

```
fun ImmutableVec.Companion.from(offset: Offset): ImmutableVec
```

Constructs an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` with the values from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.ImmutableVec.Companion).from(androidx.compose.ui.geometry.Offset)`.

Performance-sensitive code should use the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/compose/package-summary#(androidx.ink.geometry.MutableVec).populateFrom(androidx.compose.ui.geometry.Offset)` overload that takes a pre-allocated `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec`, so that instance can be reused across multiple calls.