# pointsandfaces – rotating extrusion

The principle of closing each row and closing the object by letting the last column connect to the first column is not only suitable for tubes, but for the pointsandfaces-equivalent function of the OpenSCAD module rotate_extrude().

Here is a simpe example. To see the edges like on the picture below, press <Ctrl>+F1.

```use <inc/pnf/pnf.scad>

fn = 6;
P = [[20,20],[30,20],[40,10],[30,0],[20,0]];
v = pnf_rotate_extrude_pnf_v(P=P,fn=fn);
PnfDebugPoints(v,true);
echo(v);
% polyhedron(v,v,4);```

This time I relinquish to list the complete output of the echo-Statement. I leave away the points, because you can see their positions in the picture and I only list the first alnd last few triangles.

the first row of top-left triangles: [ 0, 5, 6], [ 1, 6, 7], [ 2, 7, 8], [ 3, 8, 9], [ 4, 9, 5]
the first row of bottom-right triangles: [ 0, 6, 1], [ 1, 7, 2], [ 2, 8, 3], [ 3, 9, 4], [ 4, 5, 0]
the last row of top-left triangles: [25, 0, 1], [26, 1, 2], [27, 2, 3], [28, 3, 4], [29, 4, 0],
the last row of bottom-right triangles: [25, 1, 26], [26, 2, 27], [27, 3, 28], [28, 4, 29], [29, 0, 25]

As you see, the first triangle  [ 0, 5, 6] is on the upper side and clockwise seen from the outside. The following triangles also follow the scheme, we already know from the last chapter. [1, 6, 7] is the next in the row, and so on. Actually this is like the tube, but with rows as columns and columns as rows. But what is the advantage compared to the OpenSCAD module rotate_extrude()? What kind of mutation can be applied to the points-array? Take a look at the following listing an the resulting object.

```use <inc/pnf/pnf.scad>

fn = 360;
P = [[50,0],[60,20],[50,40],[30,40],[30,0]];

v = pnf_rotate_extrude_pnf_v(P=P,fn=fn);
v_s =
[
for (i = [0 : len(v) - 1])
let
(
w = atan2(v[i],v[i])+360,
rw = (w % 20 > 15) ? 60 : 50
)
[
(i % len(P) == 1) // if outer ring index
? rw * cos(w) // use angle-dependet value
: v[i], // else keep value
(i % len(P) == 1) // same here..
? rw * sin(w)
: v[i],
v[i] // z remains z.
]
];
polyhedron(v_s,pnf_turn_sides_faces_v(v),4);``` Similar, but without closing by closing a circle, works screw extrusion, our next chapter.