# alignScopeToGeometry

### Syntax

• alignScopeToGeometry(upAxis, faceIndex, edgeIndex)
• alignScopeToGeometry(upAxis, faceSelector, edgeIndex)
• alignScopeToGeometry(upAxis, faceIndex, edgeSelector)
• alignScopeToGeometry(upAxis, faceSelector, edgeSelector)

### Parameters

1. upAxisselector{ yUp | zUp }—xUp is not supported.
2. faceIndexfloat0-based index of face which contains the edge. Negative indices are modulo-adjusted, i.e. -1 is the last face.
3. edgeIndexfloat0-based index of edge which will become the new x-axis. Negative indices are modulo-adjusted, i.e. -1 is the last edge. The edge index is relative to the selected face.
4. faceSelectorselector
• world.lowest—Takes the face with lowest y world-coordinates.
• largest—Takes the largest face.
• any—(only in combination with an edgeSelector) Takes the face for which the edge selector has external value.
5. edgeSelector—selector
• world.lowest—Takes the edge with lowest y world-coordinates.
• longest—takes the longest edge.

### Description

The alignScopeToGeometry operation manipulates the scope, the pivot and the geometryattributes in the following way:

1. Select new pivot axis directions that are defined by upAxis selector and the selected face and edge.
2. Calculate the oriented bounding box (OOB) for the geometry along these axes and set pivot.p to the origin of the OOB. The new scope dimensions are set to the OOB.
3. Transform the geometry into this new coordinate system.

The parameters let you choose an edge of a face in the geometry. The new x-axis of the scope will be parallel to this edge, and the up-axis will be the face’s normal.

The geometry is projected to the new scope, i.e. stays at the same place in world coordinates.