One way to draw a star is to draw two triangles at a different angle over each other. Each side of the triangles can also be looked at as a single line on an x-y graph which means that a star consists of 6 lines or 6 x/y functions. See figure below

Each of those lines has a function and by only defining that function up until the next intersection with the next line, a star can be drawn:

The star implemented consists of 12 sections that are drawn in the same order as in the picture above. There are always two sections with the same equation as they make up one side of a triangle.

The code implemented looks as follows:

int i; if(index<=points*1) // 1 { i = index; x = ((-1)/points)*i - 2; y = -5/3*x-3.25; } else if(index<=points*2) // 2 { i = index-1*points; x = -3 + (2/points)*i ; y = 1.75; } else if(index<=points*3) // 3 { i = index-2*points; x = -1+1/points*i; y = 3/2*x+3.25; } else if(index<=points*4) // 4 { i = index-3*points; x = (1/points)*i; y = -3/2*x+3.25; } else if(index<=points*5) // 5 { i = index-4*points; x = 1+(2/points)*i; y =1.75; } else if(index<=points*6) // 6 { i = index-5*points; x = 3 - (1/points)*i; y = 1.75*x-3.5; } else if(index<=points*7) // 7 { i =index-6*points; x = 2 + (1/points)*i; y = -1.75*x+3.5; } else if(index<=points*8) // 8 { i = index-7*points; x = 3 - (2/points)*i; y = -1.75; } else if(index<=points*9) // 9 { i = index-8*points; x = 1 - (1/points)*i; y = 1.5*x - 3.25; } else if(index<=points*10) // 10 { i = index-9*points; x = -(1/points)*i; y = -1.5*x - 3.25; } else if(inde<=points*11) // 11 { i = index-10*points; x = -1 - (2/points)*i; y = -1.75; } else // 12 { i = index-11*points; x = -3 + (1/points)*i; }

The variable index is the loop iteration counter that goes from zero to N-1 whereas N is the number of points the star consists of.

This code was put into a formula node with only two inputs: the total number of points N the star consists of and the iteration counter index.

The code has then been collapsed into a subVI with only one input, the number of points for the star. The subVI has two outputs, one array for the X axis and one array for the Y axis where each pair of numbers make up a point on the sketch. The numbers range from -3.25V … 3.25V for both the X and the Y values.

In this figure, the output arrays for both the X and the Y values will hold 1200 values each.