# Position

## Position

Location and facing (of the observer, an object, etc).

## Constructor

#### new Position()

Source:
To Do:
• Choose a better name ??

Constructor. Return the position corresponding to the origin with the reference frame.

### Members

#### boost :Isometry

Source:

The isometry component of the position.

#### facing :Matrix4

Source:

The facing as a Matrix4, representing an element of O(3). This is the data that is actually passed to the shader

#### point

Source:

Return the underlying point

#### quaternion

Source:

The facing. We represent it as quaternion, whose action by conjugation on R^3 defines an element of O(3)

### Methods

#### applyIsometry(isom) → {Position}

Source:

Translate the current position by `isom` (left action of the isometry group G on the set of positions).

##### Parameters:
Name Type Description
`isom` Isometry

the isometry to apply

##### Returns:

The current position

Type
Position

#### applyQuaternion(quaternion) → {Position}

Source:

Rotate the facing by `m` (right action of O(3) in the set of positions).

##### Parameters:
Name Type Description
`quaternion` Quaternion

the facing to apply (in the observer frame)

##### Returns:

The current position

Type
Position

#### clone() → {Position}

Source:

Return a new copy of the current position.

##### Returns:

The clone of the current position

Type
Position

#### copy(position) → {Position}

Source:

Set the current position with the given one.

##### Parameters:
Name Type Description
`position` Position

the position to copy

##### Returns:

the current position

Type
Position

#### equals(position) → {boolean}

Source:

Check if the current position and `position ` are the same.

##### Parameters:
Name Type Description
`position` Position
##### Returns:

true if the positions are equal, false otherwise

Type
boolean

#### fakeDiffExpMap(matrix) → {Position}

Source:

Fake version of the differential of the exponential map.

Assume that the current position is the (Id,Id). Take as input a Matrix4 `matrix` seen as an affine isometry of R^3 = T_oX with respect to the reference frame e = (e_1, e_2, e_3) (or more precisely, an isometry of the tangent bundle of T_oX) Update the position with the following properties. Let u = matrix . (0,0,0,1) that is the image of the origin of T_oX by matrix Let v = matrix . (0,0,1,0) that is the image of the vector e_3 by matrix The updated position (g,m) is such that g . origin = exp(u) and d_og m v = d_u exp v Or at least, this is the ideal goal.

We fake the behavior using parallel transport. Apparently the error made if of the order of O(|u|^2). https://mathoverflow.net/questions/126104/difference-between-parallel-transport-and-derivative-of-the-exponential-map Thus for controllers supposed to stay close to the user, it could be enough. (The overlay of the controllers and the seen is only correct at the first order.)

If the current position is not (Id, Id), then everything is made "relative" to the current position.

##### Parameters:
Name Type Description
`matrix` Matrix4

an affine isometry of the tangent space at the origin

Type
Position

#### flow(v) → {Position}

Source:

Flow the current position. `v` is the pull back at the origin by the position of the direction in which we flow The time by which we flow is the norm of `v`.

The procedure goes as follows. Let `e = (e1, e2, e3)` be the reference frame in the tangent space at the origin. Assume that the current position is `(g,m)` The vector `v = (v1, v2, v3)` is given in the observer frame, that is `v = d_og m u`, where `u = u1 . e1 + u2 . e2 + u3 . e3`.

• We first pull back the data at the origin by the inverse of `g`.
• We compute the position `(g',m')` obtained from the initial position `(id, id)` by flowing in the direction `w = m u`. This position send the frame `m e` to `d_o g' . m ' . m . e `
• We move everything back using `g`, so that the new observer frame is `d_o (gg') . m' . m e`.

Hence the new position `(gg', m'm)` is obtained by multiplying `(g,m)` and `(g',m')`

##### Parameters:
Name Type Description
`v` Vector

the direction in the observer frame

##### Returns:

The current position

Type
Position

#### (abstract) flowFromOrigin(v) → {Position}

Source:

Replace the current position, by the one obtained by flow the initial position `(id, id)` in the direction `v` (given in the reference frame).

##### Parameters:
Name Type Description
`v` Vector

the direction in the reference frame

##### Returns:

The current position

Type
Position

#### invert() → {Position}

Source:
Deprecated:
• Not sure this is really needed

Set the current position to its inverse

##### Returns:

The current position

Type
Position

#### multiply(position) → {Position}

Source:

Multiply the current position (g0,m0) on the right by the given position (g,m), i.e. return (g0 * g, m * m0)

##### Parameters:
Name Type Description
`position` Position
##### Returns:

The current position

Type
Position

#### premultiply(position) → {Position}

Source:

Multiply the current position (g0,m0) on the left by the given position (g,m), i.e. return (g * g0, m0 * m)

##### Parameters:
Name Type Description
`position` Position
##### Returns:

The current position

Type
Position

#### reduceError() → {Position}

Source:

Reduce the error of the boost part and the quaternion part.

##### Returns:

The current position

Type
Position

#### reduceErrorBoost() → {Position}

Source:

Reduce the eventual numerical error of the current boost.

##### Returns:

The current position

Type
Position

#### reduceErrorQuaternion() → {Position}

Source:

Make the the quaternion has length one.

##### Returns:

The current position

Type
Position

#### reset() → {Position}

Source:

Reset the position in its default position (boost = identity, quaternion = 1)

##### Returns:

The current position

Type
Position

#### setBoost(isom) → {Position}

Source:

Set the boost part of the position.

##### Parameters:
Name Type Description
`isom` Isometry
##### Returns:

The current position

Type
Position

#### setQuaternion(quaternion) → {Position}

Source:

Set the facing part of the position.

##### Parameters:
Name Type Description
`quaternion` Quaternion
##### Returns:

The current position

Type
Position