Commit cf6f3b92 by Kenneth Vanhoey

mod on tests for localFrame

parent 5edc0286
 ... @@ -44,13 +44,16 @@ LocalFrame::LocalFrame(const VEC3& compressedFrame) ... @@ -44,13 +44,16 @@ LocalFrame::LocalFrame(const VEC3& compressedFrame) const REAL& thetaT = compressedFrame[2] ; const REAL& thetaT = compressedFrame[2] ; // compute phiT // compute phiT const REAL quot = std::tan(phiN)*(std::cos(thetaN)*std::cos(thetaT) + std::sin(thetaN)*std::sin(thetaT)) ; // Based on orthogonality // const REAL quot = std::tan(phiN)*(std::cos(thetaN)*std::cos(thetaT) + std::sin(thetaN)*std::sin(thetaT)) ; // Based on orthogonality REAL phiT = -std::atan(1/quot) ; // if quot==0, atan returns Pi/2 // REAL phiT = -std::atan(1/quot) ; // if quot==0, atan returns Pi/2 if (phiT < 0.0) { REAL phiT = -std::atan((std::cos(thetaN)*std::cos(thetaT) + std::sin(thetaN)*std::sin(thetaT))*std::cos(phiN) / std::sin(phiN)) ; // if quot==0, atan returns Pi/2 phiT += M_PI ; // = Pi - |phiT| // if (phiT < 0.0) { std::cout << " ; New set = " << compressedFrame << phiT << std::endl ; // phiT += M_PI ; // = Pi - |phiT| // std::cout << compressedFrame << phiT << std::endl ; // std::cout << compressedFrame << phiT << std::endl ; // std::cout << "New phiT = " << -std::atan(1/Den) << std::endl ; // std::cout << "New phiT = " << -std::atan(1/Den) << std::endl ; } // } VEC2 Nspher(thetaN,phiN) ; VEC2 Nspher(thetaN,phiN) ; VEC2 Tspher(thetaT,phiT) ; VEC2 Tspher(thetaT,phiT) ; ... @@ -80,7 +83,9 @@ typename PFP::VEC3 LocalFrame::getCompressed() const ... @@ -80,7 +83,9 @@ typename PFP::VEC3 LocalFrame::getCompressed() const thetaN = Nspher[0] ; thetaN = Nspher[0] ; phiN = Nspher[1] ; phiN = Nspher[1] ; thetaT = Tspher[0] ; thetaT = Tspher[0] ; std::cout << "Original phiT: " << Tspher[1] << std::endl ; //if (thetaT == 0.0 && phiN == 0.0) //phiN = (Tspher[1] > 0 ? -1 : 1) * 1e-8 ; std::cout << "Original Set: " << res << Tspher[1] ; return res ; return res ; } } ... @@ -92,11 +97,6 @@ bool LocalFrame::equals(const Utils::LocalFrame& lf, REAL epsilon) con ... @@ -92,11 +97,6 @@ bool LocalFrame::equals(const Utils::LocalFrame& lf, REAL epsilon) con VEC3 dB = m_B - lf.getB() ; VEC3 dB = m_B - lf.getB() ; VEC3 dN = m_N - lf.getN() ; VEC3 dN = m_N - lf.getN() ; if (dT.norm2() > epsilon) std::cout << dT.norm2() << std::endl ; if (dB.norm2() > epsilon) std::cout << dB.norm2() << std::endl ; return dT.norm2() < epsilon && dB.norm2() < epsilon && dN.norm2() < epsilon ; return dT.norm2() < epsilon && dB.norm2() < epsilon && dN.norm2() < epsilon ; } } ... @@ -155,8 +155,12 @@ typename Geom::Vector<2,typename PFP::REAL> LocalFrame::carthToSpherical (c ... @@ -155,8 +155,12 @@ typename Geom::Vector<2,typename PFP::REAL> LocalFrame::carthToSpherical (c if (isnan(theta)) if (isnan(theta)) theta = 0.0 ; theta = 0.0 ; REAL phi = std::acos(z) ; REAL phi = std::asin(z) ; /* if (phi < -1.57) std::cout << theta << std::endl ; if (phi > 1.57) std::cout << theta << std::endl ; */ res[0] = theta ; res[0] = theta ; res[1] = phi ; res[1] = phi ; ... @@ -175,9 +179,9 @@ typename PFP::VEC3 LocalFrame::sphericalToCarth (const VEC2& sph) const ... @@ -175,9 +179,9 @@ typename PFP::VEC3 LocalFrame::sphericalToCarth (const VEC2& sph) const REAL& y = res[1] ; REAL& y = res[1] ; REAL& z = res[2] ; REAL& z = res[2] ; x = cos(theta)*sin(phi) ; x = cos(theta)*cos(phi) ; y = sin(theta)*sin(phi) ; y = sin(theta)*cos(phi) ; z = cos(phi) ; z = sin(phi) ; assert(-1.000001 < x && x < 1.000001) ; assert(-1.000001 < x && x < 1.000001) ; assert(-1.000001 < y && y < 1.000001) ; assert(-1.000001 < y && y < 1.000001) ; ... ...
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment