The results of an amplitude analysis of the charmless three-body decay B þ → π þ π þ π − , in which CP-violation effects are taken into account, are reported. The analysis is based on a data sample corresponding to an integrated luminosity of 3 fb −1 of pp collisions recorded with the LHCb detector. The most challenging aspect of the analysis is the description of the behavior of the π þ π − S-wave contribution, which is achieved by using three complementary approaches based on the isobar model, the K-matrix formalism, and a quasi-model-independent procedure. Additional resonant contributions for all three methods are described using a common isobar model, and include the ρð770Þ 0 , ωð782Þ and ρð1450Þ 0 resonances in the π þ π − P-wave, the f 2 ð1270Þ resonance in the π þ π − D-wave, and the ρ 3 ð1690Þ 0 resonance in the π þ π − F-wave. Significant CP-violation effects are observed in both Sand D-waves, as well as in the interference between the Sand P-waves. The results from all three approaches agree and provide new insight into the dynamics and the origin of CP-violation effects in B þ → π þ π þ π − decays.