Comments (3)
Kevin,
can you reply with your history from Matlab?
jonathan
from gibbon.
I cannot retrieve the full history it seems but below is a code which is very close to the steps I showed (I'll add more comments soon and will add it then as an intro/demo):
clear; close all; clc;
%% Control parameters
radiusSphere=1;
%% Plot settings
markerSize=50;
lineWidth=2;
faceAlpha=1;
fontSize=35;
%% Define coordinates
V=[0 0 0; 1 0 0; 0 1 0; 1 1 0]; %Vertices
F=[1 2 4 3]; %A quadrilateral face
[Ft,Vt]=quad2tri(F,V); %Convert to triangles
Ct=[1 2]'; %Face color label
%% Visualize
cFigure;
plotV(Vt,'k.','MarkerSize',markerSize); %Vertices
gpatch(Ft,Vt,Ct,'k',faceAlpha,lineWidth);
patchNormPlot(Ft,Vt);
patchAnnotate(Ft,Vt,0.1,'FontSize',fontSize);
axisGeom;
colormap gjet; icolorbar;
camlight headlight;
drawnow;
%% Creating a sphere mesh
[F,V]=geoSphere(3,radiusSphere);
C=V(:,3); %Color as Z coordinates
CF=vertexToFaceMeasure(F,C); %Convert a nodal color to a face color
%% Visualize
cFigure; hold on;
gpatch(F,V,C,'k',faceAlpha,1);
patchNormPlot(F,V);
axisGeom;
colormap gjet; colorbar;
camlight headlight;
drawnow;
%% Cut sphere in half
% THis is where the sphere is cut in half
% Define logic to cut
logicPositive=CF>0;
[logicPositive]=triSurfLogicSharpFix(F,logicPositive,3);
F=F(logicPositive,:);
CF=CF(logicPositive,:);
[F,V]=patchCleanUnused(F,V);
Eb=patchBoundary(F,V);
indicesBoundaryCurve=edgeListToCurve(Eb);
indicesBoundaryCurve=indicesBoundaryCurve(1:end-1);
angleThreshold=(160/180)*pi;
isClosedPath=1;
[F,V,indicesBoundaryCurve]=triSurfSelfTriangulateBoundary(F,V,indicesBoundaryCurve,angleThreshold,isClosedPath);
C=V(:,3); %Color as Z coordinates
CF=vertexToFaceMeasure(F,C);
%%
cPar.depth=radiusSphere;
cPar.patchType='tri';
cPar.dir=-1;
cPar.numSteps=ceil(cPar.depth/mean(patchEdgeLengths(F,V)));
cPar.closeLoopOpt=1;
[F2,V2]=polyExtrude(V(indicesBoundaryCurve,:),cPar);
F2=fliplr(F2);
[F,V,C]=joinElementSets({F,F2},{V,V2});
[F,V,~,indFix]=mergeVertices(F,V);
Eb=patchBoundary(F,V);
indicesBoundaryCurve=edgeListToCurve(Eb);
indicesBoundaryCurve=indicesBoundaryCurve(1:end-1);
%%
cFigure; hold on;
gpatch(F,V,C,'k',faceAlpha,1);
patchNormPlot(F,V);
gpatch(F2,V2,'gw','k',faceAlpha,1);
patchNormPlot(F2,V2);
plotV(V(indicesBoundaryCurve,:),'g.-','MarkerSize',markerSize,'lineWidth',lineWidth);
axisGeom;
colormap gjet; colorbar;
camlight headlight;
drawnow;
%%
pointSpacing=mean(patchEdgeLengths(F,V));
[Fb,Vb]=regionTriMesh2D({V(indicesBoundaryCurve,[1 2])},pointSpacing,0,0);
Vb(:,3)=min(V(:,3));
Fb=fliplr(Fb);
[F,V,C]=joinElementSets({F,Fb},{V,Vb});
[F,V,~,indFix]=mergeVertices(F,V);
indicesBoundaryCurve=indFix(indicesBoundaryCurve);
%%
cFigure; hold on;
hp=gpatch(F,V,C,'k',faceAlpha,1);
patchNormPlot(F,V);
plotV(V(indicesBoundaryCurve,:),'g.-','MarkerSize',markerSize,'lineWidth',lineWidth);
axisGeom;
colormap gjet; icolorbar;
camlight headlight;
drawnow;
%%
% Define region points
[V_regions]=getInnerPoint(F,V);
cFigure; hold on;
hp=gpatch(F,V,'kw','none',0.5,1);
plotV(V_regions,'g.-','MarkerSize',markerSize,'lineWidth',lineWidth);
axisGeom;
colormap gjet; icolorbar;
camlight headlight;
drawnow;
%%
% Regional mesh volume parameter
[regionA]=tetVolMeanEst(F,V); %Volume for regular tets
%%
% CREATING THE tetgen INPUT STRUCTURE
inputStruct.stringOpt='-pq1.2AaY';
inputStruct.Faces=F;
inputStruct.Nodes=V;
inputStruct.holePoints=[];
inputStruct.faceBoundaryMarker=C; %Face boundary markers
inputStruct.regionPoints=V_regions; %region points
inputStruct.regionA=regionA;
%%
% Mesh model using tetrahedral elements using tetGen
[meshOutput]=runTetGen(inputStruct); %Run tetGen
%%
% Access model element and patch data
Fb=meshOutput.facesBoundary;
Cb=meshOutput.boundaryMarker;
V=meshOutput.nodes;
CE=meshOutput.elementMaterialID;
E=meshOutput.elements;
%% Visualizing mesh using |meshView|, see also |anim8|
meshView(meshOutput);
%%
from gibbon.
I'll close this issue for now. Let me know if you need anything else.
from gibbon.
Related Issues (20)
- From 3D tetra mesh and data format To gridmesh format HOT 1
- Error on feb file creation (Unrecognized tag)
- smoothCurve HOT 2
- Holzapfel Gasser Ogden (HGO) HOT 7
- Error in febioStruct2xml HOT 3
- FEBio output initial state already, so adjustment to importFEBio_logfile needed HOT 1
- Rename sliceViewer HOT 3
- TetGen files import unsuccesful HOT 4
- Errors from using the Gibbon Code HOT 8
- Problems with Running Abaqus Milling Process HOT 3
- zsh:1: permission denied for HELP_runTetGen code on macbook
- Unit change in Gibbon simulation HOT 2
- Assistance Needed with Torsional Analysis Data Extraction in FEBio and Gibbon
- 2 Region Meshing node/vertex/facet Issues HOT 6
- Reordered dicom images in IMDAT.mat struct file HOT 2
- Isosurface export HOT 1
- RE: Errors from using the Gibbon Code HOT 1
- RE: Errors from using the Gibbon Code HOT 1
- FAILED: Log file was not created in time. FEBio likely failed prior to logfile creation! HOT 3
- FATAL ERROR: unrecognized tag "step"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gibbon.