19 bool use_random)
const
41 sample(local, n, phi_min, phi_max, method, use_random);
49 const Vector3d &up)
const
51 Vector3d oUp(Vector3d::UnitZ());
53 double c = oUp.dot(up);
60 Vector3d v = oUp.cross(up);
62 vx << 0, -v(2), v(1), v(2), 0, -v(0), -v(1), v(0), 0;
66 Matrix3d R = Matrix3d::Identity() + vx + vx * vx / (1 + c);
78 bool use_random)
const
83 std::random_device rd;
84 std::mt19937 gen = std::mt19937(rd());
86 double pi_2 = 2.0 * M_PI;
87 double a = phi_min < phi_max ? phi_min : phi_max;
88 double b = phi_min < phi_max ? phi_max : phi_min;
89 std::uniform_real_distribution< double > dis1(0.0, pi_2);
90 std::uniform_real_distribution< double > dis2(a, b);
92 double step1 = pi_2 / (double)n;
93 double step2 = 4.0 * (b - a) / (
double)n;
94 for(
int i = 0; i < n; ++i)
111 samples.row(i) << cos(theta) * sin(phi), sin(theta) * sin(phi), cos(phi);