# Build mesh from a vector of nodes

**URL:** <https://community.freefem.org/t/build-mesh-from-a-vector-of-nodes/1479>\
**Category:** General Discussion\
**Created:** [February 7, 2022, 10:24pm UTC](https://community.freefem.org/t/build-mesh-from-a-vector-of-nodes/1479 "2022-02-07T22:24:43Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![fivanci](https://avatars.discourse-cdn.com/v4/letter/f/e95f7d/32.png) [@fivanci](https://community.freefem.org/u/fivanci)\
**Post date:** [February 8, 2022, 2:06am UTC](https://community.freefem.org/t/build-mesh-from-a-vector-of-nodes/1479/2 "2022-02-08T02:06:16Z")

</div>

The way you set up your matrix of nodes, it is \in\mathbb{R}^{9\times2}. You are treating it somehow mixed, like sometimes as \in\mathbb{R}^{9\times2} an sometimes as \in\mathbb{R}^{2\times 9}. Check the documentation [Types](https://doc.freefem.org/references/types.html#matrix-size) for `matrix size`.

```auto
real[int,int] nodes = [[0,0],[0.5,0],[1,0],[0,0.5],[0.5,0.5],[1,0.5],[0,1],
                      [0.5,1],[1,1]];

// cout << nodes << endl;
cout << "nrows = " << nodes.n << ", ncols" << nodes.m << endl;

border bdry(t=0,nodes.n-1){ P.x=nodes(t,0); P.y=nodes(t,1); label=1; };
plot(bdry(nodes.n-1),dim=2,wait=1,cmm="boundary");

```

Also, your boundary is not a closed loop, so it won’t mesh of course.

Check also post [Building a border from an array of vertices - #2 by fivanci](https://community.freefem.org/t/building-a-border-from-an-array-of-vertices/1253/2), although, I see now there is _lapsus calami_ in there as well. It should be, in declaration,  
`real[int,int] vtxCoords(2,nn);` and later in code `vtxCoords.n-1`\mapsto`vtxCoords.m-1`.

if

---

_[View the full topic](https://community.freefem.org/t/build-mesh-from-a-vector-of-nodes/1479)._
