Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public void onDraw(Canvas canvas)
- {
- int startX, startY, stopX, stopY;
- startY = stopY = 100;
- startX = 100;
- stopX = 200;
- this.paint = new Paint();
- //this.path = new Path();
- this.matrix = canvas.getMatrix();
- this.paint.setColor(Color.BLUE);
- this.paint.setStrokeWidth(4);
- this.matrix.setRotate(180, startX, startY);
- canvas.concat(this.matrix);
- /*this.matrix.setTranslate(startX, 0);
- canvas.concat(this.matrix);*/
- canvas.drawLine(startX, startY, stopX, stopY, this.paint);
- canvas.setMatrix(new Matrix());
- //canvas.drawCircle(200, 200, 50, paint);
- }
- this.matrix.setRotate(180, startX, startY);
- canvas.save();
- canvas.concat(this.matrix);
- canvas.drawLine(startX, startY, stopX, stopY, this.paint);
- canvas.restore();
- Matrix m = new Matrix(); //Declaring a new matrix
- float[] vecs = {7, 3}; //Declaring an end-point of the line
- /*Declaring the initial values of the matrix
- according to the theory of the 3
- dimensional chicken in 2D space
- There is also 4D chicken in 3D space*/
- float[] initial = {1, 0, 0, 0, 1, 0, 0, 0, 1};
- m.setValues(initial);
- float[] tmp = new float[9]; //Debug array of floats
- m.setRotate(90, 4.0f, 3.0f); //Rotating by 90 degrees around the (4, 3) point
- /*Mapping our vector to the matrix.
- Similar to the multiplication of two
- matrices 3x3 by 1x3.
- In our case they are (matrix m after rotating) multiplied by
- (7)
- (3)
- (1) according to the theory*/
- m.mapPoints(vecs);
- for(float n : vecs)
- {
- Log.d("VECS", "" + n); //Some debug info
- }
- m.getValues(tmp);
- for(float n : tmp)
- {
- Log.d("TMP", "" + n); //also debug info
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement