<!--
{
  "availability" : [
    "iOS: 14.0.0 -",
    "iPadOS: 14.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Vision",
  "identifier" : "/documentation/Vision/VNVector/unitVector(for:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "c:objc(cs)VNVector(cm)unitVectorForVector:"
  },
  "title" : "unitVector(for:)"
}
-->

# unitVector(for:)

Calculates a vector that’s normalized by preserving its direction, so that the vector length equals 1.0.

```
class func unitVector(for vector: VNVector) -> VNVector
```

## Parameters

`vector`

The vector whose unit vector you want to calculate.

## Return Value

The unit vector.

## Discussion

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)