---
title: "matrix4x4f::transformDirection"
framework: Compute Graph
role: symbol
role_heading: Function
platforms: [iOS 27.0+, iPadOS 27.0+, macOS 27.0+, tvOS 27.0+, visionOS 27.0+]
path: computegraph/matrix4x4f/transformdirection
---

# matrix4x4f::transformDirection

Transforms a direction vector by a 4x4 matrix, ignoring translation.

## Declaration

```swift
float3 matrix4x4f::transformDirection(float4x4 matrix, float3 vector)
```

## Parameters

- `matrix`: The 4x4 transformation matrix to apply.
- `vector`: The 3D direction vector to transform.

## Return Value

Return Value The transformed 3D direction vector.

## Discussion

Discussion Multiplies the vector by the matrix with a w component of 0.0, so only rotation and scale are applied. This is appropriate for normals, tangents, and other direction vectors that should not be affected by the matrix’s translational component. note:
