Open Matlab File in the Editor MTEX

Specimen Directions (The Class vector3d)

This section describes the class vector3d and gives an overview how to deal with specimen directions in MTEX.

On this page ...
Class Description
Defining Specimen Directions
Calculating with Specimen Directions
Plotting three dimensionl vectors
Complete Function list

Class Description

Specimen directions are three dimensional vectors in the Euclidean space represented by coordinates with respect to a outer specimen coordinate system x, y, z. Im MTEX Specimen directions are represented by variables of the class vector3d.

Defining Specimen Directions

The standard way to define a specimen directions is by its coordinates.

v = vector3d(1,1,0);

This gives a single vector with coordinates (1,1,0) with respect to the x, y , z coordinate system. A second way to define a specimen directions is by its spherical coordinates, i.e. by its polar angle and its azimuth angle. This is done by the option polar.

polar_angle = 60*degree;
azimuth_angle = 45*degree;
v = vector3d('polar',polar_angle,azimuth_angle);

Finally one can also define a vector as a linear combination of the predefined vectors xvector, yvector, and zvector

v = xvector + 2*yvector;

Calculating with Specimen Directions

As we have seen in the last example. One can calculate with specimen directions as with ordinary number. Moreover, all basic vector operation as "+", "-", "*", inner product, cross product are implemented.

u = dot(v,xvector) * yvector + 2 * cross(v,zvector);

Using the brackets v = [v1,v2] two specimen directions can be concatened. Now each single vector is accesable via v(1) and v(2).

w = [v,u];
w(1)
w(2)
 
ans = vector3d  
 size: 1 x 1
  x y z
  1 2 0
 
ans = vector3d  
 size: 1 x 1
  x  y  z
  4 -1  0

When calculating with concatenated specimen directions all operations are performed componentwise for each specimen direction.

w = w + v;

Beside the standard linear algebra operations there are also the following functions available in MTEX.

v2) % angle between two specimen  directions
dot(v1,v2)   % inner product
cross(v1,v2) % cross product
norm(v)      % length of the specimen directions
sum(v)       % sum over all specimen directions in v
mean(v)      % mean over all specimen directions in v
polar(v)     % conversion to spherical coordinates
% A simple example for apply the norm function is to normalize a set of
% specimen directions

w = w ./ norm(w)
 
w = vector3d  
 size: 1 x 2
         x        y        z
  0.447214 0.894427        0
  0.980581 0.196116        0

Plotting three dimensionl vectors

The plot function allows you to visualize an arbitrary number of specimen directions in a spherical projection

plot([zvector,xvector+yvector+zvector],'labeled')

Complete Function list

SchmidTensorcomputes the Schmidt tensor
TSPtraveling salesman problem on the 2 dimensional unitsphere
abslength of vector
anglebetween two vectors
angle_outerangle between two vectors
arrow3dplot three dimensional arrows
calcDelaunaycompute the Delaynay triangulation for a spherical grid
calcQuadratureWeightscompute the area of the Voronoi decomposition
calcVoronoicompute the area of the Voronoi decomposition
calcVoronoiAreacompute the area of the Voronoi decomposition
charconvert to char
circleannotated a circle
contourspherical contour plot
contourfspherical filled contour plot
crosspointwise cross product of two vector3d
cross_outerpointwise cross product of two vector3d
ctransposetranspose vector
displaystandard output
dotpointwise inner product
dot_outerouter dot product
doubleconverts vector3d to double
endoverloaded end function
eq? v1 == v2
findreturn index of all points in a epsilon neighborhood of a vector
horzcatoverloads [v1,v2,v3..]
interpdirty spherical interpolation including some smoothing
isPerpcheck whether v1 and v2 are orthogonal
isemptyoverloads isempty
kernelDensityEstimationcalculates a density function out of (weighted) unit vectors
lengthoverloads length
meancomputes the mean vector
minusoverload minus
mtimesscalar multiplication
ne? v1 == v2
normvector norm
normalizea vector
orthan arbitrary orthogonal vector
patchPatalaSyntax
pcolorspherical contour plot
perpconmpute an vector best orthogonal to a list of directions
plotthree dimensional vector
plot3dplot spherical data
plotCustomSyntax
pluspoitwise addition
polarcartesian to spherical coordinates
project2FundamentalRegionprojects vectors to the fundamental sector of the inverse pole figure
quiverSyntax
rdividescalar division
refinevectors
repmatoverloads repmat
reshapeoverloads reshape
rotatevector3d by quaternion
scatterSyntax
scatter3dplot spherical data
sizeoverloads size
smoothSyntax
subSetsubindex vector3d
subsasgnoverloads subsasgn
subsrefoverloads subsref
sumof vectors
surfSyntax
symmetrisesymmetrcially equivalent directions and its multiple
textdisplay a text in a spherical plot
text3plot three dimensional arrows
times.* componenwtise multiplication
transposevector
uminusoverloads unitary minus
uniquedisjoint list of vectors
vertcatoverloads [v1,v2,v3..]