向量场
3D矢量场(流场)的数据结构和查找。
安装
npm install vector-field
用法
参见。
import VectorField from "vector-field" ;
let time = 0 ;
const directionFn = ( [ x , y , z ] ) => {
const n = myNoise4D ( x , y , z , time ) ;
const theta = n ;
const phi = n ;
return [
Math . sin ( theta ) * Math . sin ( phi ) ,
Math . cos ( theta ) ,
Math . sin ( theta ) * Math . cos ( phi )
] ;
} ;
const vectorField = new VectorField ( directionFn , [ 12 , 6 , 6 ] , 1 ) ;
const frame = ( ) => {
time += 0.001 ;