cogtubetest.html
来自「有限元学习研究用源代码(老外的),供科研人员参考」· HTML 代码 · 共 47 行
HTML
47 行
<TITLE>Intersecting Tubes</TITLE>
<H1>Intersecting Tubes</H1>
<PRE>
#include "cogfunction.hxx"
#include "cogfaces.hxx"
float rr1 = 0.2*0.2;
float rr2 = 0.3*0.3;
static cogFloat Tube1(const cogPoint& x)
{
cogFloat dx = x[0] - 0.5;
cogFloat dy = x[1] - 0.3 - 0.1*x[2];
return dx*dx + dy*dy - rr1;
}
static cogFloat Tube2(const cogPoint& x)
{
cogFloat dy = x[1] - 0.6;
cogFloat dz = x[2] - 0.5;// - 0.1*x[0];
return dy*dy +dz*dz - rr2;
}
static cogSegment Faces(const cogPoint& x)
{
if(Tube1(x) > Tube2(x)) return wzFace(2);
else return wzFace(3);
}
static cogSegment Regions(const cogPoint& x)
{
if(Tube1(x) < 0) return wzRegion(2);
if(Tube2(x) < 0) return wzRegion(2);
return wzRegion(1);
}
cogeometry test_cogeometry()
{
cogeometry region = new CogeometrySimpleRegions(Regions);
cogeometry faces = new CogeometrySimpllFaces(Faces,region);
return faces;
}
</PRE>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?