separate demo from main.cpp
fix bug of transformation.