Candy Cane Model and Exploration in GeoGebra AR

A special THANK YOU and shout-out to Mathieu Blossier, whose creative genius enabled me to write the top half of this candy cane using only 1 surface equation (versus 2). The way I originally authored the surface equations was as follows (see pic below). Note the blue surface is the top half of half the torus. The pink surface is the half-cylinder.

1st Attempt

1st Attempt
Yet Mathieu Blossier authored the equations seen in the screencast below. Key Question: How do the factors and enable this entire top half of the candy cane to be constructed by using only 1 surface equation? Explain.