Skip to content

Commit 13ab0fc

Browse files
committed
Add value method
1 parent f7a57c3 commit 13ab0fc

1 file changed

Lines changed: 48 additions & 6 deletions

File tree

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

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,58 @@ Matrix matrix = new Matrix(src);
7272
7373
基本方法内容比较简单,在此处简要介绍一下。
7474
75-
方法 | 简介
76-
---|---
77-
equals | 比较两个Matrix的数值是否相同
78-
hashCode | 获取Matrix的哈希值
79-
toString | 将Matrix转换为字符串<br/>`Matrix{[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]}`
80-
toShortString | 将Matrix转换为短字符串<br/>`[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]`
75+
**1.equals**
76+
77+
比较两个Matrix的数值是否相同。
78+
79+
**2.hashCode**
80+
81+
获取Matrix的哈希值。
82+
83+
**3.toString**
84+
85+
将Matrix转换为字符串: `Matrix{[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]}`
86+
87+
**4.toShortString**
88+
89+
将Matrix转换为短字符串: `[1.0, 0.0, 0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]`
8190
8291
8392
### 数值操作
8493
94+
数值操作这一组方法可以帮助我们直接控制Matrix里面的数值。
95+
96+
**1.set**
97+
98+
```
99+
void set (Matrix src)
100+
```
101+
102+
没有返回值,有一个参数,作用是将参数Matrix的数值复制到当前Matrix中。如果参数为空,则重置当前Matrix,相当于`reset()`。
103+
104+
**2.reset**
105+
106+
```
107+
void reset ()
108+
```
109+
110+
重置当前Matrix(将当前Matrix重置为单位矩阵)。
111+
112+
**3.setValues**
113+
114+
```
115+
void setValues (float[] values)
116+
```
117+
118+
setValues的参数是浮点型的一维数组,长度需要大于9,拷贝数组中的前9位数值赋值给当前Matrix。
119+
120+
**4.getValues**
121+
122+
```
123+
void getValues (float[] values)
124+
```
125+
126+
很显然,getValues和setValues是一对方法,参数也是浮点型的一维数组,长度需要大于9,将Matrix中的数值拷贝进参数的前9位中。
85127
86128
### 数值计算
87129

0 commit comments

Comments
 (0)