# Electromagnetism geometry

Winding geometry, a balanced three-phase resultant, and ideal resolver quadrature. Pure TypeScript with no React and no claim to solve a complete electromagnetic field.

> For the complete index, see [llms.txt](https://robocn.dev/llms.txt). A Markdown version of any page is available by appending `.md` to its URL or by sending an `Accept: text/markdown` header.

## Install

```bash
bunx --bun shadcn@latest add https://robocn.dev/r/electromagnetism-geometry.json
```

Registry item: `electromagnetism-geometry` · [`https://robocn.dev/r/electromagnetism-geometry.json`](https://robocn.dev/r/electromagnetism-geometry.json)

## Notes

- The phase and resolver relationships are ideal calculations. The library does not solve Maxwell's equations, torque, force, heating or a complete electrical circuit.

## Usage

```tsx
import { coilWinding, threePhaseField, resolverSignals } from "@/lib/robocn/electromagnetism"

const winding = coilWinding({ turns: 12, length: 40, radius: 8 })
const field = threePhaseField(0.25, 4)
const channels = resolverSignals(37)
```

## API

| name | type | default | description |
| --- | --- | --- | --- |
| `coilWinding` | `(options: CoilWindingOptions) => Vec3[]` | — | Samples a finite helix along x, y or z while keeping its requested length and radius fixed. |
| `threePhaseField` | `(phase: number, poles?: number) => ThreePhaseField` | — | Sums three sinusoidal windings 120 electrical degrees apart and reports the resultant mechanical angle and magnitude. |
| `resolverSignals` | `(angle: number, excitation?: number) => ResolverSignals` | — | Returns ideal excitation-scaled sine and cosine secondary channels for a shaft angle in degrees. |

## Source

- `src/lib/robocn/electromagnetism.ts`
