|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r72233 - in trunk: boost/geometry/core boost/geometry/strategies boost/geometry/strategies/agnostic boost/geometry/strategies/cartesian boost/geometry/strategies/spherical libs/geometry/doc/src/examples libs/geometry/doc/src/examples/algorithms libs/geometry/doc/src/examples/core libs/geometry/example libs/geometry/test libs/geometry/test/algorithms libs/geometry/test/strategies libs/geometry/test_extensions/gis/latlong
From: barend.gehrels_at_[hidden]
Date: 2011-05-27 18:01:09
Author: barendgehrels
Date: 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
New Revision: 72233
URL: http://svn.boost.org/trac/boost/changeset/72233
Log:
Spherical coordinate systems: splitted into "polar" and "equatorial" with opposite (co)latitude
Added:
trunk/libs/geometry/test/strategies/spherical_side.cpp
- copied, changed from r72057, /trunk/libs/geometry/test/strategies/side_by_cross_track.cpp
trunk/libs/geometry/test/strategies/spherical_side.vcproj
- copied, changed from r72057, /trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj
Removed:
trunk/libs/geometry/test/strategies/side_by_cross_track.cpp
trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj
Text files modified:
trunk/boost/geometry/core/cs.hpp | 30 +++++++++
trunk/boost/geometry/core/tags.hpp | 8 ++
trunk/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp | 8 ++
trunk/boost/geometry/strategies/cartesian/side_by_triangle.hpp | 1
trunk/boost/geometry/strategies/spherical/area_huiller.hpp | 21 +++++-
trunk/boost/geometry/strategies/spherical/compare_circular.hpp | 4
trunk/boost/geometry/strategies/spherical/distance_cross_track.hpp | 61 +++++++++++++++++++-
trunk/boost/geometry/strategies/spherical/distance_haversine.hpp | 7 +
trunk/boost/geometry/strategies/strategy_transform.hpp | 27 +++++----
trunk/libs/geometry/doc/src/examples/algorithms/area.cpp | 4
trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp | 4
trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp | 2
trunk/libs/geometry/doc/src/examples/algorithms/transform.cpp | 9 +-
trunk/libs/geometry/doc/src/examples/core/degree_radian.cpp | 4
trunk/libs/geometry/doc/src/examples/quick_start.cpp | 2
trunk/libs/geometry/example/06_a_transformation_example.cpp | 2
trunk/libs/geometry/example/07_a_graph_route_example.cpp | 2
trunk/libs/geometry/example/07_b_graph_route_example.cpp | 4
trunk/libs/geometry/test/algorithms/area.cpp | 28 +++++++++
trunk/libs/geometry/test/algorithms/simplify.cpp | 4
trunk/libs/geometry/test/algorithms/test_area.hpp | 1
trunk/libs/geometry/test/geometry_test_common.hpp | 23 ++++++++
trunk/libs/geometry/test/strategies/cross_track.cpp | 26 ++++----
trunk/libs/geometry/test/strategies/haversine.cpp | 38 +++++++------
trunk/libs/geometry/test/strategies/segment_intersection.cpp | 2
trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp | 2
trunk/libs/geometry/test/strategies/spherical_side.cpp | 113 ++++++++++++++++++++++++++++++++++-----
trunk/libs/geometry/test/strategies/spherical_side.vcproj | 10 +-
trunk/libs/geometry/test/strategies/strategies_tests.sln | 2
trunk/libs/geometry/test_extensions/gis/latlong/andoyer.vcproj | 8 +-
trunk/libs/geometry/test_extensions/gis/latlong/area_ll.cpp | 3
trunk/libs/geometry/test_extensions/gis/latlong/area_ll.vcproj | 8 +-
trunk/libs/geometry/test_extensions/gis/latlong/cross_track.vcproj | 8 +-
trunk/libs/geometry/test_extensions/gis/latlong/distance_mixed.vcproj | 4
trunk/libs/geometry/test_extensions/gis/latlong/parse.vcproj | 4
trunk/libs/geometry/test_extensions/gis/latlong/parse_dms.vcproj | 4
trunk/libs/geometry/test_extensions/gis/latlong/point_ll.vcproj | 4
trunk/libs/geometry/test_extensions/gis/latlong/vincenty.vcproj | 8 +-
38 files changed, 372 insertions(+), 128 deletions(-)
Modified: trunk/boost/geometry/core/cs.hpp
==============================================================================
--- trunk/boost/geometry/core/cs.hpp (original)
+++ trunk/boost/geometry/core/cs.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -79,7 +79,7 @@
/*!
-\brief Spherical coordinate system, in degree or in radian
+\brief Spherical (polar) coordinate system, in degree or in radian
\details Defines the spherical coordinate system where points are
defined in two angles
and an optional radius usually known as r, theta, phi
@@ -102,6 +102,25 @@
typedef DegreeOrRadian units;
};
+
+/*!
+\brief Spherical equatorial coordinate system, in degree or in radian
+\details This one resembles the geographic coordinate system, and has latitude
+ up from zero at the equator, to 90 at the pole
+ (opposite to the spherical(polar) coordinate system).
+ Used in astronomy and in GIS (but there is also the geographic)
+
+\see http://en.wikipedia.org/wiki/Spherical_coordinates
+\ingroup cs
+*/
+template<typename DegreeOrRadian>
+struct spherical_equatorial
+{
+ typedef DegreeOrRadian units;
+};
+
+
+
/*!
\brief Polar coordinate system
\details Defines the polar coordinate system "in which each point
@@ -144,9 +163,16 @@
template<typename DegreeOrRadian>
struct cs_tag<cs::spherical<DegreeOrRadian> >
{
- typedef spherical_tag type;
+ typedef spherical_polar_tag type;
};
+template<typename DegreeOrRadian>
+struct cs_tag<cs::spherical_equatorial<DegreeOrRadian> >
+{
+ typedef spherical_equatorial_tag type;
+};
+
+
template<>
struct cs_tag<cs::cartesian>
{
Modified: trunk/boost/geometry/core/tags.hpp
==============================================================================
--- trunk/boost/geometry/core/tags.hpp (original)
+++ trunk/boost/geometry/core/tags.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -24,11 +24,15 @@
/// Tag indicating Cartesian coordinate system family (cartesian,epsg)
struct cartesian_tag {};
+/// Tag indicating Spherical polar coordinate system family
+struct spherical_polar_tag {};
+
+/// Tag indicating Spherical equatorial coordinate system family
+struct spherical_equatorial_tag {};
+
/// Tag indicating Geographic coordinate system family (geographic)
struct geographic_tag {};
-/// Tag indicating Spherical coordinate system family (spherical,celestial,...)
-struct spherical_tag {};
// Tags defining tag hierarchy
Modified: trunk/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp
==============================================================================
--- trunk/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp (original)
+++ trunk/boost/geometry/strategies/agnostic/point_in_poly_winding.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -188,7 +188,13 @@
};
template <typename Point, typename PointOfSegment>
-struct default_strategy<point_tag, areal_tag, spherical_tag, spherical_tag, Point, PointOfSegment>
+struct default_strategy<point_tag, areal_tag, spherical_polar_tag, spherical_polar_tag, Point, PointOfSegment>
+{
+ typedef winding<Point, PointOfSegment> type;
+};
+
+template <typename Point, typename PointOfSegment>
+struct default_strategy<point_tag, areal_tag, spherical_equatorial_tag, spherical_equatorial_tag, Point, PointOfSegment>
{
typedef winding<Point, PointOfSegment> type;
};
Modified: trunk/boost/geometry/strategies/cartesian/side_by_triangle.hpp
==============================================================================
--- trunk/boost/geometry/strategies/cartesian/side_by_triangle.hpp (original)
+++ trunk/boost/geometry/strategies/cartesian/side_by_triangle.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -21,6 +21,7 @@
#include <boost/geometry/util/select_coordinate_type.hpp>
+#include <boost/geometry/strategies/side.hpp>
namespace boost { namespace geometry
Modified: trunk/boost/geometry/strategies/spherical/area_huiller.hpp
==============================================================================
--- trunk/boost/geometry/strategies/spherical/area_huiller.hpp (original)
+++ trunk/boost/geometry/strategies/spherical/area_huiller.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -45,6 +45,8 @@
and works well in most cases but not in 180 meridian crossing cases. This probably
could be solved.
+\note This version is made for spherical equatorial coordinate systems
+
\qbk{
[heading Example]
@@ -161,11 +163,20 @@
namespace services
{
- template <typename Point>
- struct default_strategy<spherical_tag, Point>
- {
- typedef strategy::area::huiller<Point> type;
- };
+
+
+template <typename Point>
+struct default_strategy<spherical_equatorial_tag, Point>
+{
+ typedef strategy::area::huiller<Point> type;
+};
+
+// Note: spherical polar coordinate system requires "get_as_radian_equatorial"
+/***template <typename Point>
+struct default_strategy<spherical_polar_tag, Point>
+{
+ typedef strategy::area::huiller<Point> type;
+};***/
} // namespace services
Modified: trunk/boost/geometry/strategies/spherical/compare_circular.hpp
==============================================================================
--- trunk/boost/geometry/strategies/spherical/compare_circular.hpp (original)
+++ trunk/boost/geometry/strategies/spherical/compare_circular.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -117,7 +117,7 @@
template<typename> class CoordinateSystem,
typename Units
>
-struct strategy_compare<spherical_tag, 1, Point, CoordinateSystem<Units>, 0>
+struct strategy_compare<spherical_polar_tag, 1, Point, CoordinateSystem<Units>, 0>
{
typedef typename coordinate_type<Point>::type coordinate_type;
typedef strategy::compare::circular_comparator
@@ -134,7 +134,7 @@
template<typename> class CoordinateSystem,
typename Units
>
-struct strategy_compare<spherical_tag, -1, Point, CoordinateSystem<Units>, 0>
+struct strategy_compare<spherical_polar_tag, -1, Point, CoordinateSystem<Units>, 0>
{
typedef typename coordinate_type<Point>::type coordinate_type;
typedef strategy::compare::circular_comparator
Modified: trunk/boost/geometry/strategies/spherical/distance_cross_track.hpp
==============================================================================
--- trunk/boost/geometry/strategies/spherical/distance_cross_track.hpp (original)
+++ trunk/boost/geometry/strategies/spherical/distance_cross_track.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -219,7 +219,12 @@
};
-template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+template
+<
+ typename Point, typename PointOfSegment,
+ typename CalculationType,
+ typename Strategy
+>
struct get_comparable<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
typedef typename comparable_type
@@ -234,7 +239,12 @@
};
-template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+template
+<
+ typename Point, typename PointOfSegment,
+ typename CalculationType,
+ typename Strategy
+>
struct result_from_distance<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
private :
@@ -248,7 +258,12 @@
};
-template <typename Point, typename PointOfSegment, typename CalculationType, typename Strategy>
+template
+<
+ typename Point, typename PointOfSegment,
+ typename CalculationType,
+ typename Strategy
+>
struct strategy_point_point<cross_track<Point, PointOfSegment, CalculationType, Strategy> >
{
typedef Strategy type;
@@ -256,9 +271,17 @@
+/*
+
+TODO: spherical polar coordinate system requires "get_as_radian_equatorial<>"
template <typename Point, typename PointOfSegment, typename Strategy>
-struct default_strategy<segment_tag, Point, PointOfSegment, spherical_tag, spherical_tag, Strategy>
+struct default_strategy
+ <
+ segment_tag, Point, PointOfSegment,
+ spherical_polar_tag, spherical_polar_tag,
+ Strategy
+ >
{
typedef cross_track
<
@@ -271,12 +294,40 @@
typename default_strategy
<
point_tag, Point, PointOfSegment,
- spherical_tag, spherical_tag
+ spherical_polar_tag, spherical_polar_tag
>::type,
Strategy
>::type
> type;
};
+*/
+
+template <typename Point, typename PointOfSegment, typename Strategy>
+struct default_strategy
+ <
+ segment_tag, Point, PointOfSegment,
+ spherical_equatorial_tag, spherical_equatorial_tag,
+ Strategy
+ >
+{
+ typedef cross_track
+ <
+ Point,
+ PointOfSegment,
+ void,
+ typename boost::mpl::if_
+ <
+ boost::is_void<Strategy>,
+ typename default_strategy
+ <
+ point_tag, Point, PointOfSegment,
+ spherical_equatorial_tag, spherical_equatorial_tag
+ >::type,
+ Strategy
+ >::type
+ > type;
+};
+
} // namespace services
Modified: trunk/boost/geometry/strategies/spherical/distance_haversine.hpp
==============================================================================
--- trunk/boost/geometry/strategies/spherical/distance_haversine.hpp (original)
+++ trunk/boost/geometry/strategies/spherical/distance_haversine.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -306,13 +306,16 @@
};
-// Register it as the default for point-types in a spherical coordinate system
+// Register it as the default for point-types
+// in a spherical equatorial coordinate system
template <typename Point1, typename Point2>
-struct default_strategy<point_tag, Point1, Point2, spherical_tag, spherical_tag>
+struct default_strategy<point_tag, Point1, Point2, spherical_equatorial_tag, spherical_equatorial_tag>
{
typedef strategy::distance::haversine<Point1, Point2> type;
};
+// Note: spherical polar coordinate system requires "get_as_radian_equatorial"
+
} // namespace services
#endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS
Modified: trunk/boost/geometry/strategies/strategy_transform.hpp
==============================================================================
--- trunk/boost/geometry/strategies/strategy_transform.hpp (original)
+++ trunk/boost/geometry/strategies/strategy_transform.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -160,6 +160,9 @@
assert_dimension<P, 3>();
// http://en.wikipedia.org/wiki/List_of_canonical_coordinate_transformations#From_spherical_coordinates
+ // http://www.vias.org/comp_geometry/math_coord_convert_3d.htm
+ // https://moodle.polymtl.ca/file.php/1183/Autres_Documents/Derivation_for_Spherical_Co-ordinates.pdf
+
// Phi = first, theta is second, r is third, see documentation on cs::spherical
// (calculations are splitted to implement ttmath)
@@ -230,7 +233,7 @@
\tparam P2 second point type
*/
template <typename P1, typename P2>
-struct from_spherical_2_to_cartesian_3
+struct from_spherical_polar_2_to_cartesian_3
{
inline bool apply(P1 const& p1, P2& p2) const
{
@@ -247,7 +250,7 @@
\tparam P2 second point type
*/
template <typename P1, typename P2>
-struct from_spherical_3_to_cartesian_3
+struct from_spherical_polar_3_to_cartesian_3
{
inline bool apply(P1 const& p1, P2& p2) const
{
@@ -267,7 +270,7 @@
\note If x,y,z point is not lying on unit sphere, transformation will return false
*/
template <typename P1, typename P2>
-struct from_cartesian_3_to_spherical_2
+struct from_cartesian_3_to_spherical_polar_2
{
inline bool apply(P1 const& p1, P2& p2) const
{
@@ -284,7 +287,7 @@
\tparam P2 second point type
*/
template <typename P1, typename P2>
-struct from_cartesian_3_to_spherical_3
+struct from_cartesian_3_to_spherical_polar_3
{
inline bool apply(P1 const& p1, P2& p2) const
{
@@ -343,30 +346,30 @@
/// Specialization to transform from unit sphere(phi,theta) to XYZ
template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
-struct default_strategy<spherical_tag, cartesian_tag, CoordSys1, CoordSys2, 2, 3, P1, P2>
+struct default_strategy<spherical_polar_tag, cartesian_tag, CoordSys1, CoordSys2, 2, 3, P1, P2>
{
- typedef from_spherical_2_to_cartesian_3<P1, P2> type;
+ typedef from_spherical_polar_2_to_cartesian_3<P1, P2> type;
};
/// Specialization to transform from sphere(phi,theta,r) to XYZ
template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
-struct default_strategy<spherical_tag, cartesian_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
+struct default_strategy<spherical_polar_tag, cartesian_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
{
- typedef from_spherical_3_to_cartesian_3<P1, P2> type;
+ typedef from_spherical_polar_3_to_cartesian_3<P1, P2> type;
};
/// Specialization to transform from XYZ to unit sphere(phi,theta)
template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
-struct default_strategy<cartesian_tag, spherical_tag, CoordSys1, CoordSys2, 3, 2, P1, P2>
+struct default_strategy<cartesian_tag, spherical_polar_tag, CoordSys1, CoordSys2, 3, 2, P1, P2>
{
- typedef from_cartesian_3_to_spherical_2<P1, P2> type;
+ typedef from_cartesian_3_to_spherical_polar_2<P1, P2> type;
};
/// Specialization to transform from XYZ to sphere(phi,theta,r)
template <typename CoordSys1, typename CoordSys2, typename P1, typename P2>
-struct default_strategy<cartesian_tag, spherical_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
+struct default_strategy<cartesian_tag, spherical_polar_tag, CoordSys1, CoordSys2, 3, 3, P1, P2>
{
- typedef from_cartesian_3_to_spherical_3<P1, P2> type;
+ typedef from_cartesian_3_to_spherical_polar_3<P1, P2> type;
};
Modified: trunk/libs/geometry/doc/src/examples/algorithms/area.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/area.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/area.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -27,8 +27,8 @@
double area = bg::area(poly);
std::cout << "Area: " << area << std::endl;
- // Calculate the area of a spherical polygon
- bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical<bg::degree> > > sph_poly;
+ // Calculate the area of a spherical equatorial polygon
+ bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
area = bg::area(sph_poly);
std::cout << "Area: " << area << std::endl;
Modified: trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/area_with_strategy.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -27,8 +27,8 @@
double area = bg::area(poly);
std::cout << "Area: " << area << std::endl;
- // Calculate the area of a spherical polygon
- bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical<bg::degree> > > sph_poly;
+ // Calculate the area of a spherical polygon (for latitude: 0 at equator)
+ bg::model::polygon<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> > > sph_poly;
bg::read_wkt("POLYGON((0 0,0 45,45 0,0 0))", sph_poly);
area = bg::area(sph_poly);
std::cout << "Area: " << area << std::endl;
Modified: trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/length_with_strategy.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -17,7 +17,7 @@
int main()
{
using namespace boost::geometry;
- typedef model::point<float, 2, cs::spherical<degree> > P;
+ typedef model::point<float, 2, cs::spherical_equatorial<degree> > P;
model::linestring<P> line;
line.push_back(P(2, 41));
line.push_back(P(2, 48));
Modified: trunk/libs/geometry/doc/src/examples/algorithms/transform.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/algorithms/transform.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/algorithms/transform.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -18,7 +18,8 @@
{
namespace bg = boost::geometry;
- bg::model::point<long double, 2, bg::cs::spherical<bg::degree> > p1(5.0, 52.0);
+ // Select a point near the pole (theta=5.0, phi=15.0)
+ bg::model::point<long double, 2, bg::cs::spherical<bg::degree> > p1(15.0, 5.0);
// Transform from degree to radian. Default strategy is automatically selected,
// it will convert from degree to radian
@@ -45,9 +46,9 @@
/*`
Output:
[pre
-p1: (5, 52)
-p2: (0.0872665, 0.907571)
-p3: (0.785012, 0.0686797, 0.615661)
+p1: (15, 5)
+p2: (0.261799, 0.0872665)
+p3: (0.084186, 0.0225576, 0.996195)
]
*/
//]
Modified: trunk/libs/geometry/doc/src/examples/core/degree_radian.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/core/degree_radian.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/core/degree_radian.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -17,8 +17,8 @@
int main()
{
- typedef model::point<double, 2, cs::spherical<degree> > degree_point;
- typedef model::point<double, 2, cs::spherical<radian> > radian_point;
+ typedef model::point<double, 2, cs::spherical_equatorial<degree> > degree_point;
+ typedef model::point<double, 2, cs::spherical_equatorial<radian> > radian_point;
degree_point d(4.893, 52.373);
radian_point r(0.041, 0.8527);
Modified: trunk/libs/geometry/doc/src/examples/quick_start.cpp
==============================================================================
--- trunk/libs/geometry/doc/src/examples/quick_start.cpp (original)
+++ trunk/libs/geometry/doc/src/examples/quick_start.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -135,7 +135,7 @@
//[quick_start_spherical
typedef boost::geometry::model::point
<
- double, 2, boost::geometry::cs::spherical<boost::geometry::degree>
+ double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree>
> spherical_point;
spherical_point amsterdam(4.90, 52.37);
Modified: trunk/libs/geometry/example/06_a_transformation_example.cpp
==============================================================================
--- trunk/libs/geometry/example/06_a_transformation_example.cpp (original)
+++ trunk/libs/geometry/example/06_a_transformation_example.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -50,7 +50,7 @@
// - from Cartesian to Spherical coordinate systems and back
// - from Cartesian to Cartesian (mapping, affine transformations) and back (inverse)
// - Map Projections
- // - from Degree to Radian and back in spherical or geographic coordinate systems
+ // - from Degree to Radian and back in spherical_equatorial or geographic coordinate systems
return 0;
}
Modified: trunk/libs/geometry/example/07_a_graph_route_example.cpp
==============================================================================
--- trunk/libs/geometry/example/07_a_graph_route_example.cpp (original)
+++ trunk/libs/geometry/example/07_a_graph_route_example.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -267,7 +267,7 @@
// (geographic calculations are in an extension; for sample it makes no difference)
typedef boost::geometry::model::point
<
- double, 2, boost::geometry::cs::spherical<boost::geometry::degree>
+ double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree>
> point_type;
typedef boost::geometry::model::linestring<point_type> line_type;
Modified: trunk/libs/geometry/example/07_b_graph_route_example.cpp
==============================================================================
--- trunk/libs/geometry/example/07_b_graph_route_example.cpp (original)
+++ trunk/libs/geometry/example/07_b_graph_route_example.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -249,11 +249,11 @@
int main()
{
- // Define a point in the Geographic coordinate system (currently Spherical)
+ // Define a point in the Geographic coordinate system (currently spherical-equatorial)
// (geographic calculations are in an extension; for sample it makes no difference)
typedef boost::geometry::model::point
<
- double, 2, boost::geometry::cs::spherical<boost::geometry::degree>
+ double, 2, boost::geometry::cs::spherical_equatorial<boost::geometry::degree>
> point_type;
typedef boost::geometry::model::linestring<point_type> line_type;
Modified: trunk/libs/geometry/test/algorithms/area.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/area.cpp (original)
+++ trunk/libs/geometry/test/algorithms/area.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -60,7 +60,7 @@
}
template <typename Point>
-void test_spherical()
+void test_spherical(bool polar = false)
{
bg::model::polygon<Point> geometry;
@@ -79,6 +79,29 @@
area = bg::area(geometry, strategy);
BOOST_CHECK_CLOSE(area, 2.0 * 2.0 * expected, 0.0001);
+
+ {
+ bg::model::ring<Point> aurha; // a'dam-utr-rott.-den haag-a'dam
+ bg::read_wkt("POLYGON((4.892 52.373,5.119 52.093,4.479 51.930,4.23 52.08,4.892 52.373))", aurha);
+ if (polar)
+ {
+ // Create colatitudes (measured from pole)
+ BOOST_FOREACH(Point& p, aurha)
+ {
+ bg::set<1>(p, 90.0 - bg::get<1>(p));
+ }
+ bg::correct(aurha);
+ }
+ bg::strategy::area::huiller
+ <
+ typename bg::point_type<Point>::type
+ > huiller(6372.795);
+ area = bg::area(aurha, huiller);
+ BOOST_CHECK_CLOSE(area, 1476.645675, 0.0001);
+
+ // SQL Server gives: 1481.55595960659
+ // for select geography::STGeomFromText('POLYGON((4.892 52.373,4.23 52.08,4.479 51.930,5.119 52.093,4.892 52.373))',4326).STArea()/1000000.0
+ }
}
template <typename P>
@@ -116,7 +139,8 @@
test_all<bg::model::point<float, 2, bg::cs::cartesian> >();
test_all<bg::model::point<double, 2, bg::cs::cartesian> >();
- test_spherical<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >(true);
test_ccw<bg::model::point<double, 2, bg::cs::cartesian> >();
test_open<bg::model::point<double, 2, bg::cs::cartesian> >();
Modified: trunk/libs/geometry/test/algorithms/simplify.cpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/simplify.cpp (original)
+++ trunk/libs/geometry/test/algorithms/simplify.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -96,11 +96,11 @@
test_all<bg::model::d2::point_xy<float> >();
test_all<bg::model::d2::point_xy<double> >();
- test_spherical<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+ test_spherical<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> > >();
#if defined(HAVE_TTMATH)
test_all<bg::model::d2::point_xy<ttmath_big> >();
- test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical<bg::degree> > >();
+ test_spherical<bg::model::point<ttmath_big, 2, bg::cs::spherical_equatorial<bg::degree> > >();
#endif
return 0;
Modified: trunk/libs/geometry/test/algorithms/test_area.hpp
==============================================================================
--- trunk/libs/geometry/test/algorithms/test_area.hpp (original)
+++ trunk/libs/geometry/test/algorithms/test_area.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -14,6 +14,7 @@
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/strategies/strategies.hpp>
#include <boost/geometry/domains/gis/io/wkt/read_wkt.hpp>
Modified: trunk/libs/geometry/test/geometry_test_common.hpp
==============================================================================
--- trunk/libs/geometry/test/geometry_test_common.hpp (original)
+++ trunk/libs/geometry/test/geometry_test_common.hpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -94,6 +94,29 @@
#endif
+
+struct geographic_policy
+{
+ template <typename CoordinateType>
+ static inline CoordinateType apply(CoordinateType const& value)
+ {
+ return value;
+ }
+};
+
+struct mathematical_policy
+{
+ template <typename CoordinateType>
+ static inline CoordinateType apply(CoordinateType const& value)
+ {
+ return 90 - value;
+ }
+
+};
+
+
+
+
// For all tests:
// - do NOT use "using namespace boost::geometry" to make clear what is Boost.Geometry
// - use bg:: as short alias
Modified: trunk/libs/geometry/test/strategies/cross_track.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/cross_track.cpp (original)
+++ trunk/libs/geometry/test/strategies/cross_track.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -28,9 +28,10 @@
#include <boost/geometry/geometries/segment.hpp>
+// This test is GIS oriented.
-template <typename Point>
+template <typename Point, typename LatitudePolicy>
void test_distance(
typename bg::coordinate_type<Point>::type const& lon1,
typename bg::coordinate_type<Point>::type const& lat1,
@@ -60,9 +61,9 @@
Point p1, p2, p3;
- bg::assign_values(p1, lon1, lat1);
- bg::assign_values(p2, lon2, lat2);
- bg::assign_values(p3, lon3, lat3);
+ bg::assign_values(p1, lon1, LatitudePolicy::apply(lat1));
+ bg::assign_values(p2, lon2, LatitudePolicy::apply(lat2));
+ bg::assign_values(p3, lon3, LatitudePolicy::apply(lat3));
strategy_type strategy;
@@ -83,29 +84,30 @@
}
-
-template <typename Point>
+template <typename Point, typename LatitudePolicy>
void test_all()
{
typename bg::coordinate_type<Point>::type const average_earth_radius = 6372795.0;
// distance (Paris <-> Amsterdam/Barcelona),
// with coordinates rounded as below ~87 km
- // should be is equal
- // to distance (Paris <-> Barcelona/Amsterdam)
+ // is equal to distance (Paris <-> Barcelona/Amsterdam)
typename bg::coordinate_type<Point>::type const p_to_ab = 86.798321 * 1000.0;
- test_distance<Point>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 0.1);
- test_distance<Point>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 0.1);
+ test_distance<Point, LatitudePolicy>(2, 48, 4, 52, 2, 41, average_earth_radius, p_to_ab, 0.1);
+ test_distance<Point, LatitudePolicy>(2, 48, 2, 41, 4, 52, average_earth_radius, p_to_ab, 0.1);
}
int test_main(int, char* [])
{
- test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+ test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy >();
+
+ // NYI: haversine for mathematical spherical coordinate systems
+ // test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >, mathematical_policya >();
#if defined(HAVE_TTMATH)
typedef ttmath::Big<1,4> tt;
- //test_all<bg::model::point<tt, 2, bg::cs::spherical<bg::degree> > >();
+ //test_all<bg::model::point<tt, 2, bg::cs::geographic<bg::degree> >, geographic_policy>();
#endif
return 0;
Modified: trunk/libs/geometry/test/strategies/haversine.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/haversine.cpp (original)
+++ trunk/libs/geometry/test/strategies/haversine.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -34,7 +34,7 @@
double const average_earth_radius = 6372795.0;
-template <typename Point>
+template <typename Point, typename LatitudePolicy>
struct test_distance
{
typedef bg::strategy::distance::haversine
@@ -60,15 +60,15 @@
haversine_type strategy(radius);
Point p1, p2;
- bg::assign_values(p1, lon1, lat1);
- bg::assign_values(p2, lon2, lat2);
+ bg::assign_values(p1, lon1, LatitudePolicy::apply(lat1));
+ bg::assign_values(p2, lon2, LatitudePolicy::apply(lat2));
return_type d = strategy.apply(p1, p2);
BOOST_CHECK_CLOSE(d, expected, tolerance);
}
};
-template <typename Point>
+template <typename Point, typename LatitudePolicy>
void test_all()
{
// earth to unit-sphere -> divide by earth circumference, then it is from 0-1,
@@ -77,19 +77,19 @@
// ~ Amsterdam/Paris, 467 kilometers
double const a_p = 467.2704 * 1000.0;
- test_distance<Point>::test(4, 52, 2, 48, average_earth_radius, a_p, 1.0);
- test_distance<Point>::test(2, 48, 4, 52, average_earth_radius, a_p, 1.0);
- test_distance<Point>::test(4, 52, 2, 48, 1.0, a_p * e2u, 0.001);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 48, average_earth_radius, a_p, 1.0);
+ test_distance<Point, LatitudePolicy>::test(2, 48, 4, 52, average_earth_radius, a_p, 1.0);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 48, 1.0, a_p * e2u, 0.001);
// ~ Amsterdam/Barcelona
double const a_b = 1232.9065 * 1000.0;
- test_distance<Point>::test(4, 52, 2, 41, average_earth_radius, a_b, 1.0);
- test_distance<Point>::test(2, 41, 4, 52, average_earth_radius, a_b, 1.0);
- test_distance<Point>::test(4, 52, 2, 41, 1.0, a_b * e2u, 0.001);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 41, average_earth_radius, a_b, 1.0);
+ test_distance<Point, LatitudePolicy>::test(2, 41, 4, 52, average_earth_radius, a_b, 1.0);
+ test_distance<Point, LatitudePolicy>::test(4, 52, 2, 41, 1.0, a_b * e2u, 0.001);
}
-template <typename P1, typename P2, typename CalculationType>
+template <typename P1, typename P2, typename CalculationType, typename LatitudePolicy>
void test_services()
{
namespace bgsd = bg::strategy::distance;
@@ -244,9 +244,12 @@
int test_main(int, char* [])
{
- test_all<bg::model::point<int, 2, bg::cs::spherical<bg::degree> > >();
- test_all<bg::model::point<float, 2, bg::cs::spherical<bg::degree> > >();
- test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
+ test_all<bg::model::point<int, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+ test_all<bg::model::point<float, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+ test_all<bg::model::point<double, 2, bg::cs::spherical_equatorial<bg::degree> >, geographic_policy>();
+
+ // NYI: haversine for mathematical spherical coordinate systems
+ // test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> >, mathematical_policy>();
//double t1 = time_sqrt(20000);
//double t2 = time_normal(20000);
@@ -255,15 +258,16 @@
#if defined(HAVE_TTMATH)
typedef ttmath::Big<1,4> tt;
- test_all<bg::model::point<tt, 2, bg::cs::spherical<bg::degree> > >();
+ test_all<bg::model::point<tt, 2, bg::cs::spherical<bg::degree> >, geographic_policy>();
#endif
test_services
<
- bg::model::point<float, 2, bg::cs::spherical<bg::degree> >,
bg::model::point<double, 2, bg::cs::spherical<bg::degree> >,
- double
+ bg::model::point<double, 2, bg::cs::spherical<bg::degree> >,
+ double,
+ geographic_policy
>();
return 0;
Modified: trunk/libs/geometry/test/strategies/segment_intersection.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/segment_intersection.cpp (original)
+++ trunk/libs/geometry/test/strategies/segment_intersection.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -91,7 +91,7 @@
#endif
typedef typename bg::coordinate_type<P>::type coordinate_type;
- typedef segment<const P> segment_type;
+ typedef bg::model::referring_segment<const P> segment_type;
P p1, p2, p3, p4;
bg::assign_values(p1, x1, y1);
Modified: trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp (original)
+++ trunk/libs/geometry/test/strategies/segment_intersection_collinear.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -64,7 +64,7 @@
//#endif
typedef typename bg::coordinate_type<P>::type coordinate_type;
- typedef bg::segment<const P> segment_type;
+ typedef bg::model::referring_segment<const P> segment_type;
P p1, p2, p3, p4;
bg::assign_values(p1, x1, y1);
Deleted: trunk/libs/geometry/test/strategies/side_by_cross_track.cpp
==============================================================================
--- trunk/libs/geometry/test/strategies/side_by_cross_track.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
+++ (empty file)
@@ -1,54 +0,0 @@
-// Boost.Geometry (aka GGL, Generic Geometry Library)
-// Unit Test
-
-// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
-
-// Use, modification and distribution is subject to the Boost Software License,
-// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-
-#include <geometry_test_common.hpp>
-
-#include <boost/geometry/algorithms/assign.hpp>
-
-#include <boost/geometry/strategies/spherical/side_by_cross_track.hpp>
-
-#include <boost/geometry/core/cs.hpp>
-
-#include <boost/geometry/geometries/point.hpp>
-#include <boost/geometry/geometries/segment.hpp>
-
-
-template <typename Point>
-void test_side(double lon1, double lat1,
- double lon2, double lat2,
- double lon3, double lat3,
- int expected)
-{
- typedef bg::strategy::side::side_by_cross_track<double> strategy;
-
- Point p1, p2, p3;
- bg::assign_values(p1, lon1, lat1);
- bg::assign_values(p2, lon2, lat2);
- bg::assign_values(p3, lon3, lat3);
- int s = strategy::apply(p1, p2, p3);
-
-}
-
-template <typename Point>
-void test_all()
-{
- test_side<Point>(2.0, 48.0, 4.0, 52.0, 2.0, 41.0, 1);
- test_side<Point>(2.0, 48.0, 2.0, 41.0, 4.0, 52.0, -1);
-}
-
-int test_main(int, char* [])
-{
- test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
-
- double a = 0;
- double b = sin(a);
-
- return 0;
-}
Deleted: trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj
==============================================================================
--- trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
+++ (empty file)
@@ -1,174 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
- ProjectType="Visual C++"
- Version="8.00"
- Name="side_by_cross_track"
- ProjectGUID="{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
- RootNamespace="side_by_cross_track"
- Keyword="Win32Proj"
- >
- <Platforms>
- <Platform
- Name="Win32"
- />
- </Platforms>
- <ToolFiles>
- </ToolFiles>
- <Configurations>
- <Configuration
- Name="Debug|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\side_by_cross_track"
- ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
- CharacterSet="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- Optimization="0"
- AdditionalIncludeDirectories="../../../..;.."
- PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
- ExceptionHandling="2"
- RuntimeLibrary="1"
- UsePrecompiledHeader="0"
- DebugInformationFormat="1"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- GenerateDebugInformation="true"
- SubSystem="1"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- <Configuration
- Name="Release|Win32"
- OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\side_by_cross_track"
- ConfigurationType="1"
- InheritedPropertySheets="..\boost.vsprops"
- CharacterSet="1"
- WholeProgramOptimization="1"
- >
- <Tool
- Name="VCPreBuildEventTool"
- />
- <Tool
- Name="VCCustomBuildTool"
- />
- <Tool
- Name="VCXMLDataGeneratorTool"
- />
- <Tool
- Name="VCWebServiceProxyGeneratorTool"
- />
- <Tool
- Name="VCMIDLTool"
- />
- <Tool
- Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../..;.."
- PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
- ExceptionHandling="2"
- UsePrecompiledHeader="0"
- />
- <Tool
- Name="VCManagedResourceCompilerTool"
- />
- <Tool
- Name="VCResourceCompilerTool"
- />
- <Tool
- Name="VCPreLinkEventTool"
- />
- <Tool
- Name="VCLinkerTool"
- SubSystem="1"
- OptimizeReferences="2"
- EnableCOMDATFolding="2"
- TargetMachine="1"
- />
- <Tool
- Name="VCALinkTool"
- />
- <Tool
- Name="VCManifestTool"
- />
- <Tool
- Name="VCXDCMakeTool"
- />
- <Tool
- Name="VCBscMakeTool"
- />
- <Tool
- Name="VCFxCopTool"
- />
- <Tool
- Name="VCAppVerifierTool"
- />
- <Tool
- Name="VCWebDeploymentTool"
- />
- <Tool
- Name="VCPostBuildEventTool"
- />
- </Configuration>
- </Configurations>
- <References>
- </References>
- <Files>
- <File
- RelativePath=".\side_by_cross_track.cpp"
- >
- </File>
- </Files>
- <Globals>
- </Globals>
-</VisualStudioProject>
Copied: trunk/libs/geometry/test/strategies/spherical_side.cpp (from r72057, /trunk/libs/geometry/test/strategies/side_by_cross_track.cpp)
==============================================================================
--- /trunk/libs/geometry/test/strategies/side_by_cross_track.cpp (original)
+++ trunk/libs/geometry/test/strategies/spherical_side.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -10,9 +10,14 @@
#include <geometry_test_common.hpp>
+
#include <boost/geometry/algorithms/assign.hpp>
+
#include <boost/geometry/strategies/spherical/side_by_cross_track.hpp>
+#include <boost/geometry/strategies/spherical/side_via_plane.hpp>
+#include <boost/geometry/strategies/spherical/ssf.hpp>
+#include <boost/geometry/strategies/cartesian/side_by_triangle.hpp>
#include <boost/geometry/core/cs.hpp>
@@ -20,35 +25,113 @@
#include <boost/geometry/geometries/segment.hpp>
+namespace boost { namespace geometry {
+
+template <typename Vector, typename Point1, typename Point2>
+static inline Vector create_vector(Point1 const& p1, Point2 const& p2)
+{
+ Vector v;
+ convert(p1, v);
+ subtract_point(v, p2);
+ return v;
+}
+
+}}
+
+inline char side_char(int side)
+{
+ return side == 1 ? 'L'
+ : side == -1 ? 'R'
+ : '-'
+ ;
+}
+
template <typename Point>
-void test_side(double lon1, double lat1,
- double lon2, double lat2,
- double lon3, double lat3,
+void test_side1(std::string const& case_id, Point const& p1, Point const& p2, Point const& p3,
int expected)
{
- typedef bg::strategy::side::side_by_cross_track<double> strategy;
-
- Point p1, p2, p3;
- bg::assign_values(p1, lon1, lat1);
- bg::assign_values(p2, lon2, lat2);
- bg::assign_values(p3, lon3, lat3);
- int s = strategy::apply(p1, p2, p3);
+ std::cout << case_id << ": ";
+ //int s = bg::strategy::side::side_via_plane<>::apply(p1, p2, p3);
+ int side1 = bg::strategy::side::spherical_side_formula<>::apply(p1, p2, p3);
+ int side2 = bg::strategy::side::side_via_plane<>::apply(p1, p2, p3);
+ int side3 = bg::strategy::side::side_by_cross_track<>::apply(p1, p2, p3);
+
+ typedef bg::strategy_side<bg::spherical_equatorial_tag>::type spherical_strategy;
+ //int side4 = spherical_strategy::apply(p1, p2, p3);
+
+ typedef bg::strategy_side<bg::cartesian_tag>::type cartesian_strategy;
+ int side5 = cartesian_strategy::apply(p1, p2, p3);
+
+
+ //BOOST_CHECK_EQUAL(side1, expected);
+ //BOOST_CHECK_EQUAL(side2, expected);
+ std::cout
+ << "exp: " << side_char(expected)
+ << " ssf: " << side_char(side1)
+ << " pln: " << side_char(side2)
+ << " ct: " << side_char(side3)
+ //<< " def: " << side_char(side4)
+ << " cart: " << side_char(side5)
+ << std::endl;
+}
+template <typename Point>
+void test_side(std::string const& case_id, Point const& p1, Point const& p2, Point const& p3,
+ int expected)
+{
+ test_side1(case_id, p1, p2, p3, expected);
+ //test_side1(case_id, p2, p1, p3, -expected);
}
+
template <typename Point>
void test_all()
{
- test_side<Point>(2.0, 48.0, 4.0, 52.0, 2.0, 41.0, 1);
- test_side<Point>(2.0, 48.0, 2.0, 41.0, 4.0, 52.0, -1);
+ typedef std::pair<double, double> pair;
+
+ Point amsterdam(5.9, 52.4);
+ Point barcelona(2.0, 41.0);
+ Point paris(2.0, 48.0);
+ Point milan(7.0, 45.0);
+
+ goto wrong;
+
+ test_side<Point>("bp-m", barcelona, paris, milan, -1);
+ test_side<Point>("bm-p", barcelona, milan, paris, 1);
+ test_side<Point>("mp-b", milan, paris, barcelona, 1);
+
+ test_side<Point>("am-p", amsterdam, milan, paris, -1);
+ test_side<Point>("pm-a", paris, milan, amsterdam, 1);
+
+wrong:
+ Point blog_p1(10.0, 30.0);
+ Point blog_p2(50.0, 50.0);
+ Point blog_p(30.0, 39.0);
+ test_side<Point>("blog1", blog_p1, blog_p2, blog_p, 1);
+return;
+
+ // http://www.gcmap.com/mapui?P=50N+80E-60N+50W,65N+30E
+ //Point blog_np1(80.0, 50.0);
+ //Point blog_np2(-50.0, 60.0);
+ // http://www.gcmap.com/mapui?P=50N+140E-60N+10E,65N+30E
+ Point blog_np1(140.0, 50.0);
+ Point blog_np2(10.0, 60.0);
+ Point blog_np(30.0, 65.0);
+ //test_side<Point>(blog_np1, blog_np2, blog_np, 1);
+ test_side<Point>("40", blog_np1, blog_np2, Point(30.0, 40.0), 1);
+ test_side<Point>("45", blog_np1, blog_np2, Point(30.0, 45.0), 1);
+ test_side<Point>("50", blog_np1, blog_np2, Point(30.0, 50.0), 1);
+ test_side<Point>("55", blog_np1, blog_np2, Point(30.0, 55.0), 1);
+ test_side<Point>("60", blog_np1, blog_np2, Point(30.0, 60.0), 1);
+ test_side<Point>("65", blog_np1, blog_np2, Point(30.0, 65.0), 1);
+ test_side<Point>("70", blog_np1, blog_np2, Point(30.0, 70.0), 1);
+ test_side<Point>("75", blog_np1, blog_np2, Point(30.0, 75.0), 1);
}
int test_main(int, char* [])
{
+ //test_all<bg::model::point<int, 2, bg::cs::spherical<bg::degree> > >();
test_all<bg::model::point<double, 2, bg::cs::spherical<bg::degree> > >();
- double a = 0;
- double b = sin(a);
-
return 0;
}
Copied: trunk/libs/geometry/test/strategies/spherical_side.vcproj (from r72057, /trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj)
==============================================================================
--- /trunk/libs/geometry/test/strategies/side_by_cross_track.vcproj (original)
+++ trunk/libs/geometry/test/strategies/spherical_side.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -2,9 +2,9 @@
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
- Name="side_by_cross_track"
+ Name="spherical_side"
ProjectGUID="{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
- RootNamespace="side_by_cross_track"
+ RootNamespace="spherical_side"
Keyword="Win32Proj"
>
<Platforms>
@@ -18,7 +18,7 @@
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\side_by_cross_track"
+ IntermediateDirectory="$(ConfigurationName)\spherical_side"
ConfigurationType="1"
InheritedPropertySheets="..\boost.vsprops"
CharacterSet="1"
@@ -91,7 +91,7 @@
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
- IntermediateDirectory="$(ConfigurationName)\side_by_cross_track"
+ IntermediateDirectory="$(ConfigurationName)\spherical_side"
ConfigurationType="1"
InheritedPropertySheets="..\boost.vsprops"
CharacterSet="1"
@@ -165,7 +165,7 @@
</References>
<Files>
<File
- RelativePath=".\side_by_cross_track.cpp"
+ RelativePath=".\spherical_side.cpp"
>
</File>
</Files>
Modified: trunk/libs/geometry/test/strategies/strategies_tests.sln
==============================================================================
--- trunk/libs/geometry/test/strategies/strategies_tests.sln (original)
+++ trunk/libs/geometry/test/strategies/strategies_tests.sln 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -14,7 +14,7 @@
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "segment_intersection_collinear", "segment_intersection_collinear.vcproj", "{2D0CB6D3-6ABC-4119-A235-66E6065A279E}"
EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "side_by_cross_track", "side_by_cross_track.vcproj", "{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "spherical_side", "spherical_side.vcproj", "{ADBE38D8-1828-48A2-BBA1-81F50B53C67C}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "within", "within.vcproj", "{AB13D2AC-FD34-4DE4-BD8E-4D463050E5DD}"
EndProject
Modified: trunk/libs/geometry/test_extensions/gis/latlong/andoyer.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/andoyer.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/andoyer.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\andoyer"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
>
<Tool
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../../../../..;../../..;../../../../../../boost/geometry/extensions/contrib"
+ AdditionalIncludeDirectories="../../../../../..;../..;../../../../../../boost/geometry/extensions/contrib"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
ExceptionHandling="2"
RuntimeLibrary="1"
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\andoyer"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -114,7 +114,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../..;../../..;../../../../../../boost/geometry/extensions/contrib"
+ AdditionalIncludeDirectories="../../../../../..;../..;../../../../../../boost/geometry/extensions/contrib"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="2"
UsePrecompiledHeader="0"
Modified: trunk/libs/geometry/test_extensions/gis/latlong/area_ll.cpp
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/area_ll.cpp (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/area_ll.cpp 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -32,7 +32,7 @@
#include <boost/geometry/extensions/gis/projections/parameters.hpp>
#include <boost/geometry/extensions/gis/projections/proj/sterea.hpp>
-#include <test_common/test_point.hpp>
+//#include <test_common/test_point.hpp>
template <typename PRJ, typename XY, typename LL>
@@ -177,6 +177,7 @@
// with holes
test_area_polygon_ll<bg::model::d2::point_xy<T>, bg::model::ll::point<bg::degree, T> >(false, true, perc);
+
}
int test_main(int, char* [])
Modified: trunk/libs/geometry/test_extensions/gis/latlong/area_ll.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/area_ll.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/area_ll.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\area_ll"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
>
<Tool
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../..;../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
ExceptionHandling="2"
RuntimeLibrary="1"
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\area_ll"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -114,7 +114,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../..;../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="2"
UsePrecompiledHeader="0"
Modified: trunk/libs/geometry/test_extensions/gis/latlong/cross_track.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/cross_track.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/cross_track.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\cross_track"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
>
<Tool
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../../..;../.."
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
ExceptionHandling="2"
RuntimeLibrary="1"
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\cross_track"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -114,7 +114,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../..;../../.."
+ AdditionalIncludeDirectories="../../../../../..;../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="2"
UsePrecompiledHeader="0"
Modified: trunk/libs/geometry/test_extensions/gis/latlong/distance_mixed.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/distance_mixed.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/distance_mixed.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\distance_mixed"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
>
<Tool
@@ -94,7 +94,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\distance_mixed"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Modified: trunk/libs/geometry/test_extensions/gis/latlong/parse.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/parse.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/parse.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -21,7 +21,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\parse"
ConfigurationType="1"
- InheritedPropertySheets="../../../boost.vsprops"
+ InheritedPropertySheets="../../boost.vsprops"
CharacterSet="1"
>
<Tool
@@ -91,7 +91,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\parse"
ConfigurationType="1"
- InheritedPropertySheets="../../../boost.vsprops"
+ InheritedPropertySheets="../../boost.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Modified: trunk/libs/geometry/test_extensions/gis/latlong/parse_dms.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/parse_dms.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/parse_dms.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\parse_dms"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
>
<Tool
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\parse_dms"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Modified: trunk/libs/geometry/test_extensions/gis/latlong/point_ll.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/point_ll.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/point_ll.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\point_ll"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
>
<Tool
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\point_ll"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
Modified: trunk/libs/geometry/test_extensions/gis/latlong/vincenty.vcproj
==============================================================================
--- trunk/libs/geometry/test_extensions/gis/latlong/vincenty.vcproj (original)
+++ trunk/libs/geometry/test_extensions/gis/latlong/vincenty.vcproj 2011-05-27 18:01:05 EDT (Fri, 27 May 2011)
@@ -20,7 +20,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\vincenty"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
>
<Tool
@@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
- AdditionalIncludeDirectories="../../../../../..;../../..;../../../../../../boost/geometry/extensions/contrib"
+ AdditionalIncludeDirectories="../../../../../..;../..;../../../../../../boost/geometry/extensions/contrib"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
ExceptionHandling="2"
RuntimeLibrary="1"
@@ -93,7 +93,7 @@
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)\vincenty"
ConfigurationType="1"
- InheritedPropertySheets="..\..\..\boost.vsprops;..\..\..\ttmath.vsprops"
+ InheritedPropertySheets="..\..\boost.vsprops;..\..\ttmath.vsprops"
CharacterSet="1"
WholeProgramOptimization="1"
>
@@ -114,7 +114,7 @@
/>
<Tool
Name="VCCLCompilerTool"
- AdditionalIncludeDirectories="../../../../../..;../../..;../../../../../../boost/geometry/extensions/contrib"
+ AdditionalIncludeDirectories="../../../../../..;../..;../../../../../../boost/geometry/extensions/contrib"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
ExceptionHandling="2"
UsePrecompiledHeader="0"
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk