/* -*- C++ -*- * Copyright ©2004 Hugo Mills * * This software is distributed under the terms of the GNU GPL v3 * For more information on the GPL, see the file COPYING or * visit http://www.gnu.org/ * * This software is distributed without warranty */ #include "magellan/xfsphere.h" bool XfSphere::f(dvec3& result, const dvec2& ll) const { double cy = cos(ll[1]); result[0] = sin(ll[0])*cy; result[1] = sin(ll[1]); result[2] = cos(ll[0])*cy; return true; } bool XfSphere::g(dvec2& result, const dvec3& p) const { // Assume normalised here? // Best not to, but it's slower... // Assumed normalised for the moment. result[0] = atan2(p[0], p[2]); // Doesn't matter about normalisation result[1] = asin(p[1]); // Does matter about normalisation return true; }