座標の点群を変換行列で変換するのではなく、座標を変換行列で変換して、その座標上で描画を行う。
こうしない場合、ProcessingのAPIがそのまま使えず煩雑になる(→rectとかellipseとかの基本図形のコマンドがそのまま使えなくなり、めんどくさいということ)
float[] c1 = {100, 100}; float[] c2 = {300, 300}; size(600, 600); background(255); fill(#00ff00); rect(c2[0], c2[1], 100, 100); fill(#ff0000); rect(c1[0], c1[1], 100, 100); pushMatrix(); translate(c1[0], c1[1]); rotate(radians(45)); translate(-c1[0], -c1[1]); fill(#ff0000); rect(c1[0], c1[1], 100, 100); popMatrix(); pushMatrix(); translate(c2[0], c2[1]); rotate(radians(45)); translate(-c2[0], -c2[1]); fill(#00ff00); rect(c2[0], c2[1], 100, 100); popMatrix();