Nearly half a century ago, when Mazda parent company Toyo Kogyo licensed the rights to build the Wankel rotary engine from Auto Union, it looked like the wave of the future.
It was, in principle anyway, much simpler than a conventional piston engine, with a three-cornered rotor taking the place of three conventional cylinders.
Astonishingly compact, it delivered power and noise (in roughly equal quantities) out of all proportion to its size - in fact some early Mazda rotary crankcases were smaller than the carburettors that fed them.
But rotaries are actually not very efficient.
They burn oil like a two-stroke and quite of lot of fuel gets swept, unburnt, down the exhaust pipe.
To a generation of power-hungry sports-car drivers the fact that a twin-rotor RX-7 burned more petrol than an E-Type Jaguar meant little - until the fuel crisis of 1973 hit just as the 'engine of the future' was taking off, and the later EU and EPA clean-air statutes hammered the final nails into its coffin.
The last rotary-engined production car, an RX-8 sports coupé, will come off the production line at Mazda's No.1 plant in Hiroshima this week.
But what a ride it has been.
Starting with the Cosmo Sport in 1967, Mazda has made almost two million rotary-engined cars, peaking at 239,871 in the watershed year of 1973.
After that production declined but the compactness, light weight and punchy power of the rotary kept it a favourite in arenas where fuel economy was of lesser importance.
Modified Mazda rotaries were the backbone of South African motorsport in the late 1970s and early 1980s, dominating the Formula Atlantic championship with cars so noisy even the motorcycle racers, who disparagingly referred to them as Rattexes, complained!
In 1991, the rotary-powered Mazda 787B became the first Japanese car to win the Le Mans 24 Hour endurance race - despite having to pit for fuel more often than its conventional competitors. Ironically, the drop-dead gorgeous 787B is today remembered more for the unearthly howl that accompanied it down the Mulsanne straight than for its ground-breaking victory.
STRANGLED BY EMISSIONS REGULATIONS
But by then not even the addition of a turbocharger (as on the 1982 Cosmo RE) could save it from being strangled by increasingly draconian emissions statutes, although the incredibly clean-burning, hydrogen-fuelled RX-8 RE rotary might have turned that around had hydrogen been more widely available.
Only about a dozen were built, most of which are leased to the Hiroshima and Yamaguchi prefectural governments.
A conventional petrol-powered RX-8 typically uses twice as much fuel in everyday driving as a 1.4-litre compact and about half as much again as even the hottest of hot hatches.
By 2003, the RX-8 was the only rotary in production and by 2010, when the Euro 5 emission standards (which the RX-8 failed miserably to meet) came into effect production was down to about 240 a month.
Mazda is pinning its future on what it calls SkyActiv, a suite of technologies based on lightweight but conventional diesel and petrol engines with super-efficient automatic transmissions.
But work on rotaries will continue, with an extended-range electric car in the pipeline that will use a hydrogen-fuelled rotary to charge its batteries.
Who knows, maybe the rotary isn't dead yet.