<!--
{
  "availability" : [
    "iOS: 17.0.0 -",
    "iPadOS: 17.0.0 -",
    "macCatalyst: -",
    "macOS: 14.0.0 -",
    "tvOS: 17.0.0 -",
    "visionOS: -",
    "watchOS: 10.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Spatial",
  "identifier" : "/documentation/Spatial/Angle2D/atan2(y:x:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "Spatial"
    ],
    "preciseIdentifier" : "s:So7SPAnglea7SpatialE5atan21y1xABSd_SdtFZ"
  },
  "title" : "atan2(y:x:)"
}
-->

# atan2(y:x:)

Returns the two-argument arctangent of the specified values.

```
static func atan2(y: Double, x: Double) -> Angle2D
```

## Parameters

`y`

The source `y` value.

`x`

The source `z` value

---

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)