forked from christophersanborn/Radiative3D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathraypath.cpp
26 lines (22 loc) · 799 Bytes
/
raypath.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// raypath.cpp
//
#include "raypath.hpp"
Real RayArcAttributes::AngleOffsetFromBottom(const R3::XYZ & loc) const {
const R3::XYZ centerToLoc = Center.VectorTo(loc);
const Real loctanx = u3.Dot(centerToLoc);
const Real loctany = u1.Dot(centerToLoc);
return atan2(loctany,loctanx);
}
R3::XYZ RayArcAttributes::PositionFromAngle(Real angle) const {
return Center + u1.ScaledBy(Radius*sin(angle))
+ u3.ScaledBy(Radius*cos(angle));
}
R3::XYZ RayArcAttributes::DirectionFromAngle(Real angle) const {
return u1.ScaledBy(cos(angle)) + u3.ScaledBy(-sin(angle));
}
std::string RayArcAttributes::str() const {
std::ostringstream s;
s << "{RayArc:"<<" {Radius: "<<Radius<<" @ Center: "<<Center.str()<<""
<<" u1: "<<u1.str()<<" u3: "<<u3.str()<<"}}";
return s.str();
}