// p0 p1 // p3 p2 private void init() { int x2 = x1 + width; int y2 = y1 + height; p.addPoint(x1, y1); p.addPoint(x2, y1); p.addPoint(x2, y2); p.addPoint(x1, y2); centroid = Mat3.centroid(p); setPose(0, 1, 1); }
public void setShear(double theta, double shx, double shy) { Mat3 tr1 = new Mat3(); Mat3 tr2 = new Mat3(); Mat3 rt = new Mat3(); Mat3 sc = new Mat3(); centroid = rt.centroid(p); tr1.setTranslation(centroid[0], centroid[1]); sc.setShear(shx, shy); rt.setRotation(theta); tr2.setTranslation(-centroid[0], -centroid[1]); at = tr1.multiply(rt); at = at.multiply(sc); at = at.multiply(tr2); }