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

Method aimAt

src/model/GlareSensor.cpp:221–245  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 //{

Callers 1

TEST_FFunction · 0.45

Calls 11

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

Tested by 1

TEST_FFunction · 0.36