length of a boundary segment
Syntax
[x,y] = intersect(gB,xy1,xy2)
[x,y,segLength] = intersect(gB,xy1,xy2)Input
| gb | grainBoundary |
| xy1, xy2 | coordinates of the endpoints of the line |
Output
| x,y | list of intersection points |
Example
mtexdata small
grains = calcGrains(ebsd,'minPixel',3)
grains = smoothBoundary(grains,4)
plot(grains.boundary,'micronbar','off')
% define some line
xy1 = [33500,4500]; % starting point
xy2 = [36000,7500]; % end point
line([xy1(1);xy2(1)],[xy1(2);xy2(2)],'linewidth',1.5,'color','g')
[x,y] = grains.boundary.intersect(xy1,xy2);
hold on
scatter(x,y,'red','linewidth',2)ebsd = EBSD (y↓→x)
Phase Orientations Mineral Color Symmetry Crystal reference frame
0 1197 (32%) notIndexed none
1 1952 (52%) Forsterite LightSkyBlue mmm
2 290 (7.8%) Enstatite DarkSeaGreen mmm
3 282 (7.6%) Diopside Goldenrod 12/m1 X||a*, Y||b, Z||c
Properties: bands, bc, bs, error, mad, oldId
Scan unit : um
X × Y × Z : [33000 → 36000] × [4500 → 7500] × [0 → 0]
Normal vector: (0,0,1)
grains = grain2d (y↓→x)
Phase Grains Pixels Mineral Symmetry Color
0 1 1 notIndexed none
1 15 1943 Forsterite mmm LightSkyBlue
2 3 283 Enstatite mmm DarkSeaGreen
3 6 240 Diopside 12/m1 Goldenrod
boundary segments: 767 (39609 µm)
inner boundary segments: 22 (1101 µm)
triple points: 20
Properties: meanRotation, GOS
grains = grain2d (y↓→x)
Phase Grains Pixels Mineral Symmetry Color
0 1 1 notIndexed none
1 15 1943 Forsterite mmm LightSkyBlue
2 3 283 Enstatite mmm DarkSeaGreen
3 6 240 Diopside 12/m1 Goldenrod
boundary segments: 755 (35590 µm)
inner boundary segments: 20 (955 µm)
triple points: 20
Properties: meanRotation, GOS
find the number of intersection points
sum(~isnan(x))
% mark the intersected boundary segments
plot(grains.boundary(~isnan(x)),'lineColor','b','linewidth',2)
hold offans =
4
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/grainBoundary.intersect.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.