Skip to content

Commit 274ef10

Browse files
committed
Update Index
1 parent 7c9c274 commit 274ef10

1 file changed

Lines changed: 22 additions & 20 deletions

File tree

‎CustomView/Advance/[10]Matrix_Method.md‎

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
构造方法没有在上面表格中列出。
2929

30-
**无参构造**
30+
#### 无参构造
3131

3232
``` java
3333
Matrix ()
@@ -51,7 +51,7 @@ Matrix matrix = new Matrix();
5151
$$)
5252
5353
54-
**有参构造**
54+
#### 有参构造
5555
5656
``` java
5757
Matrix (Matrix src)
@@ -70,19 +70,19 @@ Matrix matrix = new Matrix(src);
7070
7171
基本方法内容比较简单,在此处简要介绍一下。
7272
73-
**1.equals**
73+
#### 1.equals
7474
7575
比较两个Matrix的数值是否相同。
7676
77-
**2.hashCode**
77+
#### 2.hashCode
7878
7979
获取Matrix的哈希值。
8080
81-
**3.toString**
81+
#### 3.toString
8282
8383
将Matrix转换为字符串: `Matrix{[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]}`
8484
85-
**4.toShortString**
85+
#### 4.toShortString
8686
8787
将Matrix转换为短字符串: `[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]`
8888
@@ -91,31 +91,31 @@ Matrix matrix = new Matrix(src);
9191
9292
数值操作这一组方法可以帮助我们直接控制Matrix里面的数值。
9393
94-
**1.set**
94+
#### 1.set
9595
9696
``` java
9797
void set (Matrix src)
9898
```
9999
100100
没有返回值,有一个参数,作用是将参数Matrix的数值复制到当前Matrix中。如果参数为空,则重置当前Matrix,相当于`reset()`。
101101
102-
**2.reset**
102+
#### 2.reset
103103
104104
``` java
105105
void reset ()
106106
```
107107
108108
重置当前Matrix(将当前Matrix重置为单位矩阵)。
109109
110-
**3.setValues**
110+
#### 3.setValues
111111
112112
``` java
113113
void setValues (float[] values)
114114
```
115115
116116
setValues的参数是浮点型的一维数组,长度需要大于9,拷贝数组中的前9位数值赋值给当前Matrix。
117117
118-
**4.getValues**
118+
#### 4.getValues
119119
120120
``` java
121121
void getValues (float[] values)
@@ -125,7 +125,7 @@ void getValues (float[] values)
125125
126126
### 数值计算
127127
128-
**1.mapPoints**
128+
#### 1.mapPoints
129129
130130
``` java
131131
void mapPoints (float[] pts)
@@ -250,7 +250,7 @@ after : src=[0.0, 0.0, 80.0, 100.0, 400.0, 300.0]
250250
after : dst=[40.0, 100.0, 200.0, 300.0, 0.0, 0.0]
251251
```
252252
253-
**2.mapRadius**
253+
#### 2.mapRadius
254254
255255
``` java
256256
float mapRadius (float radius)
@@ -283,7 +283,7 @@ mapRadius: 70.71068
283283
```
284284
285285
286-
**3.mapRect**
286+
#### 3.mapRect
287287
288288
```
289289
boolean mapRect (RectF rect)
@@ -326,7 +326,7 @@ isRect: false
326326
327327
(2) `boolean mapRect (RectF dst, RectF src)` 测量src并将测量结果放入dst中,返回值是判断矩形经过变换后是否仍为矩形,和之前没有什么太大区别,此处就不啰嗦了。
328328
329-
**4.mapVectors**
329+
#### 4.mapVectors
330330
331331
测量向量。
332332
@@ -492,11 +492,13 @@ public class MatrixSetPolyToPolyTest extends View {
492492
>
493493
> 只列一个表格就算交代完毕了显得诚意不足,为了彰显诚意,接下来详细的讲解一下。
494494
495+
496+
495497
魔力不足,正在蓄力中...
496498
497499
498500
499-
**2.setRectToRect**
501+
#### 2.setRectToRect
500502
501503
```JAVA
502504
boolean setRectToRect (RectF src, // 源区域
@@ -575,13 +577,13 @@ public class MatrixSetRectToRectTest extends View {
575577
576578
577579
578-
**3.rectStaysRect**
580+
#### 3.rectStaysRect
579581
580582
判断矩形经过变换后是否仍为矩形,假如Matrix进行了平移、缩放则画布仅仅是位置和大小改变,矩形变换后仍然为矩形,但Matrix进行了非90度倍数的旋转或者错切,则矩形变换后就不再是矩形了,这个很好理解,不过多赘述,顺便说一下,前面的`mapRect`方法的返回值就是根据`rectStaysRect`来判断的。
581583
582584
583585
584-
**4.setSinCos**
586+
#### 4.setSinCos
585587
586588
设置sinCos值,这个是控制Matrix旋转的,由于Matrix已经封装好了Rotate方法,所以这个并不常用,在此仅作概述。
587589
@@ -636,7 +638,7 @@ setRotate:[0.0, -1.0, 0.0][1.0, 0.0, 0.0][0.0, 0.0, 1.0]
636638
| isAffine | 判断当前矩阵是否为仿射矩阵,API21(5.0)才添加的方法。 |
637639
| isIdentity | 判断当前矩阵是否为单位矩阵。 |
638640
639-
**1.invert**
641+
#### 1.invert
640642
641643
求矩阵的逆矩阵,简而言之就是计算与之前相反的矩阵,如果之前是平移200px,则求的矩阵为反向平移200px,如果之前是缩小到0.5f,则结果是放大到2倍。
642644
@@ -671,7 +673,7 @@ after - invert [1.0, 0.0, -200.0][0.0, 1.0, -500.0][0.0, 0.0, 1.0]
671673
672674
673675
674-
**2.isAffine**
676+
#### 2.isAffine
675677
676678
判断矩阵是否是仿射矩阵, 貌似并没有太大卵用,因为你无论如何操作结果始终都为true。
677679
@@ -702,7 +704,7 @@ isAffine=true
702704
703705
704706
705-
**3.isIdentity**
707+
#### 3.isIdentity
706708
707709
判断是否为单位矩阵,什么是单位矩阵呢,就是文章一开始的那个:
708710

0 commit comments

Comments
 (0)