| 219 | } |
| 220 | |
| 221 | bool GlareSensor_Impl::aimAt(const Point3d& target) { |
| 222 | Point3d position = this->position(); |
| 223 | Vector3d vector = target - position; |
| 224 | |
| 225 | if (!vector.normalize()) { |
| 226 | return false; |
| 227 | } |
| 228 | |
| 229 | Vector3d yAxis(0, 1, 0); |
| 230 | Vector3d rotationAxis = yAxis.cross(vector); |
| 231 | |
| 232 | if (!rotationAxis.normalize()) { |
| 233 | return false; |
| 234 | } |
| 235 | |
| 236 | double angle = getAngle(yAxis, vector); |
| 237 | Transformation transformation = Transformation::rotation(rotationAxis, angle); |
| 238 | EulerAngles eulerAngles = transformation.eulerAngles(); |
| 239 | |
| 240 | this->setPsiRotationAroundXAxis(eulerAngles.psi()); |
| 241 | this->setThetaRotationAroundYAxis(eulerAngles.theta()); |
| 242 | this->setPhiRotationAroundZAxis(eulerAngles.phi()); |
| 243 | |
| 244 | return true; |
| 245 | } |
| 246 | |
| 247 | //bool GlareSensor_Impl::isPrimaryGlareSensor() const |
| 248 | //{ |