# About tetrahedron definition

**URL:** <https://community.freefem.org/t/about-tetrahedron-definition/3587>\
**Category:** General Discussion\
**Created:** [November 18, 2024, 2:16am UTC](https://community.freefem.org/t/about-tetrahedron-definition/3587 "2024-11-18T02:16:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![raphael](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@raphael](https://community.freefem.org/u/raphael)\
**Post date:** [November 18, 2024, 2:16am UTC](https://community.freefem.org/t/about-tetrahedron-definition/3587/1 "2024-11-18T02:16:23Z")

</div>

Can I directly define a tetrahedral mesh in FreeFEM++ using `mesh3 Th = tetrahedron(10, 10, 10, [0, 1], [0, 1], [0, 1]);`, or are there any prerequisites? Thank you everyone!

---

<div class="post-metadata">

**Author:** ![frederichecht](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/frederichecht/32/15_2.png) [@frederichecht](https://community.freefem.org/u/frederichecht)\
**Post date:** [November 19, 2024, 7:23am UTC](https://community.freefem.org/t/about-tetrahedron-definition/3587/2 "2024-11-19T07:23:08Z")

</div>

no code to build a tetrahedron to day in freefem++,  
but you can use a file

here a trick to buil mesh with 1 tet.

real[int] xx=[0,1,0,0], yy=[0,0,1,0], zz=[0,0,0,1];  
mesh3 Th=tetgconvexhull(xx,yy,zz,region=1,label=3);  
savemesh(Th,“/tmp/Th.mesh”);

---

<div class="post-metadata">

**Author:** ![raphael](https://avatars.discourse-cdn.com/v4/letter/r/edb3f5/32.png) [@raphael](https://community.freefem.org/u/raphael)\
**Post date:** [November 19, 2024, 7:50am UTC](https://community.freefem.org/t/about-tetrahedron-definition/3587/3 "2024-11-19T07:50:49Z")

</div>

Thank you, professor 🥹

---

<div class="post-metadata">

**Author:** ![alh](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.freefem.org/alh/32/2354_2.png) [@alh](https://community.freefem.org/u/alh)\
**Post date:** [November 21, 2024, 1:40pm UTC](https://community.freefem.org/t/about-tetrahedron-definition/3587/4 "2024-11-21T13:40:13Z")

</div>

Interesting question. Just in case, here is another mesh with one single tetrahedron

```auto
load "msh3"

{
  ofstream meshfile("test_onetet.mesh");
  meshfile<<"MeshVersionFormatted 1"<<endl;
  meshfile<<""<<endl;
  meshfile<<"Dimension 3"<<endl;
  meshfile<<""<<endl;
  meshfile<<"Vertices"<<endl;
  meshfile<<"4"<<endl;
  meshfile<<"0 0 0 1"<<endl;
  meshfile<<"1 0 0 1"<<endl;
  meshfile<<"0 1 0 1"<<endl;
  meshfile<<"0 0 1 1"<<endl;
  meshfile<<""<<endl;
  meshfile<<"Tetrahedra"<<endl;
  meshfile<<"1"<<endl;
  meshfile<<"1 2 3 4 0"<<endl;
  meshfile<<""<<endl;
  meshfile<<"Triangles"<<endl;
  meshfile<<"4"<<endl;
  meshfile<<"1 2 4 1"<<endl;
  meshfile<<"1 2 3 1"<<endl;
  meshfile<<"1 3 4 1"<<endl;
  meshfile<<"2 3 4 1"<<endl;
  meshfile<<""<<endl;
  meshfile<<"End"<<endl;
}

mesh3 Th=readmesh3("test_onetet.mesh");
plot(Th,cmm="Th");

```

[https://www.ljll.fr/lehyaric/ffcs/src/ffref/Basic/onetet.m4.htm](https://www.ljll.fr/lehyaric/ffcs/src/ffref/Basic/onetet.m4.htm)
