arim.geometry#
Utilities for geometric operations: translation, rotation, change of basis, etc.
Points#
A Points
object contains the Cartesian coordinates of one or more
points. The points can be stored as a ndarray.
However ray tracing and many parts of arim expects as input an 1d array of
points.
Function points_1d_wall_z()
provides an easy way to create a flat line.
For more complicated lines and surfaces, create the points manually.
Oriented points#
An oriented point is defined as a point and three orthonormal vectors. It is actually a full coordinate system.
For probe and surfaces (front, back wall), the two first vectors must be tangential to the surface and the third vector must be normal to it.
In the block in immersion model, the probe normals must be towards the examination object. The front and back walls’ normals must be towards the probe.
For scatterers and grid points, there is no tangent or normal vectors.
Only the third vector of the basis is used. It defines the reference
orientation of the scatterer. To use a rotated scatterer, one can therefore
change the orientation of this third vector; however, the recommend technique
is to argument scat_angle
in arim.model.model_amplitudes_factory()
.
Basis#
A basis (i_hat, j_hat, k_hat) is stored as a matrix:
(i1 i2 i3)
basis = (j1 j2 j3)
(k1 k2 k3)
where (i1, i2, i3) is the coordinate of the basis vector i_hat in the global coordinate system.
Remark: this storage is consistent with the Points
layout: basis[0, :] = (i1, i2, i3)
. A basis can be seen as three
points (i_hat, j_hat, k_hat).
Warning: basis in CoordinateSystem
objects are stored in a different convention:
they are transposed i.e. basis[:, 0] = (i1, i2, i3)
.
Spherical coordinate system#
Physics and ISO convention (r, theta, phi):
r is the radial distance,
theta is the polar angle (inclination) in the rangle in the range [0, pi],
phi is the azimuthal angle in the range [-pi, pi].
Cf. Wikipedia article on Spherical coordinate system
- arim.geometry.GCS#
Global coordinate system (
CoordinateSystem
).i = (1, 0, 0)
,j = (0, 1, 0)
,k = (0, 0, 1)
,O = (0, 0, 0)
.
|
A point and a direct 3D affine basis. |
|
Regularly spaced 3d grid |
|
|
|
Set of points in a 3D space. |
|
Spherical coordinates as usually defined in physics |
|
Are the points aligned? Returns a boolean. |
|
Return True if and only if the two sets of points have the same shape and coordinates close to the given precision. |
|
Returns a Point object: the input itself if it is a point, or wrap the object as a Point otherwise. |
|
Combines multiple walls (oriented points) into one as a simple concatenation. |
|
Returns the default orientations for unoriented points. |
|
Returns OrientedPoints from Points assuming the default orientations. |
|
Returns a direct isometry that transform A to A' and B to B'. |
|
Returns the isometry that send the direct orthogonal base (A, i_hat, j_hat, i_hat^j_hat) to (B, u_hat, v_hat, u_hat^v_hat) |
|
Compute the Euclidean distances of flight between two sets of points. |
|
Convert the coordinates of points expressed in the global coordinate system to coordinates expressed in the basis/bases given as parameter. |
|
|
|
Returns True if the basis is orthonormal and direct: :param basis: |
|
Returns a list of OrientedPoints with length m which are uniquely named. |
|
Euclidean norm of a ndarray |
|
Euclidean norm of a ndarray |
|
Returns a set of regularly spaced points between start and end. |
|
Returns a set of regularly spaced points between (xmin, y, z) and (xmax, y, z). |
|
Probe object to OrientedPoints (points and orientations). |
|
Returns points in the rectangular box. |
|
Rotate these points given a rotation matrix and the centre. |
|
|
|
|
|
Returns the rotation matrix (as a ndarray) from the yaw, pitch and roll in radians. |
|
|
|
Compute the spherical coordinates (r, θ, φ) of points. |
|
azimuthal angle |
|
radial distance |
|
polar angle |
|
Convert the coordinates of points expressed in the basis/bases given as parameter to coordinates expressed in the global coordinate system. |