28 start1 = p1->at(0).Position;
29 end1 = p1->at(p1->size() - 1).Position;
30 start2 = p2->at(0).Position;
31 end2 = p2->at(p2->size() - 1).Position;
41 if (pPath->size() < 2)
43 printf(
"ERROR: path is too short\n");
49 for (
auto element : *pPath)
52 element.Position = res;
54 pResulting->push_back(element);
65 if (pPath->size() < 2)
67 printf(
"ERROR: path is too short\n");
73 for (
auto element : *pPath)
76 element.Position = res;
78 pResulting->push_back(element);
94 Eigen::Vector3d betaAxis;
105 Eigen::Vector3d end1_transformed_v, start2_v, end2_v;
106 convert(end1_transformed, end1_transformed_v);
111 Eigen::Vector3d zero = Eigen::Vector3d::Zero();
115 line1 -= end1_transformed_v;
133 Eigen::Vector3d rotated_ab_v;
135 convert(rotated_ab, rotated_ab_v);
139 rotated_ab_v = rot.matrix() * rotated_ab_v;
142 convert(rotated_ab_v, rotated);
150 Eigen::Vector3d sc_v;
155 sc_v = rot.matrix() * sc_v;
172 Eigen::Vector3d& betaAxis)
174 Eigen::Vector3d vector1, vector2;
179 Eigen::Vector3d vector1_xy, vector2_xy;
181 vector1_xy = vector1;
182 vector2_xy = vector2;
188 Eigen::Vector3d normal = Eigen::Vector3d::UnitZ();
190 if (vector1_xy.norm() == 0.0 || vector2_xy.norm() == 0)
200 Eigen::Vector3d rotated1, rotated_y;
207 Eigen::AngleAxisd rotation(fAlpha, Eigen::Vector3d::UnitZ());
209 Eigen::AngleAxisd rotation_yaxis(sc2.
fTheta, Eigen::Vector3d::UnitZ());
212 rotated_y << 0.0, 1.0, 0.0;
217 rotated1 = rotation.matrix() * rotated1;
219 rotated_y = rotation_yaxis.matrix() * rotated_y;
221 betaAxis = rotated_y;
226 fAlpha *= 180.0 /
M_PI;
227 fBeta *= 180.0 /
M_PI;
234 Eigen::Vector3d vector1, vector1_rotated;
238 Eigen::AngleAxisd rotation_alpha(fAlpha / 180.0 *
M_PI, Eigen::Vector3d::UnitZ());
241 vector1_rotated = rotation_alpha.matrix() * vector1;
243 Eigen::AngleAxisd rot(-fBeta / 180.0 *
M_PI, betaAxis);
245 vector1_rotated = rot.matrix() * vector1_rotated;
247 convert(vector1_rotated, result);
256 Eigen::Vector3d betaAxis)
258 Eigen::Vector3d vector1;
262 Eigen::AngleAxisd rot(fBeta / 180.0 *
M_PI, betaAxis);
263 vector1 = rot.matrix() * vector1;
266 Eigen::AngleAxisd rotation_alpha(-fAlpha / 180.0 *
M_PI, Eigen::Vector3d::UnitZ());
269 vector1 = rotation_alpha * vector1;
283 float u1, v1, u2, v2;
290 return u1 * v2 - v1 * u2;
341 Eigen::Vector2d& res)
344 float dx =
float(p1(0) - p2(0));
345 float dy =
float(p1(1) - p2(1));
360 float z =
float(dx - (m1(0) * dy) / m1(1));
361 float n =
float(m2(0) - (m1(0) * m2(1)) / m1(1));
374 res(0) = p2(0) + c2 * m2(0);
375 res(1) = p2(1) + c2 * m2(1);
386 Eigen::Vector3d vector2,
387 Eigen::Vector3d normal)
391 Eigen::Vector3d axis = vector1.cross(vector2);
396 double c = normal.dot(vector1);
399 double d = normal.dot(axis) -
c;
404 return 2 *
M_PI - fAngle;
407 return (
float)fAngle;
413 Eigen::Vector3d linepoint,
414 Eigen::Vector3d linevector)
417 Eigen::Vector3d plane_normal = linevector;
418 float d = (
float)-plane_normal.dot(point);
421 float z =
float(-plane_normal(0) * linepoint(0) - plane_normal(1) * linepoint(1) -
422 plane_normal(2) * linepoint(2) - d);
423 float n =
float(plane_normal(0) * linevector(0) + plane_normal(1) * linevector(1) +
424 plane_normal(2) * linevector(2));
429 linevector = k * linevector;
430 linevector += linepoint;
451 Eigen::Vector3d vector = Eigen::Vector3d::UnitZ();
452 Eigen::AngleAxisd rotation_y(in.
fPhi, Eigen::Vector3d::UnitY());
453 Eigen::AngleAxisd rotation_z(in.
fTheta, Eigen::Vector3d::UnitZ());
457 vector = rotation_y.matrix() * vector;
460 vector = rotation_z.matrix() * vector;
477 out = vec.cast<
float>();
514 if (out.
fPhi > 180.0)
523 Eigen::Vector3d vec(in(0), in(1), in(2));