Processing, 類PVector
中的mag()
用法介紹。
用法
.mag()
返回
float
說明
計算向量的大小(長度)並將結果作為浮點數返回(這隻是等式 sqrt(x*x + y*y + z*z)
。)
例子
PVector v;
void setup() {
size(100, 100);
v = new PVector(20.0, 30.0, 40.0);
float m = v.mag();
println(m); // Prints "53.851646"
}
有關的
相關用法
- Processing PVector.magSq()用法及代碼示例
- Processing PVector.set()用法及代碼示例
- Processing PVector.normalize()用法及代碼示例
- Processing PVector.limit()用法及代碼示例
- Processing PVector.div()用法及代碼示例
- Processing PVector.cross()用法及代碼示例
- Processing PVector.random2D()用法及代碼示例
- Processing PVector.lerp()用法及代碼示例
- Processing PVector.heading()用法及代碼示例
- Processing PVector.dot()用法及代碼示例
- Processing PVector.dist()用法及代碼示例
- Processing PVector.angleBetween()用法及代碼示例
- Processing PVector.fromAngle()用法及代碼示例
- Processing PVector.random3D()用法及代碼示例
- Processing PVector.z用法及代碼示例
- Processing PVector.y用法及代碼示例
- Processing PVector.x用法及代碼示例
- Processing PVector.setMag()用法及代碼示例
- Processing PVector.array()用法及代碼示例
- Processing PVector.rotate()用法及代碼示例
- Processing PVector.add()用法及代碼示例
- Processing PVector.sub()用法及代碼示例
- Processing PVector.copy()用法及代碼示例
- Processing PVector用法及代碼示例
- Processing Pulse用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 PVector.mag()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。