MCPcopy Create free account
hub / github.com/NatLabRockies/OpenStudio / aimAt

Method aimAt

src/model/DaylightingControl.cpp:378–402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

376 }
377
378 bool DaylightingControl_Impl::aimAt(const Point3d& target) {
379 Point3d position = this->position();
380 Vector3d vector = target - position;
381
382 if (!vector.normalize()) {
383 return false;
384 }
385
386 Vector3d yAxis(0, 1, 0);
387 Vector3d rotationAxis = yAxis.cross(vector);
388
389 if (!rotationAxis.normalize()) {
390 return false;
391 }
392
393 double angle = getAngle(yAxis, vector);
394 Transformation transformation = Transformation::rotation(rotationAxis, angle);
395 EulerAngles eulerAngles = transformation.eulerAngles();
396
397 this->setPsiRotationAroundXAxis(radToDeg(eulerAngles.psi()));
398 this->setThetaRotationAroundYAxis(radToDeg(eulerAngles.theta()));
399 this->setPhiRotationAroundZAxis(radToDeg(eulerAngles.phi()));
400
401 return true;
402 }
403
404 int DaylightingControl_Impl::spaceIndex() const {
405 return OS_Daylighting_ControlFields::SpaceName;

Callers

nothing calls this directly

Calls 12

positionMethod · 0.95
getAngleFunction · 0.85
radToDegFunction · 0.85
crossMethod · 0.80
eulerAnglesMethod · 0.80
psiMethod · 0.80
thetaMethod · 0.80
phiMethod · 0.80
normalizeMethod · 0.45

Tested by

no test coverage detected