
二次元平面上でパーティクルを動かし、それを三次元の球面上で動かすことを考えます。
単位ベクトルを使う
Mover.pde
void display() {
// 位置に合わせて色を変える
stroke(255 * location.x / width,255 * location.y / height,255 * location.z / width);
strokeWeight(1);
fill(175);
PVector l = location.get();
// 単位ベクトルにする
l.normalize();
// 球の半径だけ伸ばす
l.mult(300);
// 中心付近に移動
l.add(width, 0, 0);
point(l.x, l.y, l.z);
}