Lines Matching refs:Quad

25  * The Quad class specifies a (possibly affine transformed) rectangle.
27 * A Quad instance holds 4 points that define its shape. The points may represent any rectangle that
32 * Each point in the Quad represents a specific corner of the Quad. These are top-left, top-right,
33 * bottom-left, and bottom-right. These labels allow mapping a transformed Quad back to an up-right
34 * Quad, with the point-to-point mapping well-defined. They do not necessarily indicate that e.g.
38 public class Quad {
46 * Returns the unit Quad.
47 * The unit Quad has its top-left point at (0, 0) and bottom-right point at (1, 1).
48 * @return the unit Quad.
50 public static Quad unitQuad() {
51 return new Quad(0f, 0f, 1f, 0f, 0f, 1f, 1f, 1f);
55 * Return a Quad from the specified rectangle.
58 * @return Quad that represents the passed rectangle.
60 public static Quad fromRect(RectF rect) {
61 return new Quad(new PointF(rect.left, rect.top),
68 * Return a Quad from the specified rectangle coordinates.
74 * @return Quad that represents the passed rectangle.
76 public static Quad fromRect(float x, float y, float width, float height) {
77 return new Quad(new PointF(x, y),
84 * Return a Quad that spans the specified points and height.
86 * The returned Quad has the specified top-left and top-right points, and the specified height
92 * @return Quad that spans the specified points and height.
94 public static Quad fromLineAndHeight(PointF topLeft, PointF topRight, float height) {
100 return new Quad(topLeft, topRight, p2, p3);
104 * Return a Quad that represents the specified rotated rectangle.
106 * The Quad is rotated counter-clockwise around its centroid.
110 * @return the Quad representing the source rectangle rotated by the given angle.
112 public static Quad fromRotatedRect(RectF rect, float angle) {
113 return Quad.fromRect(rect).rotated(angle);
117 * Return a Quad that represents the specified transformed rectangle.
123 * @return the Quad representing the source rectangle transformed by the matrix
125 public static Quad fromTransformedRect(RectF rect, Matrix matrix) {
126 return Quad.fromRect(rect).transformed(matrix);
130 * Returns the transformation matrix to transform the source Quad to the target Quad.
136 public static Matrix getTransform(Quad source, Quad target) {
144 * The top-left point of the Quad.
145 * @return top-left point of the Quad.
152 * The top-right point of the Quad.
153 * @return top-right point of the Quad.
160 * The bottom-left point of the Quad.
161 * @return bottom-left point of the Quad.
168 * The bottom-right point of the Quad.
169 * @return bottom-right point of the Quad.
178 * The Quad is rotated counter-clockwise around its centroid.
181 * @return the rotated Quad
183 public Quad rotated(float angle) {
193 return new Quad(topLeft, topRight, bottomLeft, bottomRight);
202 * @return the transformed Quad
204 public Quad transformed(Matrix matrix) {
207 return new Quad(points);
211 * Returns the centroid of the Quad.
213 * The centroid of the Quad is where the two inner diagonals connecting the opposite corners
216 * @return the centroid of the Quad.
229 * an attribute to the Quad.
239 * Grow the Quad outwards by the specified factor.
241 * This method moves the corner points of the Quad outward along the diagonals that connect
246 * @return the Quad grown by the specified amount
248 public Quad grow(float factor) {
250 return new Quad(factor * (mTopLeft.x - pc.x) + pc.x,
261 * Scale the Quad by the specified factor.
264 * @return the Quad instance scaled by the specified factor.
266 public Quad scale(float factor) {
267 return new Quad(mTopLeft.x * factor, mTopLeft.y * factor,
274 * Scale the Quad by the specified factors in the x and y factors.
278 * @return the Quad instance scaled by the specified factors.
280 public Quad scale2(float sx, float sy) {
281 return new Quad(mTopLeft.x * sx, mTopLeft.y * sy,
288 * Returns the Quad's left-to-right edge.
290 * Returns a vector that goes from the Quad's top-left to top-right (or bottom-left to
300 * Returns the Quad's top-to-bottom edge.
302 * Returns a vector that goes from the Quad's top-left to bottom-left (or top-right to
313 return "Quad(" + mTopLeft.x + ", " + mTopLeft.y + ", "
319 private Quad(PointF topLeft, PointF topRight, PointF bottomLeft, PointF bottomRight) {
326 private Quad(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) {
333 private Quad(float[] points) {