// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Library General Public License for more details.
//
-// You should have received a copy of the GNU Library General Public
-// License along with this library; if not, write to the
-// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-// Boston, MA 02111-1307, USA.
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
//
// $Id$
#define _POINT3D_HXX
-#ifndef __cplusplus
+#ifndef __cplusplus
# error This library requires C++
-#endif
+#endif
#include <simgear/compiler.h>
static Point3D fromSGGeod(const SGGeod& geod);
static Point3D fromSGGeoc(const SGGeoc& geoc);
static Point3D fromSGVec3(const SGVec3<double>& cart);
+ static Point3D fromSGVec3(const SGVec3<float>& cart);
+ static Point3D fromSGVec2(const SGVec2<double>& cart);
// Assignment operators
SGGeod toSGGeod(void) const;
SGGeoc toSGGeoc(void) const;
+ SGVec3d toSGVec3d(void) const;
+ SGVec3f toSGVec3f(void) const;
+ SGVec2f toSGVec2f(void) const;
+
// friends
friend Point3D operator - (const Point3D& p); // -p1
friend bool operator == (const Point3D& a, const Point3D& b); // p1 == p2?
return pt;
}
+inline Point3D Point3D::fromSGVec3(const SGVec3<float>& cart)
+{
+ Point3D pt;
+ pt.setx(cart.x());
+ pt.sety(cart.y());
+ pt.setz(cart.z());
+ return pt;
+}
+
+inline Point3D Point3D::fromSGVec2(const SGVec2<double>& cart)
+{
+ Point3D pt;
+ pt.setx(cart.x());
+ pt.sety(cart.y());
+ pt.setz(0);
+ return pt;
+}
+
// ASSIGNMENT OPERATORS
inline Point3D& Point3D::operator = (const Point3D& p)
return geoc;
}
+inline SGVec3d Point3D::toSGVec3d(void) const
+{
+ return SGVec3d(x(), y(), z());
+}
+
+inline SGVec3f Point3D::toSGVec3f(void) const
+{
+ return SGVec3f(x(), y(), z());
+}
+
+inline SGVec2f Point3D::toSGVec2f(void) const
+{
+ return SGVec2f(x(), y());
+}
+
// FRIENDS
inline Point3D operator - (const Point3D& a)