---
title: fitAlignment
summary: Function in @bimworks/viewercommon.
order: 10
languages: [javascript]
sdk-package: JavaScript · @bimworks/viewercommon
---

# fitAlignment

[[page:reference/javascript/api|API catalogue]] · `@bimworks/viewercommon` · Function

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
function fitAlignment
````



## Members

| Member | Kind | Description |
|---|---|---|
| [[page:reference/javascript/bimworks-viewercommon/fitalignment-b3514f16#member-bimworks-viewercommon-fitalignment-ea5c669604a6|fitAlignment]] | Method | The alignment that takes the move points of the pairs onto their onto points, by least squares over all pairs. With fewer pairs than `allow` needs it fits wh… |

## `fitAlignment` {#member-bimworks-viewercommon-fitalignment-ea5c669604a6}

````typescript sdk=js sdk-namespace="@bimworks/viewercommon"
fitAlignment(pairs: Iterable<AlignmentPair, any, any> | null, allow?: AlignmentFitKind, options?: { level?: number | null; scale?: number | null }): AlignmentFit | null
````

The alignment that takes the move points of the pairs onto their onto points, by least squares over all pairs.
With fewer pairs than `allow` needs it fits what the pairs allow (one pair moves only); null without pairs. In
float64, so millimetres survive survey coordinates.

### Parameters

| Name | Type | Description |
|---|---|---|
| `pairs` | `Iterable<AlignmentPair, any, any> \| null` |  |
| `allow` | [[page:reference/javascript/bimworks-viewercommon/alignmentfitkind-91b3e6b9|AlignmentFitKind]] |  |
| `options` | `{ level?: number \| null; scale?: number \| null }` |  |
