This repository was archived by the owner on May 11, 2025. It is now read-only.
forked from processing/processing-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPMatrix.java
More file actions
170 lines (118 loc) · 4.69 KB
/
PMatrix.java
File metadata and controls
170 lines (118 loc) · 4.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/* -*- mode: java; c-basic-offset: 2; indent-tabs-mode: nil -*- */
/*
Part of the Processing project - http://processing.org
Copyright (c) 2012-16 The Processing Foundation
Copyright (c) 2005-12 Ben Fry and Casey Reas
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License version 2.1 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General
Public License along with this library; if not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307 USA
*/
package processing.core;
public interface PMatrix {
public void reset();
/**
* Returns a copy of this PMatrix.
*/
public PMatrix get();
/**
* Copies the matrix contents into a float array.
* If target is null (or not the correct size), a new array will be created.
*/
public float[] get(float[] target);
public void set(PMatrix src);
public void set(float[] source);
public void set(float m00, float m01, float m02,
float m10, float m11, float m12);
public void set(float m00, float m01, float m02, float m03,
float m10, float m11, float m12, float m13,
float m20, float m21, float m22, float m23,
float m30, float m31, float m32, float m33);
public void translate(float tx, float ty);
public void translate(float tx, float ty, float tz);
public void rotate(float angle);
public void rotateX(float angle);
public void rotateY(float angle);
public void rotateZ(float angle);
public void rotate(float angle, float v0, float v1, float v2);
public void scale(float s);
public void scale(float sx, float sy);
public void scale(float x, float y, float z);
public void shearX(float angle);
public void shearY(float angle);
/**
* Multiply this matrix by another.
*/
public void apply(PMatrix source);
public void apply(PMatrix2D source);
public void apply(PMatrix3D source);
public void apply(float n00, float n01, float n02,
float n10, float n11, float n12);
public void apply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33);
/**
* Apply another matrix to the left of this one.
*/
public void preApply(PMatrix left);
/**
* Apply another matrix to the left of this one.
*/
public void preApply(PMatrix2D left);
/**
* Apply another matrix to the left of this one. 3D only.
*/
public void preApply(PMatrix3D left);
/**
* Apply another matrix to the left of this one.
*/
public void preApply(float n00, float n01, float n02,
float n10, float n11, float n12);
/**
* Apply another matrix to the left of this one. 3D only.
*/
public void preApply(float n00, float n01, float n02, float n03,
float n10, float n11, float n12, float n13,
float n20, float n21, float n22, float n23,
float n30, float n31, float n32, float n33);
/**
* Multiply source by this matrix, and return the result.
* The result will be stored in target if target is non-null, and target
* will then be the matrix returned. This improves performance if you reuse
* target, so it's recommended if you call this many times in draw().
*/
public PVector mult(PVector source, PVector target);
/**
* Multiply a multi-element vector against this matrix.
* Supplying and recycling a target array improves performance, so it's
* recommended if you call this many times in draw().
*/
public float[] mult(float[] source, float[] target);
// public float multX(float x, float y);
// public float multY(float x, float y);
// public float multX(float x, float y, float z);
// public float multY(float x, float y, float z);
// public float multZ(float x, float y, float z);
/**
* Transpose this matrix; rows become columns and columns rows.
*/
public void transpose();
/**
* Invert this matrix. Will not necessarily succeed, because some matrices
* map more than one point to the same image point, and so are irreversible.
* @return true if successful
*/
public boolean invert();
/**
* @return the determinant of the matrix
*/
public float determinant();
}