Skip to content

Commit

Permalink
Added basic cone meshing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kevin-Mattheus-Moerman committed Jul 10, 2023
1 parent fbe3705 commit ea0cfd9
Show file tree
Hide file tree
Showing 5 changed files with 413 additions and 0 deletions.
74 changes: 74 additions & 0 deletions docs/HELP_coneTriMesh.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
%% subtri
% Below is a demonstration of the features of the |subtri| function

%% Syntax
% |[F,V]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin);

%% Description
% The |coneTriMesh| function creates a triangulated mesh for a cone with a
% base radius coneRadius and a height coneHeight. The desired node spacing
% is set by pointSpacing. The parameter nTopMin sets the number of repeated
% "pie-segments" used to build the cone, and hence also sets the minimum
% number of points the tip node is connected to.

%% Examples

clear; close all; clc;

%%

coneRadius=2;
coneHeight=4;
pointSpacing=0.25;
nTopMin=6;
closeBaseOpt=1;

[F,V,C]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin,closeBaseOpt);

%%

actualMeanPointSpacing = mean(patchEdgeLengths(F,V))


%%
cFigure; hold on;
title('A triangulated cone')
hp=gpatch(F,V,C,'w',1,1);
% patchNormPlot(F,V);
% gedge(patchBoundary(F),V,'r',5)
axisGeom; camlight headlight;
colormap gjet; icolorbar;
gdrawnow;

%%
%
% <<gibbVerySmall.gif>>
%
% _*GIBBON*_
% <www.gibboncode.org>
%
% _Kevin Mattheus Moerman_, <gibbon.toolbox@gmail.com>

%%
% _*GIBBON footer text*_
%
% License: <https://github.com/gibbonCode/GIBBON/blob/master/LICENSE>
%
% GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for
% image segmentation, image-based modeling, meshing, and finite element
% analysis.
%
% Copyright (C) 2006-2023 Kevin Mattheus Moerman and the GIBBON contributors
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
170 changes: 170 additions & 0 deletions docs/html/HELP_coneTriMesh.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@

<!DOCTYPE html
PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--
This HTML was auto-generated from MATLAB code.
To make changes, update the MATLAB code and republish this document.
--><title>subtri</title><meta name="generator" content="MATLAB 9.14"><link rel="schema.DC" href="http://purl.org/dc/elements/1.1/"><meta name="DC.date" content="2023-07-10"><meta name="DC.source" content="HELP_coneTriMesh.m"><style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}

html { min-height:100%; margin-bottom:1px; }
html body { height:100%; margin:0px; font-family:Arial, Helvetica, sans-serif; font-size:10px; color:#000; line-height:140%; background:#fff none; overflow-y:scroll; }
html body td { vertical-align:top; text-align:left; }

h1 { padding:0px; margin:0px 0px 25px; font-family:Arial, Helvetica, sans-serif; font-size:1.5em; color:#d55000; line-height:100%; font-weight:normal; }
h2 { padding:0px; margin:0px 0px 8px; font-family:Arial, Helvetica, sans-serif; font-size:1.2em; color:#000; font-weight:bold; line-height:140%; border-bottom:1px solid #d6d4d4; display:block; }
h3 { padding:0px; margin:0px 0px 5px; font-family:Arial, Helvetica, sans-serif; font-size:1.1em; color:#000; font-weight:bold; line-height:140%; }

a { color:#005fce; text-decoration:none; }
a:hover { color:#005fce; text-decoration:underline; }
a:visited { color:#004aa0; text-decoration:none; }

p { padding:0px; margin:0px 0px 20px; }
img { padding:0px; margin:0px 0px 20px; border:none; }
p img, pre img, tt img, li img, h1 img, h2 img { margin-bottom:0px; }

ul { padding:0px; margin:0px 0px 20px 23px; list-style:square; }
ul li { padding:0px; margin:0px 0px 7px 0px; }
ul li ul { padding:5px 0px 0px; margin:0px 0px 7px 23px; }
ul li ol li { list-style:decimal; }
ol { padding:0px; margin:0px 0px 20px 0px; list-style:decimal; }
ol li { padding:0px; margin:0px 0px 7px 23px; list-style-type:decimal; }
ol li ol { padding:5px 0px 0px; margin:0px 0px 7px 0px; }
ol li ol li { list-style-type:lower-alpha; }
ol li ul { padding-top:7px; }
ol li ul li { list-style:square; }

.content { font-size:1.2em; line-height:140%; padding: 20px; }

pre, code { font-size:12px; }
tt { font-size: 1.2em; }
pre { margin:0px 0px 20px; }
pre.codeinput { padding:10px; border:1px solid #d3d3d3; background:#f7f7f7; }
pre.codeoutput { padding:10px 11px; margin:0px 0px 20px; color:#4c4c4c; }
pre.error { color:red; }

@media print { pre.codeinput, pre.codeoutput { word-wrap:break-word; width:100%; } }

span.keyword { color:#0000FF }
span.comment { color:#228B22 }
span.string { color:#A020F0 }
span.untermstring { color:#B20000 }
span.syscmd { color:#B28C00 }
span.typesection { color:#A0522D }

.footer { width:auto; padding:10px 0px; margin:25px 0px 0px; border-top:1px dotted #878787; font-size:0.8em; line-height:140%; font-style:italic; color:#878787; text-align:left; float:none; }
.footer p { margin:0px; }
.footer a { color:#878787; }
.footer a:hover { color:#878787; text-decoration:underline; }
.footer a:visited { color:#878787; }

table th { padding:7px 5px; text-align:left; vertical-align:middle; border: 1px solid #d6d4d4; font-weight:bold; }
table td { padding:7px 5px; text-align:left; vertical-align:top; border:1px solid #d6d4d4; }





</style></head><body><div class="content"><h1>subtri</h1><!--introduction--><p>Below is a demonstration of the features of the <tt>subtri</tt> function</p><!--/introduction--><h2>Contents</h2><div><ul><li><a href="#1">Syntax</a></li><li><a href="#2">Description</a></li><li><a href="#3">Examples</a></li></ul></div><h2 id="1">Syntax</h2><p>|[F,V]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin);</p><h2 id="2">Description</h2><p>The <tt>coneTriMesh</tt> function creates a triangulated mesh for a cone with a base radius coneRadius and a height coneHeight. The desired node spacing is set by pointSpacing. The parameter nTopMin sets the number of repeated "pie-segments" used to build the cone, and hence also sets the minimum number of points the tip node is connected to.</p><h2 id="3">Examples</h2><pre class="codeinput">clear; close <span class="string">all</span>; clc;
</pre><pre class="codeinput">coneRadius=2;
coneHeight=4;
pointSpacing=0.25;
nTopMin=6;
closeBaseOpt=1;

[F,V,C]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin,closeBaseOpt);
</pre><pre class="codeinput">actualMeanPointSpacing = mean(patchEdgeLengths(F,V))
</pre><pre class="codeoutput">
actualMeanPointSpacing =

0.2491

</pre><pre class="codeinput">cFigure; hold <span class="string">on</span>;
title(<span class="string">'A triangulated cone'</span>)
hp=gpatch(F,V,C,<span class="string">'w'</span>,1,1);
<span class="comment">% patchNormPlot(F,V);</span>
<span class="comment">% gedge(patchBoundary(F),V,'r',5)</span>
axisGeom; camlight <span class="string">headlight</span>;
colormap <span class="string">gjet</span>; icolorbar;
gdrawnow;
</pre><img width="100%" height="auto" vspace="5" hspace="5" src="HELP_coneTriMesh_01.jpg" alt=""> <p><img vspace="5" hspace="5" src="gibbVerySmall.gif" alt=""> </p><p><i><b>GIBBON</b></i> <a href="www.gibboncode.org">www.gibboncode.org</a></p><p><i>Kevin Mattheus Moerman</i>, <a href="gibbon.toolbox@gmail.com">gibbon.toolbox@gmail.com</a></p><p><i><b>GIBBON footer text</b></i></p><p>License: <a href="https://github.com/gibbonCode/GIBBON/blob/master/LICENSE">https://github.com/gibbonCode/GIBBON/blob/master/LICENSE</a></p><p>GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for image segmentation, image-based modeling, meshing, and finite element analysis.</p><p>Copyright (C) 2006-2023 Kevin Mattheus Moerman and the GIBBON contributors</p><p>This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p><p>This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p><p>You should have received a copy of the GNU General Public License along with this program. If not, see <a href="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</a>.</p><p class="footer"><br><a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2023a</a><br></p></div><!--
##### SOURCE BEGIN #####
%% subtri
% Below is a demonstration of the features of the |subtri| function
%% Syntax
% |[F,V]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin);
%% Description
% The |coneTriMesh| function creates a triangulated mesh for a cone with a
% base radius coneRadius and a height coneHeight. The desired node spacing
% is set by pointSpacing. The parameter nTopMin sets the number of repeated
% "pie-segments" used to build the cone, and hence also sets the minimum
% number of points the tip node is connected to.
%% Examples
clear; close all; clc;
%%
coneRadius=2;
coneHeight=4;
pointSpacing=0.25;
nTopMin=6;
closeBaseOpt=1;
[F,V,C]=coneTriMesh(coneRadius,coneHeight,pointSpacing,nTopMin,closeBaseOpt);
%%
actualMeanPointSpacing = mean(patchEdgeLengths(F,V))
%%
cFigure; hold on;
title('A triangulated cone')
hp=gpatch(F,V,C,'w',1,1);
% patchNormPlot(F,V);
% gedge(patchBoundary(F),V,'r',5)
axisGeom; camlight headlight;
colormap gjet; icolorbar;
gdrawnow;
%%
%
% <<gibbVerySmall.gif>>
%
% _*GIBBON*_
% <www.gibboncode.org>
%
% _Kevin Mattheus Moerman_, <gibbon.toolbox@gmail.com>
%%
% _*GIBBON footer text*_
%
% License: <https://github.com/gibbonCode/GIBBON/blob/master/LICENSE>
%
% GIBBON: The Geometry and Image-based Bioengineering add-On. A toolbox for
% image segmentation, image-based modeling, meshing, and finite element
% analysis.
%
% Copyright (C) 2006-2023 Kevin Mattheus Moerman and the GIBBON contributors
%
% This program is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program. If not, see <http://www.gnu.org/licenses/>.
##### SOURCE END #####
--></body></html>
Binary file added docs/html/HELP_coneTriMesh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/html/HELP_coneTriMesh_01.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit ea0cfd9

Please sign in to comment.