Processing Forum
R(x) =[cosx -sinx
sinx cosx]
then
A(x) = R(x)*[2 3]
how could I do that ?
import guicomponents.*;
import android.view.MotionEvent;float x11,y22, x,y,x1,y1,x2,y2,z4,press1,press2;int pointNum;float zoom;PImage car;void setup() {zoom = 1;size(screenWidth, screenHeight);car = loadImage("Nam.jpg");stroke(0);}void draw() {background(240);scale(zoom);//fill(press1*200,0,0);//ellipse(x1,y1,press1*300,press1*300);//fill(0,press2*200,0);//ellipse(x2,y2,press2*300,press2*300);image(car, 200, 400, car.width/5.4, car.height/5.8);rect(100,200,10,10);}
boolean surfaceTouchEvent(MotionEvent event) {pointNum=event.getPointerCount();switch (event.getAction() & MotionEvent.ACTION_MASK) {case MotionEvent.ACTION_POINTER_DOWN:// User is pressing down another finger.float x11 = event.getX(0) - event.getX(1);float y22 = event.getY(0) - event.getY(1);z4 = sqrt(x11*x11+y22*y22);println("z4:" + z4);break;case MotionEvent.ACTION_POINTER_UP:// User is released one of the fingers.break;case MotionEvent.ACTION_MOVE:x1=event.getX(0);x2=event.getX(1);y1=event.getY(0);y2=event.getY(1);//float z3 = dist(x1,y1,x2,y2);
float x = event.getX(0) - event.getX(1);float y= event.getY(0) - event.getY(1);float z3 = sqrt(x*x+y*y);println("z3:" + z3);if (pointNum == 2 ) {if ( z3 < z4 ) {zoom = z3/z4;println("smaller");}else{zoom = z3/z4;println("bigger");}}press1=event.getSize(0);press2=event.getSize(1);break;}return super.surfaceTouchEvent(event);}
void setup(){size(200,200);}void draw() {scale(2); // disappearedrect(100,100,10,10);}