three dimensional vectors, a container over (…, 3) coordinates carrying antipodal, isNormalized, the reference frame and the display style; a vector in a crystal frame is a crystal direction with Miller indices
Syntax
v = vector3d(x, y, z)
From the Cartesian coordinates.
v = vector3d(xyz)
Coordinates of shape (…, 3) or (3, N).
v = vector3d(x, y, z, antipodal=True)
Axes, v and -v the same.
m = vector3d(xyz, frame=cs)
A crystal direction from its Euclidean coordinates.
v = vector3d.byPolar(theta, rho)
From the polar angles.
v = vector3d.X
The axes of the frame, also Y and Z.
m = Miller(1, 1, 1, cs)
A lattice plane normal by its indices hkl.
m = Miller(1, 0, -1, 0, csHex)
Four indices hkil of a hexagonal lattice.
m = Miller(1, 1, 0, cs, 'uvw')
A lattice direction, ‘UVTW’ with four indices.
m = Miller('{111}', cs)
(hkl) one plane, {hkl} the family, [uvw] and
m = Miller(v, cs)
A vector restated in the crystal frame.
Description
A crystal direction is a vector3d whose frame is a crystal frame: it has the Miller indices m.hkl and m.uvw, the four index forms m.hkil and m.UVTW of a trigonal or hexagonal lattice, a d-spacing, and where the frame carries a point group it stands for its symmetrically equivalent set, which dot, angle, mean and unique take into account. It is stored in Euclidean coordinates; MATLAB’s class Miller is a vector3d here, built by the function Miller from its indices.
Input
x, y, z |
arrays of the Cartesian coordinates, broadcast against each other |
xyz |
array of shape (…, 3) or (3, N), a vector3d, or a rank one tensor |
cs |
crystalFrame, also given positionally to vector3d |
Keywords
| keyword | default | description |
|---|---|---|
antipodal |
the vectors are axes: v and -v are the same | |
isNormalized |
the coordinates are known to be of length one | |
frame |
the referenceFrame the coordinates are given in, a crystal frame making the vectors crystal directions; also given as a positional argument | |
dispStyle |
the indices the display shows, ‘hkl’, ‘hkil’, ‘uvw’, ‘UVTW’ or ‘xyz’ | |
dtype |
the floating point type of the coordinates |
Output
v |
vector3d |
m |
vector3d, a crystal direction |
Properties
xyz |
Cartesian coordinates as a numeric array of shape v.shape + (3,) |
frame |
referenceFrame of the coordinates, or None for frame-free data |
CS |
crystalFrame for Miller directions, otherwise None |
antipodal |
whether opposite directions represent the same axis |
isNormalized |
whether the coordinates are known to have unit length |
dispStyle |
display convention: ‘xyz’, ‘hkl’, ‘hkil’, ‘uvw’ or ‘UVTW’ |
hkl |
three reciprocal-lattice indices for plane normals in a crystal frame |
uvw |
three direct-lattice indices for lattice directions in a crystal frame |
shape |
array shape excluding the trailing Cartesian coordinate axis |
Example
Store three vectors in one array, normalize them, and select the second vector with Python indexing. Geometric angles are returned in radians.
import numpy as np
from mtex import vector3d, degree
v = vector3d([[3, 0, 0], [0, 4, 0], [0, 0, 5]])
u = v.normalize()
print('Lengths:', v.norm())
print('Second unit vector:', u[1].data)
print('First two vectors, degrees:', float(u[0].angle(u[1]) / degree))
print('Cross product:', np.round(u[0].cross(u[1]).data, 3))
Lengths: [3. 4. 5.]
Second unit vector: [0. 1. 0.]
First two vectors, degrees: 90.0
Cross product: [0. 0. 1.]
See also
Miller, vector3d.byPolar, crystalFrame, VectorDefinition, CrystalDirections
Members
| angle | the angle between two vectors |
| angle_outer | the angle between two vectors |
| arrow3d | solid arrows in space, from the origin, or from anchor, to the tips v |
| byPolar | the vectors of polar angle theta to z and azimuth rho from x towards y, unit vectors |
| byXYZ | construct a list of vectors from rows of Cartesian coordinates |
| calcCluster | the clusters of directions or orientations: one cluster id per element, counted from zero, and the centre of every cluster |
| calcDensity | estimate a smooth density of directions or axes on the sphere |
| calcDensity | estimate a smooth density of directions or axes on the sphere |
| calcKernel | the kernel a density estimate of orientations or directions should use, a de la Vallee Poussin kernel of the halfwidth chosen from the sample |
| calcQuadratureWeights | weights that integrate a function from samples at the directions, summing to one |
| cat | the list of the operands, MATLAB’s [a, b] |
| cat | the list of the operands, MATLAB’s [a, b] |
| char | the Miller indices of a crystal direction in brackets, as text |
| circle | a circle on a spherical plot: the small circle of the opening angle about a direction, the great circle by default |
| contour | contour(sF), contour(v), contour(v, data): contour lines |
| contourf | contourf(sF), contourf(v), contourf(v, data): filled contours |
| convention | the convention the vector is written in, its display style: ‘xyz’, ‘hkl’, ‘hkil’, ‘uvw’ or ‘UVTW’ |
| coordinates | the indices in the convention the vector is written in |
| cross | the cross product of two plane normals is a lattice direction and the one of two directions a plane normal, so the indices switch sides |
| cross | the cross product of two plane normals is a lattice direction and the one of two directions a plane normal, so the indices switch sides |
| CS | the crystal frame of a crystal direction, None for any other vector |
| det | the triple product, vector3d/det det(a, b, c) the triple product |
| discrepancy | the discrepancy between two densities and/or weighted point sets on the sphere (S2Fun, vector3d) or on SO(3) (SO3Fun, rotation, orientation), in either order |
| dot | the inner product of two vectors, pointwise |
| dot | the inner product of two vectors, pointwise |
| dot_outer | the inner product of two vectors, pointwise |
| dot_outer | the inner product of two vectors, pointwise |
| double | the coordinates of the images of an embedding in their orthonormal basis, one row per orientation, e.double() |
| dspacing | return the spacing of the lattice planes represented by each Miller normal |
| dyad | the dyadic product of tensors or vectors, their outer product |
| eig | return the eigenvalues and principal axes of the vector moment matrix |
| eq | isclose(v, w), isclose(v, w, antipodal=True, tol=): pointing the same way up to the group of a crystal frame within the tolerance tol of the cosine, and up to sign when antipodal (MATLAB’s eq) |
| exp | the rotation vector to its rotation: at the identity, or at a reference as a tangent vector |
| exp | the rotation vector to its rotation: at the identity, or at a reference as a tangent vector |
| export | write vector coordinates to a text table |
| find | the closest points of this list to others, the k closest, or all within a radius |
| frame | the reference frame this vector is expressed in, None for frame-free data |
| h | the Miller index h of a plane normal |
| histogram | histogram(grains), histogram(grains, prop, bins): the area weighted distribution of a grain property as one histogram per indexed phase, drawn over each other, or with grouped=True side by side (MATLAB’s hist) |
| hkil | the four Miller-Bravais indices of a plane normal, i = -(h + k) |
| hkl | the Miller indices of a plane normal, the coordinates in the dual basis of the crystal frame |
| horzcat | the list of the operands, MATLAB’s [a, b] |
| how2plot | the plotting convention of the vector, that of its frame or the default |
| i | the third Miller-Bravais index i = -(h + k) of a plane normal |
| interp | interpolate values sampled at directions on the sphere |
| isCrystalDirection | whether the vector is given in a crystal frame |
| isnan | whether a vector has a NaN coordinate |
| k | the Miller index k of a plane normal |
| l | the Miller index l of a plane normal |
| lattice | the lattice type of the crystal frame, latticeType.none for a vector in no crystal frame |
| lineIntersect | where the segments from a to b cross the planes <n, v> = d, NaN where they do not, MATLAB’s lineIntersect |
| load | read Cartesian directions from a text file |
| mean | the mean direction of a list of vectors, of axes, or of crystal directions |
| mean | the mean direction of a list of vectors, of axes, or of crystal directions |
| Miller | three dimensional vectors, a container over (…, 3) coordinates carrying antipodal, isNormalized, the reference frame and the display style |
| minus | |
| mrdivide | |
| mtimes | |
| multiplicity | the number of distinct directions symmetrically equivalent to each vector, of axes under antipodal |
| nan | construct vectors with missing Cartesian coordinates |
| ne | Return self!=value |
| norm | the length of the vectors |
| normalize | the vectors scaled to unit length |
| orth | choose a unit vector perpendicular to each input vector |
| orthProj | project each vector onto the plane perpendicular to a normal |
| pcolor | pcolor(sF), pcolor(v), pcolor(v, data): a coloured surface |
| perp | the axis best orthogonal to a list of directions, the smallest principal axis |
| perp | the axis best orthogonal to a list of directions, the smallest principal axis |
| plot3d | plot3d(v), plot3d(v, data), plot3d(sF), plot3d(vF), plot3d(oR), plot3d(ori), plot3d(odf) |
| plot | plot(x, …) draws x as its kind is drawn |
| plus | |
| polar | return polar angle, azimuth and length for every vector |
| project2FundamentalRegion | the directions folded into the fundamental sector of their frame, with antipodal=True into that of the Laue group |
| project2FundamentalRegion | the directions folded into the fundamental sector of their frame, with antipodal=True into that of the Laue group |
| quiver3 | arrows in space: tangent vectors in orientation space, a field on the sphere or SO(3), or arrows at positions |
| quiver | arrows: tangent vectors at directions, a vector or axis field on the sphere, arrows at orientations in the sections of the current figure, or directions on a map or a volume |
| rand | uniformly distributed unit vectors or axes, on the sphere or in a sphericalRegion given last |
| rdivide | |
| refine | the directions with a new one between every three neighbours: the centroids of the Delaunay triangles of the points on the sphere, none below the lowest point, so a cap stays a cap |
| resolution | the mean distance between the points (MATLAB vector3d.resolution): the whole circle for up to four points, the square root of the median Voronoi cell area up to fifty thousand, the equal area estimate beyond |
| rho | azimuth from +x towards +y in radians, in [0, 2*pi), with one value per vector |
| rotate | the vectors turned by a rotation, rot * v |
| rotate | the vectors turned by a rotation, rot * v |
| round | the direction with its indices, or its coordinates, rounded to small integers |
| round | the direction with its indices, or its coordinates, rounded to small integers |
| scatter3d | directions as markers on the sphere in space |
| scatter | directions or crystal directions drawn as markers on a spherical plot, coloured by data or labelled |
| scatter | directions or crystal directions drawn as markers on a spherical plot, coloured by data or labelled |
| smooth | pcolor(sF), pcolor(v), pcolor(v, data): a coloured surface |
| smooth | pcolor(sF), pcolor(v), pcolor(v, data): a coloured surface |
| subsref | |
| sum | the sum of the vectors, over all axes or the given ones |
| surf | a function on the sphere as a surface in space, the sphere pushed out to |f| and coloured by f |
| surf | a function on the sphere as a surface in space, the sphere pushed out to |f| and coloured by f |
| symmetrise | the symmetrically equivalent directions, numSym x shape, or the distinct ones of one direction with unique=True |
| symmetrise | the symmetrically equivalent directions, numSym x shape, or the distinct ones of one direction with unique=True |
| T | the Miller-Bravais index T = -(U + V) of a lattice direction |
| text | text at directions on the sphere, at the measurements or grains of a map, or at a point of the current axes |
| text | text at directions on the sphere, at the measurements or grains of a map, or at a point of the current axes |
| theta | polar angle from +z in radians, in [0, pi], with one value per vector |
| times | |
| transformReferenceFrame | the same direction written in another frame |
| u | the index u of a lattice direction |
| U | the Miller-Bravais index U of a lattice direction |
| uminus | |
| unique | the disjoint list of vectors, equal ones within a tolerance taken once |
| unique | the disjoint list of vectors, equal ones within a tolerance taken once |
| UVTW | the Weber indices: U = 2u - v, V = 2v - u, T = -(u + v), W = 3w |
| uvw | the indices of a lattice direction, the coordinates in the basis of the crystal frame |
| v | the index v of a lattice direction |
| V | the Miller-Bravais index V of a lattice direction |
| vector3d | three dimensional vectors, a container over (…, 3) coordinates carrying antipodal, isNormalized, the reference frame and the display style |
| vertcat | the list of the operands, MATLAB’s [a, b] |
| w | the index w of a lattice direction |
| W | the Miller-Bravais index W of a lattice direction |
| x | Cartesian x coordinate of each vector |
| X | the unit vector along x, minted anew on every access |
| xyz | Cartesian coordinates as a numeric array of shape v.shape + (3,) |
| y | Cartesian y coordinate of each vector |
| Y | the unit vector along y, minted anew on every access |
| z | Cartesian z coordinate of each vector |
| Z | the unit vector along z, minted anew on every access |
| zeros | the zero vectors of a shape |
Used on
CrystalOperations, QuasiCrystals, MTEXvsBungeConvention, OrientationFibre, EBSD3Analysis, EBSD3Plotting, Grains3D, Grains3DBoundaries, Grains3DOperations, NeperInterface, EBSDGrid, EBSDInter
MATLAB’s vector3d_index
source
Citing this page.
This page is part of the documentation of
MTEX, a free and open
source MATLAB toolbox for analyzing and modeling crystallographic textures.
It was written by The MTEX Developers and is published at
https://mtex-toolbox.github.io/vector3d_index_py.html.
If you use MTEX, or reuse text or figures from this page, in your research,
please cite
F. Bachmann, R. Hielscher, H. Schaeben: Texture Analysis with MTEX - Free and Open Source Software Toolbox, Solid State Phenomena 160 (2010), 63-68. 10.4028/www.scientific.net/SSP.160.63
BibTeX
@article{bachmann2010mtex,
author = {F. Bachmann and R. Hielscher and H. Schaeben},
title = {Texture Analysis with MTEX - Free and Open Source Software Toolbox},
journal = {Solid State Phenomena},
volume = {160},
pages = {63-68},
year = {2010},
doi = {10.4028/www.scientific.net/SSP.160.63},
url = {https://doi.org/10.4028/www.scientific.net/SSP.160.63}
}
Other papers describing specific MTEX methods are listed under Publications — please cite the one that best fits your application. The MTEX source code is licensed under the GNU General Public License v2.0; the text and figures of this documentation are licensed under CC BY 4.0, which permits reuse — including by automated systems — provided The MTEX Developers and this page are credited.