#ifndef _utl_GeometryUtilities_h_ #define _utl_GeometryUtilities_h_ /** \file Collection of geometry related utilities \author Lukas Nellen \author Darko Veberic \author Stefanie Falk \version $Id: GeometryUtilities.h 21217 2012-05-25 12:45:23Z darko $ \date 30 Jan 2004 \date 16 Jun 2006 Plane, Line \date 03 May 2012 RefEllipsoid, Line */ #include #include #include #include static const char CVSId_utl_GeometryUtilities[] = "$Id: GeometryUtilities.h 21217 2012-05-25 12:45:23Z darko $"; namespace utl { class ReferenceEllipsoid; namespace GeometryUtilities { /*! Normalize angle to lie between -pi and pi \ingroup geometry */ double NormalizeAngle(const double theAngle); // intersection /*! Compute the intersection between two planes. \ingroup geometry */ Line Intersection(const Plane& p1, const Plane& p2); /*! Compute the intersection between a plane and a line. \ingroup geometry */ Point Intersection(const Plane& plane, const Line& line); /*! Compute the intersection between a line and a plane. \ingroup geometry */ inline Point Intersection(const Line& line, const Plane& plane) { return Intersection(plane, line); } /*! Compute the intersection between a line and an ellipsoid with some height \ingroup geometry */ std::vector Intersection(const ReferenceEllipsoid&, const double height, const Line& line); // distance /*! Compute the distance between two lines. \ingroup geometry */ double Distance(const Line& line1, const Line& line2); /*! Compute the distance between a point and a line. \ingroup geometry */ double Distance(const Point& point, const Line& line); /*! Compute the distance between a line and a point. \ingroup geometry */ inline double Distance(const Line& line, const Point& point) { return Distance(point, line); } /*! Compute the distance between a point and a plane. \ingroup geometry */ inline double Distance(const Point& point, const Plane& plane) { return (point - plane.GetAnchor())*plane.GetNormal(); } /*! Compute the distance between a plane and a point. \ingroup geometry */ inline double Distance(const Plane& plane, const Point& point) { return Distance(point, plane); } // projection /*! Compute the projection of a point on a plane. \ingroup geometry */ inline Point PerpendicularProjection(const Point& point, const Plane& plane) { return point - Distance(point, plane)*plane.GetNormal(); } /*! Compute the projection of a point on a plane. \ingroup geometry */ inline Point PerpendicularProjection(const Plane& plane, const Point& point) { return PerpendicularProjection(point, plane); } } // namespace GeometryUtilities } // utl #endif // _utl_GeometryUtilities_h_ // Configure (x)emacs for this file ... // Local Variables: // mode:c++ // compile-command: "make -C .. -k" // End: