Processing, 類PVector
中的random2D()
用法介紹。
用法
.random2D()
.random2D(parent)
.random2D(target)
.random2D(target, parent)
參數
parent
(PApplet)
當前的 PApplet 實例target
(PVector)
目標向量(如果為空,將創建一個新向量)
返回
PVector
說明
返回具有隨機方向的新二維單位向量。如果您將this
作為參數傳入,它將使用 PApplet 的隨機數生成器。
例子
PVector v;
void setup() {
v = PVector.random2D();
println(v);
// May print something like:
// [ -0.75006354, -0.6613658, 0.0 ] or
// [ 0.13742635, 0.990512, 0.0 ] or
// [ -0.9456181, -0.32527903, 0.0 ]
}
相關用法
- Processing PVector.random3D()用法及代碼示例
- Processing PVector.rotate()用法及代碼示例
- Processing PVector.set()用法及代碼示例
- Processing PVector.mag()用法及代碼示例
- Processing PVector.normalize()用法及代碼示例
- Processing PVector.limit()用法及代碼示例
- Processing PVector.div()用法及代碼示例
- Processing PVector.cross()用法及代碼示例
- Processing PVector.lerp()用法及代碼示例
- Processing PVector.heading()用法及代碼示例
- Processing PVector.dot()用法及代碼示例
- Processing PVector.magSq()用法及代碼示例
- Processing PVector.dist()用法及代碼示例
- Processing PVector.angleBetween()用法及代碼示例
- Processing PVector.fromAngle()用法及代碼示例
- Processing PVector.z用法及代碼示例
- Processing PVector.y用法及代碼示例
- Processing PVector.x用法及代碼示例
- Processing PVector.setMag()用法及代碼示例
- Processing PVector.array()用法及代碼示例
- Processing PVector.add()用法及代碼示例
- Processing PVector.sub()用法及代碼示例
- Processing PVector.copy()用法及代碼示例
- Processing PVector用法及代碼示例
- Processing Pulse用法及代碼示例
注:本文由純淨天空篩選整理自processing.org大神的英文原創作品 PVector.random2D()。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。