```How to figure out where to offset the wave? Determine your starting point.  Go for a corner or a vertex, such as the one I've circled in the picture.
Now, travel around the border of the square (follow the arrows - it doesn't matter if you go clockwise or
counterclockwise).

As you travel along the perimeter of the square, notice your distance from the top and the left edges of the picture.
Sometimes, it might help to sketch a little waveform to the right side and the bottom side of your picture.

Since it is a square, we will break our waveform into four parts. Notice the white areas where the waveform will be drawn.  The top right one represents how our distance
from the top changes as we go around the square.  For the first arrow, we move down, so the waveform will
slope down from -1 to 1 in the first column of the waveform.  On the second arrow, the distance from the top
remains the same, so column 2 will have the same value.  The third arrow goes back up to -1, so the waveform will
slope back upwards.  The fourth arrow holds the same value.  Simple?
The bottom left graph indicates how the distance from the left will change.
Arrows 1 and 3 have fixed left distances.  Arrow 2 moves to the left, so the waveform should sweep over to the
left side.  Arrow 4 moves back to the right, so the waveform moves right as well.
The complete waveform would look like this: This is a very efficient way of figuring out what a waveform will look like if you want any other kind
of shape to be drawn with a periodic function.
Compare our waveforms to the hexagon wave form that we already have: You can see the top right waveform for the Y coordinates matches our HexagonWave perfectly.
The bottom left graph (which you should mentally flip from the upper-right corner before comparing
with the HexagonWave), begins at the second portion of the HexagonWave.
Since the X coordinate starts at a different section of the HexagonWave, we have to add an offset (a phase shift)
for it.
The period of our previously created HexagonWave was 4, so in order for us to skip the first quarter of this
waveform, we take one-fourth of the period (if we wanted to skip three quarters, we'd take three-fourths of
the period) and add that to our angular frequency * T value.
X = 100 + 40 * Hxgn(0.04 * T + 1)  <-- This is where the 1 comes from.
Y = 100 + 40 * Hxgn(0.04 * T)

This draws the square clockwise, starting from the upper-left, exactly how we traced around the square above.
We can start from a different corner by adding to both phase shifts.  For example:
X = 100 + 40 * Hxgn(0.04 * T + 2)
Y = 100 + 40 * Hxgn(0.04 * T + 1)
This starts the square from the bottom right corner.
Adding 1 to both phase shifts again make the square begin from the bottom left corner.
Adding 1 again will make the square begin from the top left corner, which would look like this:
X = 100 + 40 * Hxgn(0.04 * T + 4)
Y = 100 + 40 * Hxgn(0.04 * T + 3)
But, since 4 is the period of the Hxgn function, and, in the first Periodics page, I mentioned that adding
the period to the inside argument is equal to the same call without the addition, it can be simplified as
X = 100 + 40 * Hxgn(0.04 * T)
Y = 100 + 40 * Hxgn(0.04 * T + 3)
Which also draws the square from the top left.
You can also freely subtract 4 from the phase shift to get
X = 100 + 40 * Hxgn(0.04 * T)
Y = 100 + 40 * Hxgn(0.04 * T - 1)
(Although, this gets into scary territory since we did not design our periodic functions to be used with
negative values... it does seem to work, however, thanks to our Fmd function.)

You can also make the square draw counterclockwise by making the Y phase shift equal to the X phase shift + 1.
So:
X = 100 + 40 * Hxgn(0.04 * T + 1)
Y = 100 + 40 * Hxgn(0.04 * T + 2)
This draws the square CCW starting from the bottom right corner.
You can make it start from a different corner, as usual, by adding or subtracting 1/4 of the period.
(Remember: the 4 of 1/4 comes from us having a four-sided figure, like a square.)
X = 100 + 40 * Hxgn(0.04 * T)
Y = 100 + 40 * Hxgn(0.04 * T + 1)
This is what we used to draw the square at the end of the second Periodics page.

Now, we'll go through the full process of making a triangle. Pretend that this is the (isosceles) triangle that we want to draw with some periodics.
Since our shape has three sides, our waveform will have three parts.
We'll start from the top left this time as well. Next, we sketch our waveform.
For the upper-right form, we chart the arrows distance from the top, using a portion of the waveform with
the corresponding side.
So, the first region has the waveform fixed at -1.  The second region has the waveform slope down to +1.
For the bottom-left graph, the distance from the left is charted.
The first region has the waveform slope from -1 to +1.  The second region has the waveform slope
down, not to -1, but just to 0 (since it ends in the middle).    The third region has the waveform to return back to -1.
So: Our first waveform looks similar to the HexagonWave, except without the formerly second region.
We will have to create a periodic function for this waveform.  I called it the TrapezoidWave (you should
see the trapezoid if you extend the waveform for a bit).
Our period will be a simple 3.
If Res >= 0 And Res < 1 Then
Trpz = -1
The second region has a line with slope of 2 and the intercept is at -1.
ElseIf Res >= 1 And Res < 2 Then
Trpz = 2 * (Res - 1) - 1
The third region has the line with slope of -2 and intercept of 1.
Else
Trpz = -2 * (Res - 2) + 1

Now our bottom-left waveform (remember to flip it over at the top-right corner): (The result -- ScaleneWave or whatever.)
The first section has the intercept at -1 and a slope of 2.
If Res >= 0 And Res < 1 Then
Scln = 2 * Res - 1
The second section has intercept of 1 and a slope of -1 (for a change).
ElseIf Res >= 1 And Res < 2 Then
Scln = -(Res - 1) + 1
The third section is the same line as the second section, so we can just expand the second section:
Else
Scln = -(Res - 1) + 1

Our two functions:

Public Function Trpz(N As Single) As Single
Dim Quotient As Single, Res As Single
Quotient = N / 3
Res = Fmd(Quotient, 3)
If Res >= 0 And Res < 1 Then
Trpz = -1                     'Flat part.
ElseIf Res >= 1 And Res < 2 Then
Trpz = 2 * (Res - 1) - 1      'Rise to the point.
Else
Trpz = -2 * (Res - 2) + 1     'Fall from the point.
End If
End FunctionPublic Function Scln(N As Single) As Single
Dim Quotient As Single, Res As Single
Quotient = N / 3
Res = Fmd(Quotient, 3)
If Res >= 0 And Res < 1 Then
Scln = 2 * Res - 1            'Steep leading edge of wave.
Else
Scln = -(Res - 1) + 1         'Long edge of wave
End If
End Function

Now, we can use our new periodics to draw our triangle.
X = 100 + 36 * Scln(0.08 * T)
Y = 100 + 36 * Trpz(0.08 * T)

And our triangle: ```