16 const double &theta) {
18 return std::vector<double>{x[0] * std::cos(theta) + x[1] * std::sin(theta),
19 -x[0] * std::sin(theta) + x[1] * std::cos(theta),
24 const double &theta) {
26 return {x.
d_x * std::cos(theta) + x.
d_y * std::sin(theta),
27 -x.
d_x * std::sin(theta) + x.
d_y * std::cos(theta), 0.0};
32 const double &theta) {
38 const double &theta) {
46 const double &theta) {
48 return std::vector<double>{x[0] * std::cos(theta) - x[1] * std::sin(theta),
49 x[0] * std::sin(theta) + x[1] * std::cos(theta),
54 const double &theta) {
56 return {x.
d_x * std::cos(theta) - x.
d_y * std::sin(theta),
57 x.
d_x * std::sin(theta) + x.
d_y * std::cos(theta), 0.0};
61 const double &theta) {
63 return {-x.
d_x * std::sin(theta) - x.
d_y * std::cos(theta),
64 x.
d_x * std::cos(theta) - x.
d_y * std::sin(theta), 0.0};
69 auto ct = std::cos(theta);
70 auto st = std::sin(theta);
73 double p_dot_n = p * axis;
78 return (1. - ct) * p_dot_n * axis + ct * p + st * n_cross_p;
83 if ((a - b).lengthSq() < 1.0E-12)
93 if ((a - b).lengthSq() < 1.0E-12)
103 double theta = std::atan(b * na / (a * b - (b * n) * (a * n)));
108 theta = M_PI + theta;
113 auto theta =
angle(a, b);
123 double orient = axis * n_ab;
125 return 2. * M_PI - theta;
std::vector< double > rotate2D(const std::vector< double > &x, const double &theta)
Rotates a vector in xy-plane assuming ACW convention.
double angle(util::Point a, util::Point b)
Computes angle between two vectors.
util::Point derRotate2D(const util::Point &x, const double &theta)
Computes derivative of rotation wrt to time.
std::vector< double > rotateACW2D(const std::vector< double > &x, const double &theta)
Rotates a vector in xy-plane in anti-clockwise direction.
std::vector< double > rotateCW2D(const std::vector< double > &x, const double &theta)
Rotates a vector in xy-plane in clockwise direction.
util::Point rotate(const util::Point &p, const double &theta, const util::Point &axis)
Returns the vector after rotating by desired angle.
A structure to represent 3d vectors.
double d_y
the y coordinate
double length() const
Computes the Euclidean length of the vector.
Point cross(const Point &b) const
Computes the cross product between this vector and given vector.
double d_x
the x coordinate