| MESH toolbox 0.1 Matlab/Octave mesh utils

- Main Page
- Related Pages
- Modules
- Files

- File List
- File Members

All Files Functions Groups Pages
PlotBoundsEdgeNumber.m
Go to the documentation of this file.
1 function PlotBoundsEdgeNumber(varargin)
2 % function PlotBoundsEdgeNumber(varargin)
3 % Write mesh boundaries edges numbers
4 %
5 % parameters:
6 % Th : mesh structure
7 % RGBTextColors : set boundaries edges numbers colors
8 % RGBEdgeColors : set boundaries box edges colors
9 % BackgroundColor : set boundaries edges numbers background box colors
10 % FontSize : set boundaries edges numbers font size
11 % FontWeight : set boundaries edges numbers font weight to 'normal', 'bold','light' or 'demi'
12 % EdgeColor : set boundaries edges numbers box edge color
13 % LineStyle : set line style to 'none', '-','--','.' or '-.'
14 % LineWidth : set line width
15 %
16 % Example:
17 % - % @verbatim
18 % PlotMesh(Th,'Color',[0 0 0]);
19 % RGBcolors=PlotBounds(Th,'LineWidth',2);
20 % PlotBoundsEdgeNumber(Th,'RGBEdgeColors',RGBcolors,'Color',[0 0 0],'LineStyle','-','LineWidth',0.5);@endverbatim
21 % \image html images/PlotBoundsEdgeNumber1.png "figure : PlotBoundsEdgeNumber(Th,...);"
22 % - % @verbatim
23 % PlotMesh(Th,'Color',[0 0 0]);
24 % RGBcolors=PlotBounds(Th,'LineWidth',2);
25 % PlotBoundsEdgeNumber(Th,'RGBEdgeColors',RGBcolors,'Color',[0 0 0],'LineStyle','-','LineWidth',0.5);@endverbatim
26 % \image html images/PlotBoundsEdgeNumber2.png "figure : PlotBoundsEdgeNumber(Th,...);"
27 p = inputParser;
28 p.addRequired('Th', @isstruct);
29 %
30 p.addParamValue('RGBTextColors', [], @isnumeric );
31 p.addParamValue('RGBEdgeColors', [], @isnumeric );
32 p.addParamValue('BackgroundColor', [1 1 1] , @isnumeric );
33 p.addParamValue('FontSize', 10, @isnumeric );
34 p.addParamValue('FontWeight', 'normal', @isstr );
35 p.addParamValue('Color', [0 0 0] , @isnumeric );
36 p.addParamValue('EdgeColor', [0 0 0] , @isnumeric );
37 p.addParamValue('LineWidth', 0.5 , @isnumeric );
38 p.addParamValue('LineStyle', 'none' , @isstr );
39
40 p.parse(varargin{:});
41
42 Th=p.Results.Th;
43
44 LB=unique(Th.bel);
45 amax=length(LB);
46
47 t=0:1/(amax-1):1;
48 if (isempty(p.Results.RGBTextColors))
49 RGBTextColors=ones(amax,1)*p.Results.Color;
50 else
51 RGBTextColors=p.Results.RGBTextColors;
52 end
53 if (isempty(p.Results.RGBEdgeColors))
54 RGBEdgeColors=ones(amax,1)*p.Results.EdgeColor;
55 else
56 RGBEdgeColors=p.Results.RGBEdgeColors;
57 end
58
59
60 PrevHold=SetHoldOn(true);
61 for i=1:amax
62 I=find(Th.bel == LB(i));
63 qa=(Th.q(:,Th.be(1,I))+Th.q(:,Th.be(2,I)))/2;
64 text(qa(1,:),qa(2,:),num2str(I'),'BackgroundColor',p.Results.BackgroundColor, ...
65 'Color',RGBTextColors(i,:), ...
66 'FontSize',p.Results.FontSize, ...
67 'LineWidth',p.Results.LineWidth, ...
68 'LineStyle',p.Results.LineStyle, ...
69 'EdgeColor',RGBEdgeColors(i,:), ...
70 'FontWeight',p.Results.FontWeight, ...
71 'HorizontalAlignment','center');
72 % for k=I
73 % qa=(Th.q(:,Th.be(1,k))+Th.q(:,Th.be(2,k)))/2;
74 % text(qa(1),qa(2),num2str(k),'BackgroundColor',p.Results.BackgroundColor, ...
75 % 'Color',RGBTextColors(i,:), ...
76 % 'FontSize',p.Results.FontSize, ...
77 % 'LineWidth',p.Results.LineWidth, ...
78 % 'LineStyle',p.Results.LineStyle, ...
79 % 'EdgeColor',RGBEdgeColors(i,:), ...
80 % 'HorizontalAlignment','center');
81 % end
82 end
83 RestoreHold(PrevHold)
84
85