Points and related quantities

Many calculations require the concept of a point in the plane, i.e. of a quantity able to hold two real values (the two coordinates). Similarly, often we need to consider linear transformations in the plane, represented as 2×2 matrices.

For efficiency reasons, we use throughout our code StaticArrays. We employ two kinds of static arrays: immutable and mutable. Quantities implemented in terms of immutable static arrays are prefixed by an S (SPoint, SPointMap...); quantities implemented in terms of mutable static arrays are prefixed by an M (MPoint, MPointMap...).

Point

A Point represents a point in the plane, i.e. an element of ${\mathbb R}^2$. It is usually used with static allocation, represented by the type SPoint.

Base.absMethod
abs(p)

Compute $|p|$, the modulus of a point p.

source
Base.abs2Method
abs2(p)

Compute $|p|^2$, the square of the modulus of a point p.

source

PointMap

A PointMap is a linear map in the plane, i.e. a linear function ${\mathbb R}^2 \rightarrow {\mathbb R}^2$. It is represented as a 2×2 matrix.

Base.abs2Method
abs2(M, p)

Compute $p' ⋅ M ⋅ p$, the square of the modulus of a point p with metric M.

source
Base.absMethod
abs(p)

Compute $|p|$, the modulus of a point p.

source

PointDiff

A PointDiff is an affine map in the plane, i.e. a affine function ${\mathbb R}^2 \rightarrow {\mathbb R}^2$: It is equivalent to a linear map composed with a plane translation. It is represented as a 6-vector, holding both the 4 coefficients of the linear map and the 2 coefficients of the translation.

This kind of object is useful, e.g., when dealing with functions that compute both the lens equation and its differential (Jacobian), such as Gravity.deflectionjacobian or Gravity.lensmapdistortion.

ScalarPoint

A ScalarPoint is the combination of a scalar and a 2D point.

This kind of object is useful, e.g., when dealing with functions that compute both the time delay and the lens equation, such as Gravity.timedelaylensmap.