mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
added 2D version of invMatrix utility methods
This commit is contained in:
@@ -3772,6 +3772,13 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
static protected void invTranslate(PMatrix2D matrix,
|
||||
float tx, float ty) {
|
||||
matrix.preApply(1, 0, -tx,
|
||||
0, 1, -ty);
|
||||
}
|
||||
|
||||
|
||||
static protected float matrixScale(PMatrix matrix) {
|
||||
// Volumetric scaling factor that is associated to the given
|
||||
// transformation matrix, which is given by the absolute value of its
|
||||
@@ -3857,8 +3864,8 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
static private void invRotate(PMatrix3D matrix, float angle,
|
||||
float v0, float v1, float v2) {
|
||||
static protected void invRotate(PMatrix3D matrix, float angle,
|
||||
float v0, float v1, float v2) {
|
||||
float c = PApplet.cos(-angle);
|
||||
float s = PApplet.sin(-angle);
|
||||
float t = 1.0f - c;
|
||||
@@ -3870,6 +3877,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
static protected void invRotate(PMatrix2D matrix, float angle) {
|
||||
matrix.rotate(-angle);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Same as scale(s, s, s).
|
||||
*/
|
||||
@@ -3911,6 +3923,11 @@ public class PGraphicsOpenGL extends PGraphics {
|
||||
}
|
||||
|
||||
|
||||
static protected void invScale(PMatrix2D matrix, float x, float y) {
|
||||
matrix.preApply(1/x, 0, 0, 1/y, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void shearX(float angle) {
|
||||
float t = (float) Math.tan(angle);
|
||||
|
||||
Reference in New Issue
Block a user