I will preface this question with, I wish I understood quaternions better. Any great visual explanations on how to use quaternions please post
ok,
I want to figure out the right way to solve this. The goal is to create a random vector in a cone with a direction, or a vector from with a limited range. I think the illustration will help. Also this d3 example kinda explains it.
I made something cool but not right at all.
basically doing this (note I know this is wrong):
int n = 10;
for(int i=0; i<n; i++) {
for(int j=0; j<n; j++) {
float rx = ofMap(i, 0, n-1, -x, x);
float ry = ofMap(j, 0, n-1, -y, y);
ofVec3f v = normal; // a - b
v.rotate(rx, ofVec3f(1, 0, 0));
v.rotate(ry, ofVec3f(0, 1, 0));
samples.addVertex(pos - v);
}
}
Any thoughts on a direction (haha) to solve this?