mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-09 23:24:02 +00:00
Added libs/geometry/test folder with many tests
[SVN r59773]
This commit is contained in:
parent
6f1e76d1b5
commit
cead073c84
@ -91,19 +91,29 @@ struct box_box<Box1, Box2, DimensionCount, DimensionCount>
|
||||
}
|
||||
};
|
||||
|
||||
struct equals_interrupt_policy
|
||||
class equals_interrupt_policy
|
||||
{
|
||||
static bool const enabled = true;
|
||||
|
||||
// As soon as a turn is detected, this flag is set to true
|
||||
// and the process of getting turns (intersection points)
|
||||
// is interrupted
|
||||
bool turns_inside_or_outside;
|
||||
bool has_collinear;
|
||||
|
||||
|
||||
public:
|
||||
static bool const enabled = true;
|
||||
|
||||
inline equals_interrupt_policy()
|
||||
: turns_inside_or_outside(false)
|
||||
, has_collinear(false)
|
||||
{}
|
||||
|
||||
bool equals() const
|
||||
{
|
||||
return has_collinear && ! turns_inside_or_outside;
|
||||
}
|
||||
|
||||
template <typename Range>
|
||||
inline bool apply(Range const& range)
|
||||
{
|
||||
@ -112,30 +122,36 @@ struct equals_interrupt_policy
|
||||
it != boost::end(range);
|
||||
++it)
|
||||
{
|
||||
if (it->method == detail::overlay::method_collinear
|
||||
|| it->method == detail::overlay::method_equal
|
||||
)
|
||||
if (! it->ignore)
|
||||
{
|
||||
typedef typename boost::range_value<Range>::type turn_type;
|
||||
// If it is not such that both turns are collinear, the rings are not equal
|
||||
for (typename boost::range_iterator
|
||||
<
|
||||
typename turn_type::container_type const
|
||||
>::type oit = boost::begin(it->operations);
|
||||
oit != boost::end(it->operations);
|
||||
oit++)
|
||||
if (it->method == detail::overlay::method_collinear
|
||||
|| it->method == detail::overlay::method_equal)
|
||||
{
|
||||
if (oit->operation != detail::overlay::operation_continue)
|
||||
typedef typename boost::range_value<Range>::type turn_type;
|
||||
// If it is not such that both turns are collinear, the rings are not equal
|
||||
for (typename boost::range_iterator
|
||||
<
|
||||
typename turn_type::container_type const
|
||||
>::type oit = boost::begin(it->operations);
|
||||
oit != boost::end(it->operations);
|
||||
oit++)
|
||||
{
|
||||
turns_inside_or_outside = true;
|
||||
return true;
|
||||
if (oit->operation != detail::overlay::operation_continue)
|
||||
{
|
||||
turns_inside_or_outside = true;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
has_collinear = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
turns_inside_or_outside = true;
|
||||
return true;
|
||||
else
|
||||
{
|
||||
turns_inside_or_outside = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// It is not yet known, so don't interrupt
|
||||
@ -181,8 +197,7 @@ struct ring_ring
|
||||
detail::overlay::assign_null_policy
|
||||
>(ring1, ring2, turns, policy);
|
||||
|
||||
return turns.size() > 0
|
||||
&& ! policy.turns_inside_or_outside;
|
||||
return policy.equals();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2010, Geodan, Amsterdam, the Netherlands.
|
||||
// Copyright Bruno Lalande 2008-2010
|
||||
// Copyright (c) 2009-2010 Mateusz Loskot <mateusz@loskot.net>
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands.
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
|
||||
// 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)
|
||||
@ -17,7 +17,11 @@
|
||||
#include <boost/geometry/core/tag.hpp>
|
||||
#include <boost/geometry/core/tags.hpp>
|
||||
|
||||
// Core algorithms
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/core/exterior_ring.hpp>
|
||||
#include <boost/geometry/core/interior_rings.hpp>
|
||||
#include <boost/geometry/core/num_geometries.hpp>
|
||||
#include <boost/geometry/core/radian_access.hpp>
|
||||
#include <boost/geometry/core/topological_dimension.hpp>
|
||||
|
||||
@ -31,6 +35,7 @@
|
||||
#include <boost/geometry/algorithms/append.hpp>
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/algorithms/buffer.hpp>
|
||||
#include <boost/geometry/algorithms/centroid.hpp>
|
||||
#include <boost/geometry/algorithms/clear.hpp>
|
||||
#include <boost/geometry/algorithms/convert.hpp>
|
||||
@ -39,6 +44,7 @@
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
#include <boost/geometry/algorithms/for_each.hpp>
|
||||
#include <boost/geometry/algorithms/intermediate.hpp>
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
#include <boost/geometry/algorithms/intersects.hpp>
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
@ -46,9 +52,11 @@
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
#include <boost/geometry/algorithms/perimeter.hpp>
|
||||
#include <boost/geometry/algorithms/sectionalize.hpp>
|
||||
#include <boost/geometry/algorithms/selected.hpp>
|
||||
#include <boost/geometry/algorithms/simplify.hpp>
|
||||
#include <boost/geometry/algorithms/transform.hpp>
|
||||
#include <boost/geometry/algorithms/union.hpp>
|
||||
#include <boost/geometry/algorithms/unique.hpp>
|
||||
#include <boost/geometry/algorithms/within.hpp>
|
||||
|
||||
// check includes all concepts
|
||||
|
27
test/Jamfile.v2
Normal file
27
test/Jamfile.v2
Normal file
@ -0,0 +1,27 @@
|
||||
# test/Jamfile.v2 controls building of Generic Geometry Library unit tests
|
||||
#
|
||||
# Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# 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)
|
||||
|
||||
import testing ;
|
||||
|
||||
project ggl-test
|
||||
:
|
||||
requirements
|
||||
<include>.
|
||||
<toolset>msvc:<asynch-exceptions>on
|
||||
;
|
||||
|
||||
build-project core ;
|
||||
build-project point_concept ;
|
||||
# build-project geometries ;
|
||||
build-project arithmetic ;
|
||||
build-project algorithms ;
|
||||
build-project iterators ;
|
||||
build-project strategies ;
|
||||
build-project policies ;
|
||||
# build-project util ;
|
||||
build-project multi ;
|
35
test/algorithms/Jamfile.v2
Normal file
35
test/algorithms/Jamfile.v2
Normal file
@ -0,0 +1,35 @@
|
||||
# test/algorithms/Jamfile.v2
|
||||
#
|
||||
# Copyright (c) 2009 Mateusz Loskot <mateusz@loskot.net>
|
||||
#
|
||||
# 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)
|
||||
|
||||
test-suite ggl-algorithms
|
||||
:
|
||||
[ run append.cpp ]
|
||||
[ run area.cpp ]
|
||||
[ run assign.cpp ]
|
||||
[ run centroid.cpp ]
|
||||
[ run combine.cpp ]
|
||||
[ run convert.cpp ]
|
||||
[ run convex_hull.cpp ]
|
||||
[ run correct.cpp ]
|
||||
[ run disjoint.cpp ]
|
||||
[ run equals.cpp ]
|
||||
[ run distance.cpp ]
|
||||
[ run envelope.cpp ]
|
||||
[ run for_each.cpp ]
|
||||
[ run intersection.cpp ]
|
||||
[ run intersects.cpp ]
|
||||
[ run length.cpp ]
|
||||
[ run make.cpp ]
|
||||
[ run overlaps.cpp ]
|
||||
[ run perimeter.cpp ]
|
||||
[ run sectionalize.cpp ]
|
||||
[ run simplify.cpp ]
|
||||
[ run transform.cpp ]
|
||||
[ run union.cpp ]
|
||||
[ run within.cpp ]
|
||||
;
|
163
test/algorithms/algorithms_tests.sln
Normal file
163
test/algorithms/algorithms_tests.sln
Normal file
@ -0,0 +1,163 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "append", "append.vcproj", "{774F6471-D8A0-481C-9B0A-4903EED25C70}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "area", "area.vcproj", "{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assign", "assign.vcproj", "{94BC6547-67C1-44DB-903D-526537A91E23}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "combine", "combine.vcproj", "{5330DAB1-DF27-44FC-971B-3C5094F82FA3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convert", "convert.vcproj", "{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "convex_hull", "convex_hull.vcproj", "{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "distance", "distance.vcproj", "{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "envelope", "envelope.vcproj", "{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make", "make.vcproj", "{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "simplify", "simplify.vcproj", "{B1760CB8-553B-42AB-B54E-3D0320FF252F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transform", "transform.vcproj", "{41413E56-08DA-4592-94D2-5311FE90C62B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "buffer", "buffer.vcproj", "{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "for_each", "for_each.vcproj", "{774F6471-D8A0-481C-9B0A-4903EAD25B70}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "disjoint", "disjoint.vcproj", "{96D51D96-B35F-47C8-864D-371DF2280686}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "centroid", "centroid.vcproj", "{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection", "intersection.vcproj", "{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "correct", "correct.vcproj", "{71582BDA-D4DF-400D-8630-378BE102C038}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "within", "within.vcproj", "{C7BCD670-543D-4B29-B2D6-F3169949F79D}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "length", "length.vcproj", "{C4D75B1E-34D5-4A98-8535-A9535BE949E4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "perimeter", "perimeter.vcproj", "{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "is_convex", "is_convex.vcproj", "{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "union", "union.vcproj", "{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "overlaps", "overlaps.vcproj", "{30C37854-9ED6-4C1E-97FB-BF8637BD5811}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersects", "intersects.vcproj", "{B1A97F62-85CD-4239-BB56-619988B08260}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "equals", "equals.vcproj", "{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{774F6471-D8A0-481C-9B0A-4903EED25C70}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EED25C70}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EED25C70}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EED25C70}.Release|Win32.Build.0 = Release|Win32
|
||||
{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}.Release|Win32.Build.0 = Release|Win32
|
||||
{94BC6547-67C1-44DB-903D-526537A91E23}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{94BC6547-67C1-44DB-903D-526537A91E23}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{94BC6547-67C1-44DB-903D-526537A91E23}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{94BC6547-67C1-44DB-903D-526537A91E23}.Release|Win32.Build.0 = Release|Win32
|
||||
{5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{5330DAB1-DF27-44FC-971B-3C5094F82FA3}.Release|Win32.Build.0 = Release|Win32
|
||||
{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}.Release|Win32.Build.0 = Release|Win32
|
||||
{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}.Release|Win32.Build.0 = Release|Win32
|
||||
{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}.Release|Win32.Build.0 = Release|Win32
|
||||
{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}.Release|Win32.Build.0 = Release|Win32
|
||||
{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}.Release|Win32.Build.0 = Release|Win32
|
||||
{B1760CB8-553B-42AB-B54E-3D0320FF252F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B1760CB8-553B-42AB-B54E-3D0320FF252F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B1760CB8-553B-42AB-B54E-3D0320FF252F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B1760CB8-553B-42AB-B54E-3D0320FF252F}.Release|Win32.Build.0 = Release|Win32
|
||||
{41413E56-08DA-4592-94D2-5311FE90C62B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{41413E56-08DA-4592-94D2-5311FE90C62B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{41413E56-08DA-4592-94D2-5311FE90C62B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{41413E56-08DA-4592-94D2-5311FE90C62B}.Release|Win32.Build.0 = Release|Win32
|
||||
{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}.Release|Win32.Build.0 = Release|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EAD25B70}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EAD25B70}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EAD25B70}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{774F6471-D8A0-481C-9B0A-4903EAD25B70}.Release|Win32.Build.0 = Release|Win32
|
||||
{96D51D96-B35F-47C8-864D-371DF2280686}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{96D51D96-B35F-47C8-864D-371DF2280686}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{96D51D96-B35F-47C8-864D-371DF2280686}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{96D51D96-B35F-47C8-864D-371DF2280686}.Release|Win32.Build.0 = Release|Win32
|
||||
{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}.Release|Win32.Build.0 = Release|Win32
|
||||
{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}.Release|Win32.Build.0 = Release|Win32
|
||||
{71582BDA-D4DF-400D-8630-378BE102C038}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{71582BDA-D4DF-400D-8630-378BE102C038}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{71582BDA-D4DF-400D-8630-378BE102C038}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{71582BDA-D4DF-400D-8630-378BE102C038}.Release|Win32.Build.0 = Release|Win32
|
||||
{C7BCD670-543D-4B29-B2D6-F3169949F79D}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C7BCD670-543D-4B29-B2D6-F3169949F79D}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C7BCD670-543D-4B29-B2D6-F3169949F79D}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C7BCD670-543D-4B29-B2D6-F3169949F79D}.Release|Win32.Build.0 = Release|Win32
|
||||
{C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C4D75B1E-34D5-4A98-8535-A9535BE949E4}.Release|Win32.Build.0 = Release|Win32
|
||||
{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}.Release|Win32.Build.0 = Release|Win32
|
||||
{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}.Release|Win32.Build.0 = Release|Win32
|
||||
{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CA5EE1D6-CB4B-4A15-85C5-31D5C00289C4}.Release|Win32.Build.0 = Release|Win32
|
||||
{30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{30C37854-9ED6-4C1E-97FB-BF8637BD5811}.Release|Win32.Build.0 = Release|Win32
|
||||
{B1A97F62-85CD-4239-BB56-619988B08260}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B1A97F62-85CD-4239-BB56-619988B08260}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B1A97F62-85CD-4239-BB56-619988B08260}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B1A97F62-85CD-4239-BB56-619988B08260}.Release|Win32.Build.0 = Release|Win32
|
||||
{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
60
test/algorithms/append.cpp
Normal file
60
test/algorithms/append.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <deque>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/concept/requires.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/core/access.hpp>
|
||||
#include <boost/geometry/algorithms/make.hpp>
|
||||
#include <boost/geometry/algorithms/clear.hpp>
|
||||
#include <boost/geometry/algorithms/append.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
|
||||
#include <boost/geometry/geometries/adapted/boost_array_as_linestring.hpp>
|
||||
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
template <typename G>
|
||||
void test_geometry()
|
||||
{
|
||||
G geometry;
|
||||
typedef typename boost::geometry::point_type<G>::type P;
|
||||
|
||||
boost::geometry::append(geometry, boost::geometry::make_zero<P>());
|
||||
BOOST_CHECK_EQUAL(boost::geometry::num_points(geometry), 1);
|
||||
|
||||
boost::geometry::clear(geometry);
|
||||
BOOST_CHECK_EQUAL(boost::geometry::num_points(geometry), 0);
|
||||
//P p = boost::range::front(geometry);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_geometry<boost::geometry::linestring<P> >();
|
||||
test_geometry<boost::geometry::linear_ring<P> >();
|
||||
test_geometry<boost::geometry::polygon<P> >();
|
||||
|
||||
test_geometry<std::vector<P> >();
|
||||
test_geometry<std::deque<P> >();
|
||||
//test_geometry<std::list<P> >();
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<test::test_point>();
|
||||
test_all<boost::geometry::point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/append.vcproj
Normal file
182
test/algorithms/append.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="append"
|
||||
ProjectGUID="{774F6471-D8A0-481C-9B0A-4903EED25C70}"
|
||||
RootNamespace="append"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\append"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\append"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\append.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
86
test/algorithms/area.cpp
Normal file
86
test/algorithms/area.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <algorithms/test_area.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
//#define GGL_TEST_DEBUG
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
//test_area_circle<P, double>();
|
||||
test_geometry<boost::geometry::box<P> >("POLYGON((0 0,2 2))", 4.0);
|
||||
test_geometry<boost::geometry::box<P> >("POLYGON((2 2,0 0))", 4.0);
|
||||
|
||||
// clockwise rings (second is wrongly ordered)
|
||||
test_geometry<boost::geometry::linear_ring<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
|
||||
test_geometry<boost::geometry::linear_ring<P> >("POLYGON((0 0,2 0,4 2,0 7,0 0))", -16.0);
|
||||
|
||||
// counter clockwise rings (first is wrongly ordered)
|
||||
test_geometry<boost::geometry::linear_ring<P, std::vector, false> >
|
||||
("POLYGON((0 0,0 7,4 2,2 0,0 0))", -16.0);
|
||||
test_geometry<boost::geometry::linear_ring<P, std::vector, false> >
|
||||
("POLYGON((0 0,2 0,4 2,0 7,0 0))", 16.0);
|
||||
|
||||
test_geometry<boost::geometry::polygon<P> >("POLYGON((0 0,0 7,4 2,2 0,0 0))", 16.0);
|
||||
test_geometry<boost::geometry::polygon<P> >("POLYGON((1 1,2 1,2 2,1 2,1 1))", -1.0);
|
||||
test_geometry<boost::geometry::polygon<P> >
|
||||
("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", 15.0);
|
||||
test_geometry<boost::geometry::polygon<P, std::vector, std::vector, false> >
|
||||
("POLYGON((0 0,0 7,4 2,2 0,0 0), (1 1,2 1,2 2,1 2,1 1))", -15.0);
|
||||
}
|
||||
|
||||
template <typename Point>
|
||||
void test_spherical()
|
||||
{
|
||||
boost::geometry::polygon<Point> geometry;
|
||||
|
||||
// unit-sphere has area of 4-PI. Polygon covering 1/8 of it:
|
||||
double expected = 4.0 * boost::geometry::math::pi / 8.0;
|
||||
boost::geometry::read_wkt("POLYGON((0 0,0 90,90 0,0 0))", geometry);
|
||||
|
||||
double area = boost::geometry::area(geometry);
|
||||
BOOST_CHECK_CLOSE(area, expected, 0.0001);
|
||||
|
||||
// With strategy, radius 2 -> 4 pi r^2
|
||||
boost::geometry::strategy::area::huiller
|
||||
<
|
||||
typename boost::geometry::point_type<Point>::type
|
||||
> strategy(2.0);
|
||||
|
||||
area = boost::geometry::area(geometry, strategy);
|
||||
BOOST_CHECK_CLOSE(area, 2.0 * 2.0 * expected, 0.0001);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
test_spherical<boost::geometry::point<double, 2, boost::geometry::cs::spherical<boost::geometry::degree> > >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/area.vcproj
Normal file
182
test/algorithms/area.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="area"
|
||||
ProjectGUID="{E86E6687-AC05-4DBE-A8BD-C47BCB6AEE90}"
|
||||
RootNamespace="area"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\area"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\area"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\area.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
162
test/algorithms/assign.cpp
Normal file
162
test/algorithms/assign.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
using namespace boost::geometry;
|
||||
|
||||
template <typename L>
|
||||
void check_linestring_2d(const L& line)
|
||||
{
|
||||
BOOST_CHECK((boost::size(line) == 3));
|
||||
BOOST_CHECK((boost::geometry::num_points(line) == 3));
|
||||
|
||||
typedef typename point_type<L>::type P;
|
||||
const P& p0 = line[0];
|
||||
BOOST_CHECK(get<0>(p0) == 1);
|
||||
BOOST_CHECK(get<1>(p0) == 2);
|
||||
|
||||
const P& p1 = line[1];
|
||||
BOOST_CHECK(get<0>(p1) == 3);
|
||||
BOOST_CHECK(get<1>(p1) == 4);
|
||||
|
||||
const P& p2 = line[2];
|
||||
BOOST_CHECK(get<0>(p2) == 5);
|
||||
BOOST_CHECK(get<1>(p2) == 6);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_assign_linestring_2d()
|
||||
{
|
||||
boost::geometry::linestring<P> line;
|
||||
|
||||
// Test assignment of plain array (note that this is only possible if adapted c-array is included!
|
||||
const double coors[3][2] = { {1, 2}, {3, 4}, {5, 6} };
|
||||
boost::geometry::assign(line, coors);
|
||||
check_linestring_2d(line);
|
||||
|
||||
// Test assignment of point array
|
||||
P points[3];
|
||||
boost::geometry::assign(points[0], 1, 2);
|
||||
boost::geometry::assign(points[1], 3, 4);
|
||||
boost::geometry::assign(points[2], 5, 6);
|
||||
boost::geometry::assign(line, points);
|
||||
check_linestring_2d(line);
|
||||
|
||||
// Test assignment of array with different point-type
|
||||
boost::tuple<float, float> tuples[3];
|
||||
tuples[0] = boost::make_tuple(1, 2);
|
||||
tuples[1] = boost::make_tuple(3, 4);
|
||||
tuples[2] = boost::make_tuple(5, 6);
|
||||
boost::geometry::assign(line, tuples);
|
||||
check_linestring_2d(line);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_assign_box_2d()
|
||||
{
|
||||
|
||||
typedef box<P> B;
|
||||
B b;
|
||||
boost::geometry::assign(b, 1, 2, 3, 4);
|
||||
BOOST_CHECK((get<min_corner, 0>(b) == 1));
|
||||
BOOST_CHECK((get<min_corner, 1>(b) == 2));
|
||||
BOOST_CHECK((get<max_corner, 0>(b) == 3));
|
||||
BOOST_CHECK((get<max_corner, 1>(b) == 4));
|
||||
|
||||
boost::geometry::assign_zero(b);
|
||||
BOOST_CHECK((get<min_corner, 0>(b) == 0));
|
||||
BOOST_CHECK((get<min_corner, 1>(b) == 0));
|
||||
BOOST_CHECK((get<max_corner, 0>(b) == 0));
|
||||
BOOST_CHECK((get<max_corner, 1>(b) == 0));
|
||||
|
||||
boost::geometry::assign_inverse(b);
|
||||
BOOST_CHECK((get<min_corner, 0>(b) > 9999));
|
||||
BOOST_CHECK((get<min_corner, 1>(b) > 9999));
|
||||
BOOST_CHECK((get<max_corner, 0>(b) < 9999));
|
||||
BOOST_CHECK((get<max_corner, 1>(b) < 9999));
|
||||
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_assign_point_3d()
|
||||
{
|
||||
P p;
|
||||
boost::geometry::assign(p, 1, 2, 3);
|
||||
BOOST_CHECK(get<0>(p) == 1);
|
||||
BOOST_CHECK(get<1>(p) == 2);
|
||||
BOOST_CHECK(get<2>(p) == 3);
|
||||
|
||||
boost::geometry::detail::assign::assign_value(p, 123);
|
||||
BOOST_CHECK(get<0>(p) == 123);
|
||||
BOOST_CHECK(get<1>(p) == 123);
|
||||
BOOST_CHECK(get<2>(p) == 123);
|
||||
|
||||
boost::geometry::assign_zero(p);
|
||||
BOOST_CHECK(get<0>(p) == 0);
|
||||
BOOST_CHECK(get<1>(p) == 0);
|
||||
BOOST_CHECK(get<2>(p) == 0);
|
||||
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_assign_point_2d()
|
||||
{
|
||||
P p;
|
||||
boost::geometry::assign(p, 1, 2);
|
||||
BOOST_CHECK(get<0>(p) == 1);
|
||||
BOOST_CHECK(get<1>(p) == 2);
|
||||
|
||||
boost::geometry::detail::assign::assign_value(p, 123);
|
||||
BOOST_CHECK(get<0>(p) == 123);
|
||||
BOOST_CHECK(get<1>(p) == 123);
|
||||
|
||||
boost::geometry::assign_zero(p);
|
||||
BOOST_CHECK(get<0>(p) == 0);
|
||||
BOOST_CHECK(get<1>(p) == 0);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_assign_point_3d<int[3]>();
|
||||
test_assign_point_3d<float[3]>();
|
||||
test_assign_point_3d<double[3]>();
|
||||
test_assign_point_3d<test::test_point>();
|
||||
test_assign_point_3d<point<int, 3, boost::geometry::cs::cartesian> >();
|
||||
test_assign_point_3d<point<float, 3, boost::geometry::cs::cartesian> >();
|
||||
test_assign_point_3d<point<double, 3, boost::geometry::cs::cartesian> >();
|
||||
|
||||
test_assign_point_2d<int[2]>();
|
||||
test_assign_point_2d<float[2]>();
|
||||
test_assign_point_2d<double[2]>();
|
||||
test_assign_point_2d<point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_point_2d<point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_point_2d<point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
test_assign_box_2d<int[2]>();
|
||||
test_assign_box_2d<float[2]>();
|
||||
test_assign_box_2d<double[2]>();
|
||||
test_assign_box_2d<point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_box_2d<point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_box_2d<point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
test_assign_linestring_2d<point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_linestring_2d<point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_assign_linestring_2d<point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/assign.vcproj
Normal file
177
test/algorithms/assign.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="assign"
|
||||
ProjectGUID="{94BC6547-67C1-44DB-903D-526537A91E23}"
|
||||
RootNamespace="assign"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\assign"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\assign"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\assign.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
46
test/algorithms/buffer.cpp
Normal file
46
test/algorithms/buffer.cpp
Normal file
@ -0,0 +1,46 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/buffer.hpp>
|
||||
#include <boost/geometry/core/coordinate_type.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef typename boost::geometry::coordinate_type<P>::type coordinate_type;
|
||||
|
||||
P p1(0, 0);
|
||||
P p2(2, 2);
|
||||
boost::geometry::box<P> b1(p1, p2);
|
||||
|
||||
boost::geometry::box<P> b2;
|
||||
boost::geometry::buffer(b1, b2, coordinate_type(2));
|
||||
|
||||
// TODO: Check if buffer is correct
|
||||
// using boost::geometry::equals to compare boxes
|
||||
// (TODO: implement that)
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_all<boost::geometry::point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/buffer.vcproj
Normal file
177
test/algorithms/buffer.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="buffer"
|
||||
ProjectGUID="{C66E1F6F-84F6-44E2-B5E8-2B127065BE31}"
|
||||
RootNamespace="buffer"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\buffer"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\buffer"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\buffer.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
76
test/algorithms/centroid.cpp
Normal file
76
test/algorithms/centroid.cpp
Normal file
@ -0,0 +1,76 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <algorithms/test_centroid.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
|
||||
template <typename P>
|
||||
void test_2d()
|
||||
{
|
||||
test_centroid<boost::geometry::linestring<P> >("LINESTRING(1 1, 2 2, 3 3)", 2.0, 2.0);
|
||||
test_centroid<boost::geometry::linestring<P> >("LINESTRING(0 0,0 4, 4 4)", 1.0, 3.0);
|
||||
test_centroid<boost::geometry::linestring<P> >("LINESTRING(0 0,3 3,0 6,3 9,0 12)", 1.5, 6.0);
|
||||
|
||||
test_centroid<boost::geometry::linear_ring<P> >(
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
|
||||
",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
|
||||
4.06923363095238, 1.65055803571429);
|
||||
test_centroid<boost::geometry::polygon<P> >(
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
|
||||
",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
|
||||
4.06923363095238, 1.65055803571429);
|
||||
|
||||
// with holes
|
||||
test_centroid<boost::geometry::polygon<P> >(
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2"
|
||||
",3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
|
||||
",(4 2,4.2 1.4,4.8 1.9,4.4 2.2,4 2))"
|
||||
,
|
||||
4.0466264962959677, 1.6348996057331333);
|
||||
|
||||
|
||||
// ccw
|
||||
test_centroid<boost::geometry::linear_ring<P, std::vector, false> >(
|
||||
"POLYGON((2 1.3,2.9 0.7,4.9 0.8,5.4 1.2,5.3 2.6,4.1 3,3.4 2"
|
||||
",3.7 1.6,3.4 1.2,2.8 1.8,2.4 1.7,2 1.3))",
|
||||
4.06923363095238, 1.65055803571429);
|
||||
|
||||
|
||||
test_centroid<boost::geometry::box<P> >("POLYGON((1 2,3 4))", 2, 3);
|
||||
test_centroid<P>("POINT(3 3)", 3, 3);
|
||||
}
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_3d()
|
||||
{
|
||||
test_centroid<boost::geometry::box<P> >("POLYGON((1 2 3,5 6 7))", 3, 4, 5);
|
||||
test_centroid<P>("POINT(1 2 3)", 1, 2, 3);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_2d<boost::geometry::point_xy<double> >();
|
||||
test_2d<boost::tuple<float, float> >();
|
||||
test_2d<boost::geometry::point_xy<float> >();
|
||||
|
||||
test_3d<boost::tuple<double, double, double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_2d<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
//test_2d<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/centroid.vcproj
Normal file
182
test/algorithms/centroid.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="centroid"
|
||||
ProjectGUID="{1E90E5BC-1280-4A6A-B197-132ABBF97EB9}"
|
||||
RootNamespace="centroid"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\centroid"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\centroid"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\centroid.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
151
test/algorithms/combine.cpp
Normal file
151
test/algorithms/combine.cpp
Normal file
@ -0,0 +1,151 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <algorithms/test_combine.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/make.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename Point>
|
||||
void test_point_3d()
|
||||
{
|
||||
boost::geometry::box<Point> b = boost::geometry::make_inverse<boost::geometry::box<Point> >();
|
||||
|
||||
test_combine<Point>(b, "POINT(1 2 5)", "(1,2,5),(1,2,5)");
|
||||
test_combine<Point>(b, "POINT(3 4 6)", "(1,2,5),(3,4,6)");
|
||||
|
||||
test_combine<Point>(b, "POINT(4 4 5)", "(1,2,5),(4,4,6)");
|
||||
test_combine<Point>(b, "POINT(4 5 5)", "(1,2,5),(4,5,6)");
|
||||
test_combine<Point>(b, "POINT(10 10 4)", "(1,2,4),(10,10,6)");
|
||||
test_combine<Point>(b, "POINT(9 9 4)", "(1,2,4),(10,10,6)");
|
||||
|
||||
test_combine<Point>(b, "POINT(0 2 7)", "(0,2,4),(10,10,7)");
|
||||
test_combine<Point>(b, "POINT(0 0 7)", "(0,0,4),(10,10,7)");
|
||||
test_combine<Point>(b, "POINT(-1 -1 5)", "(-1,-1,4),(10,10,7)");
|
||||
test_combine<Point>(b, "POINT(0 0 5)", "(-1,-1,4),(10,10,7)");
|
||||
|
||||
test_combine<Point>(b, "POINT(15 -1 0)", "(-1,-1,0),(15,10,7)");
|
||||
test_combine<Point>(b, "POINT(-1 15 10)", "(-1,-1,0),(15,15,10)");
|
||||
}
|
||||
|
||||
template <typename Point>
|
||||
void test_box_3d()
|
||||
{
|
||||
typedef boost::geometry::box<Point> box_type;
|
||||
box_type b = boost::geometry::make_inverse<box_type>();
|
||||
|
||||
test_combine<box_type>(b, "BOX(0 2 5,4 4 6)", "(0,2,5),(4,4,6)");
|
||||
test_combine<box_type>(b, "BOX(0 1 5,4 6 6)", "(0,1,5),(4,6,6)");
|
||||
test_combine<box_type>(b, "BOX(-1 -1 6,10 10 5)", "(-1,-1,5),(10,10,6)");
|
||||
test_combine<box_type>(b, "BOX(3 3 6,3 3 5)", "(-1,-1,5),(10,10,6)");
|
||||
|
||||
test_combine<box_type>(b, "BOX(3 15 7,-1 3 4)", "(-1,-1,4),(10,15,7)");
|
||||
test_combine<box_type>(b, "BOX(-15 3 7,3 20 4)", "(-15,-1,4),(10,20,7)");
|
||||
test_combine<box_type>(b, "BOX(3 -20 8,3 20 3)", "(-15,-20,3),(10,20,8)");
|
||||
test_combine<box_type>(b, "BOX(-20 3 8,20 3 3)", "(-20,-20,3),(20,20,8)");
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_3d()
|
||||
{
|
||||
test_point_3d<P>();
|
||||
test_box_3d<P>();
|
||||
}
|
||||
|
||||
template <typename Point>
|
||||
void test_2d()
|
||||
{
|
||||
typedef boost::geometry::box<Point> box_type;
|
||||
typedef std::pair<Point, Point> segment_type;
|
||||
|
||||
box_type b = boost::geometry::make_inverse<box_type>();
|
||||
|
||||
test_combine<box_type>(b, "BOX(1 1,2 2)", "(1,1),(2,2)");
|
||||
|
||||
// Test an 'incorrect' box -> should also correctly update the bbox
|
||||
test_combine<box_type>(b, "BOX(3 4,0 1)", "(0,1),(3,4)");
|
||||
|
||||
// Test a segment
|
||||
test_combine<segment_type>(b, "SEGMENT(5 6,7 8)", "(0,1),(7,8)");
|
||||
}
|
||||
|
||||
template <typename Point>
|
||||
void test_spherical_degree()
|
||||
{
|
||||
boost::geometry::box<Point> b = boost::geometry::make_inverse<boost::geometry::box<Point> >();
|
||||
|
||||
test_combine<Point>(b, "POINT(179.73 71.56)",
|
||||
"(179.73,71.56),(179.73,71.56)");
|
||||
test_combine<Point>(b, "POINT(177.47 71.23)",
|
||||
"(177.47,71.23),(179.73,71.56)");
|
||||
|
||||
// It detects that this point is lying RIGHT of the others,
|
||||
// and then it "combines" it.
|
||||
// It might be argued that "181.22" is displayed instead. However, they are
|
||||
// the same.
|
||||
test_combine<Point>(b, "POINT(-178.78 70.78)",
|
||||
"(177.47,70.78),(-178.78,71.56)");
|
||||
}
|
||||
|
||||
|
||||
template <typename Point>
|
||||
void test_spherical_radian()
|
||||
{
|
||||
boost::geometry::box<Point> b = boost::geometry::make_inverse<boost::geometry::box<Point> >();
|
||||
|
||||
test_combine<Point>(b, "POINT(3.128 1.249)",
|
||||
"(3.128,1.249),(3.128,1.249)");
|
||||
test_combine<Point>(b, "POINT(3.097 1.243)",
|
||||
"(3.097,1.243),(3.128,1.249)");
|
||||
|
||||
// It detects that this point is lying RIGHT of the others,
|
||||
// and then it "combines" it.
|
||||
// It might be argued that "181.22" is displayed instead. However, they are
|
||||
// the same.
|
||||
test_combine<Point>(b, "POINT(-3.121 1.235)",
|
||||
"(3.097,1.235),(-3.121,1.249)");
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_2d<boost::geometry::point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
|
||||
test_3d<test::test_point>();
|
||||
test_3d<boost::geometry::point<int, 3, boost::geometry::cs::cartesian> >();
|
||||
test_3d<boost::geometry::point<float, 3, boost::geometry::cs::cartesian> >();
|
||||
test_3d<boost::geometry::point<double, 3, boost::geometry::cs::cartesian> >();
|
||||
|
||||
test_spherical_degree<boost::geometry::point<double, 2, boost::geometry::cs::spherical<boost::geometry::degree> > >();
|
||||
test_spherical_radian<boost::geometry::point<double, 2, boost::geometry::cs::spherical<boost::geometry::radian> > >();
|
||||
|
||||
|
||||
/***
|
||||
GMP/CLN still fails, due to boost::numeric_limits<T>, waiting for solution
|
||||
#if defined(HAVE_CLN)
|
||||
test_3d<boost::geometry::point<boost::numeric_adaptor::cln_value_type,
|
||||
3, boost::geometry::cs::cartesian> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_3d<boost::geometry::point<boost::numeric_adaptor::gmp_value_type,
|
||||
3, boost::geometry::cs::cartesian> >();
|
||||
#endif
|
||||
***/
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/combine.vcproj
Normal file
177
test/algorithms/combine.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="combine"
|
||||
ProjectGUID="{5330DAB1-DF27-44FC-971B-3C5094F82FA3}"
|
||||
RootNamespace="combine"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\combine"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\combine"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\combine.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
95
test/algorithms/convert.cpp
Normal file
95
test/algorithms/convert.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <ggl_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/algorithms/convert.hpp>
|
||||
#include <boost/geometry/algorithms/make.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::box<P> box_type;
|
||||
|
||||
P p;
|
||||
boost::geometry::assign(p, 1, 2);
|
||||
|
||||
box_type b;
|
||||
boost::geometry::convert(p, b);
|
||||
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0, 0>(b)), 1.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0, 1>(b)), 2.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1, 0>(b)), 1.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1, 1>(b)), 2.0, 0.001);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_std()
|
||||
{
|
||||
test_all<P>();
|
||||
|
||||
typedef boost::geometry::box<P> box_type;
|
||||
typedef boost::geometry::linear_ring<P> ring_type;
|
||||
typedef boost::geometry::polygon<P> polygon_type;
|
||||
|
||||
box_type b;
|
||||
boost::geometry::set<boost::geometry::min_corner, 0>(b, 1);
|
||||
boost::geometry::set<boost::geometry::min_corner, 1>(b, 2);
|
||||
boost::geometry::set<boost::geometry::max_corner, 0>(b, 3);
|
||||
boost::geometry::set<boost::geometry::max_corner, 1>(b, 4);
|
||||
|
||||
ring_type ring;
|
||||
boost::geometry::convert(b, ring);
|
||||
|
||||
//std::cout << boost::geometry::wkt(b) << std::endl;
|
||||
//std::cout << boost::geometry::wkt(ring) << std::endl;
|
||||
|
||||
typename boost::range_const_iterator<ring_type>::type it = ring.begin();
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(*it)), 1.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(*it)), 2.0, 0.001);
|
||||
it++;
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(*it)), 1.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(*it)), 4.0, 0.001);
|
||||
it++;
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(*it)), 3.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(*it)), 4.0, 0.001);
|
||||
it++;
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(*it)), 3.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(*it)), 2.0, 0.001);
|
||||
it++;
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(*it)), 1.0, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(*it)), 2.0, 0.001);
|
||||
|
||||
BOOST_CHECK_EQUAL(ring.size(), 5);
|
||||
|
||||
|
||||
polygon_type polygon;
|
||||
|
||||
boost::geometry::convert(ring, polygon);
|
||||
BOOST_CHECK_EQUAL(boost::geometry::num_points(polygon), 5);
|
||||
|
||||
boost::geometry::convert(polygon, ring);
|
||||
BOOST_CHECK_EQUAL(boost::geometry::num_points(ring), 5);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_std<boost::geometry::point<int, 2, boost::geometry::cs::cartesian> >();
|
||||
test_std<boost::geometry::point<float, 2, boost::geometry::cs::cartesian> >();
|
||||
test_std<boost::geometry::point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/convert.vcproj
Normal file
177
test/algorithms/convert.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="convert"
|
||||
ProjectGUID="{FABF1AA7-F695-49F8-92F6-AB6C4B0C088A}"
|
||||
RootNamespace="convert"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\convert"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\convert"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\convert.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
62
test/algorithms/convex_hull.cpp
Normal file
62
test/algorithms/convex_hull.cpp
Normal file
@ -0,0 +1,62 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <cstddef>
|
||||
#include <string>
|
||||
|
||||
#include <algorithms/test_convex_hull.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all(bool do_rectangular = true)
|
||||
{
|
||||
// from sample linestring
|
||||
|
||||
test_geometry<boost::geometry::linestring<P> >(
|
||||
"linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", 5, 4, 3.8);
|
||||
|
||||
if (do_rectangular)
|
||||
{
|
||||
// rectangular, with concavity
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))",
|
||||
9, 5, 12.0);
|
||||
}
|
||||
|
||||
// from sample polygon, with concavity
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
|
||||
", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
|
||||
12, 8, 5.245);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
//test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
// GMP compiles, but gives 'errors' in results (6 points in hull instead of 5)
|
||||
// This is because of a vertex on the line, which is OK for the convex hull,
|
||||
// but not OK for the strictly convex hull.
|
||||
// Actually this is unexpected from a high-precision arithmetic library, the
|
||||
// problem is the comparison (something is non-zero which should be calculated
|
||||
// zero, in the direction).
|
||||
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >(false);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/convex_hull.vcproj
Normal file
182
test/algorithms/convex_hull.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="convex_hull"
|
||||
ProjectGUID="{0AFF7A85-63A7-4178-92A5-CC692B09F5B9}"
|
||||
RootNamespace="convex_hull"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\convex_hull"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\convex_hull"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\convex_hull.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
160
test/algorithms/correct.cpp
Normal file
160
test/algorithms/correct.cpp
Normal file
@ -0,0 +1,160 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <sstream>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/correct.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/util/write_dsv.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/write_wkt.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt, std::string const& expected)
|
||||
{
|
||||
Geometry geometry;
|
||||
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
boost::geometry::correct(geometry);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::wkt(geometry);
|
||||
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
|
||||
// Note: 3D/box test cannot be done using WKT because:
|
||||
// -> wkt-box does not exist
|
||||
// -> so it is converted to a ring
|
||||
// -> ring representation of 3d-box is not supported, nor feasible
|
||||
// -> so it uses DSV which can represent a box
|
||||
template <typename Geometry>
|
||||
void test_geometry_dsv(std::string const& wkt, std::string const& expected)
|
||||
{
|
||||
Geometry geometry;
|
||||
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
boost::geometry::correct(geometry);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::dsv(geometry);
|
||||
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
// Define clockwise and counter clockwise polygon
|
||||
std::string cw_ring =
|
||||
"POLYGON((0 0,0 1,1 1,1 0,0 0))";
|
||||
std::string ccw_ring =
|
||||
"POLYGON((0 0,1 0,1 1,0 1,0 0))";
|
||||
|
||||
// already cw_ring
|
||||
test_geometry<boost::geometry::linear_ring<P> >(cw_ring, cw_ring);
|
||||
|
||||
// wrong order
|
||||
test_geometry<boost::geometry::linear_ring<P> >(ccw_ring, cw_ring);
|
||||
|
||||
// not closed
|
||||
test_geometry<boost::geometry::linear_ring<P> >(
|
||||
"POLYGON((0 0,1 0,1 1,0 1))",
|
||||
cw_ring);
|
||||
|
||||
// counter clockwise, cw_ring
|
||||
test_geometry<boost::geometry::linear_ring<P, std::vector, false> >
|
||||
(ccw_ring, ccw_ring);
|
||||
|
||||
test_geometry<boost::geometry::linear_ring<P, std::vector, false> >
|
||||
(cw_ring, ccw_ring);
|
||||
|
||||
|
||||
// polygon: cw_ring
|
||||
test_geometry<boost::geometry::polygon<P> >(cw_ring, cw_ring);
|
||||
// wrong order
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,1 0,1 1,0 1,0 0))",
|
||||
cw_ring);
|
||||
// wrong order & not closed
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,1 0,1 1,0 1))",
|
||||
cw_ring);
|
||||
|
||||
|
||||
std::string cw_holey_polygon =
|
||||
"POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))";
|
||||
std::string ccw_holey_polygon =
|
||||
"POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,1 2,2 2,2 1,1 1))";
|
||||
|
||||
// with holes: cw_ring
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
cw_holey_polygon,
|
||||
cw_holey_polygon);
|
||||
// wrong order of main
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,4 0,4 4,0 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
|
||||
cw_holey_polygon);
|
||||
// wrong order of hole
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 2,2 2,2 1,1 1))",
|
||||
cw_holey_polygon);
|
||||
|
||||
// wrong order of main and hole
|
||||
test_geometry<boost::geometry::polygon<P> >(ccw_holey_polygon, cw_holey_polygon);
|
||||
|
||||
// test the counter-clockwise
|
||||
test_geometry<boost::geometry::polygon<P, std::vector, std::vector, false> >(
|
||||
ccw_holey_polygon, ccw_holey_polygon);
|
||||
|
||||
// Boxes
|
||||
std::string proper_box = "POLYGON((0 0,0 2,2 2,2 0,0 0))";
|
||||
test_geometry<boost::geometry::box<P> >(proper_box, proper_box);
|
||||
test_geometry<boost::geometry::box<P> >("BOX(0 0,2 2)", proper_box);
|
||||
test_geometry<boost::geometry::box<P> >("BOX(2 2,0 0)", proper_box);
|
||||
test_geometry<boost::geometry::box<P> >("BOX(0 2,2 0)", proper_box);
|
||||
|
||||
// Cubes
|
||||
typedef boost::geometry::box<boost::geometry::point<double, 3, boost::geometry::cs::cartesian> > box3d;
|
||||
std::string proper_3d_dsv_box = "((0, 0, 0), (2, 2, 2))";
|
||||
test_geometry_dsv<box3d>("BOX(0 0 0,2 2 2)", proper_3d_dsv_box);
|
||||
test_geometry_dsv<box3d>("BOX(2 2 2,0 0 0)", proper_3d_dsv_box);
|
||||
test_geometry_dsv<box3d>("BOX(0 2 2,2 0 0)", proper_3d_dsv_box);
|
||||
test_geometry_dsv<box3d>("BOX(2 0 2,0 2 0)", proper_3d_dsv_box);
|
||||
test_geometry_dsv<box3d>("BOX(0 0 2,2 2 0)", proper_3d_dsv_box);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<int[2]>();
|
||||
//test_all<float[2]>(); not yet because cannot be copied, for polygon
|
||||
//test_all<double[2]>();
|
||||
|
||||
//test_all<point_xy<int> >();
|
||||
//test_all<point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/correct.vcproj
Normal file
182
test/algorithms/correct.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="correct"
|
||||
ProjectGUID="{71582BDA-D4DF-400D-8630-378BE102C038}"
|
||||
RootNamespace="correct"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\correct"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\correct"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\correct.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
109
test/algorithms/disjoint.cpp
Normal file
109
test/algorithms/disjoint.cpp
Normal file
@ -0,0 +1,109 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/disjoint.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
#include <algorithms/test_relate.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename G1, typename G2>
|
||||
void test_disjoint(std::string const& id,
|
||||
std::string const& wkt1,
|
||||
std::string const& wkt2, bool expected)
|
||||
{
|
||||
G1 g1;
|
||||
boost::geometry::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
boost::geometry::read_wkt(wkt2, g2);
|
||||
|
||||
bool detected = boost::geometry::disjoint(g1, g2);
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"disjoint: " << id
|
||||
<< " -> Expected: " << expected
|
||||
<< " detected: " << detected);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::box<P> box;
|
||||
|
||||
test_disjoint<P, P>("pp1", "point(1 1)", "point(1 1)", false);
|
||||
test_disjoint<P, P>("pp2", "point(1 1)", "point(1.001 1)", true);
|
||||
|
||||
// left-right
|
||||
test_disjoint<box, box>("bb1", "box(1 1, 2 2)", "box(3 1, 4 2)", true);
|
||||
test_disjoint<box, box>("bb2", "box(1 1, 2 2)", "box(2 1, 3 2)", false);
|
||||
test_disjoint<box, box>("bb3", "box(1 1, 2 2)", "box(2 2, 3 3)", false);
|
||||
test_disjoint<box, box>("bb4", "box(1 1, 2 2)", "box(2.001 2, 3 3)", true);
|
||||
|
||||
// up-down
|
||||
test_disjoint<box, box>("bb5", "box(1 1, 2 2)", "box(1 3, 2 4)", true);
|
||||
test_disjoint<box, box>("bb6", "box(1 1, 2 2)", "box(1 2, 2 3)", false);
|
||||
// right-left
|
||||
test_disjoint<box, box>("bb7", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
|
||||
test_disjoint<box, box>("bb8", "box(1 1, 2 2)", "box(0 1, 1 2)", false);
|
||||
|
||||
// point-box
|
||||
test_disjoint<P, box>("pb1", "point(1 1)", "box(0 0, 2 2)", false);
|
||||
test_disjoint<P, box>("pb2", "point(2 2)", "box(0 0, 2 2)", false);
|
||||
test_disjoint<P, box>("pb3", "point(2.0001 2)", "box(1 1, 2 2)", true);
|
||||
test_disjoint<P, box>("pb4", "point(0.9999 2)", "box(1 1, 2 2)", true);
|
||||
|
||||
// box-point (to test reverse compiling)
|
||||
test_disjoint<box, P>("bp1", "box(1 1, 2 2)", "point(2 2)", false);
|
||||
|
||||
// Test triangles for polygons/rings, boxes
|
||||
// Note that intersections are tested elsewhere, they don't need
|
||||
// thorough test at this place
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
typedef boost::geometry::linear_ring<P> ring;
|
||||
|
||||
// Four times same test with other types
|
||||
test_disjoint<polygon, polygon>("disjoint_simplex_pp", disjoint_simplex[0], disjoint_simplex[1], true);
|
||||
test_disjoint<ring, polygon>("disjoint_simplex_rp", disjoint_simplex[0], disjoint_simplex[1], true);
|
||||
test_disjoint<ring, ring>("disjoint_simplex_rr", disjoint_simplex[0], disjoint_simplex[1], true);
|
||||
test_disjoint<polygon, ring>("disjoint_simplex_pr", disjoint_simplex[0], disjoint_simplex[1], true);
|
||||
|
||||
// Testing touch
|
||||
test_disjoint<polygon, polygon>("touch_simplex_pp", touch_simplex[0], touch_simplex[1], false);
|
||||
|
||||
// Testing overlap (and test compiling with box)
|
||||
test_disjoint<polygon, polygon>("overlaps_box_pp", overlaps_box[0], overlaps_box[1], false);
|
||||
test_disjoint<box, polygon>("overlaps_box_bp", overlaps_box[0], overlaps_box[1], false);
|
||||
test_disjoint<box, ring>("overlaps_box_br", overlaps_box[0], overlaps_box[1], false);
|
||||
test_disjoint<polygon, box>("overlaps_box_pb", overlaps_box[1], overlaps_box[0], false);
|
||||
test_disjoint<ring, box>("overlaps_box_rb", overlaps_box[1], overlaps_box[0], false);
|
||||
|
||||
// Test if within(a,b) returns false for disjoint
|
||||
test_disjoint<ring, ring>("within_simplex_rr1", within_simplex[0], within_simplex[1], false);
|
||||
test_disjoint<ring, ring>("within_simplex_rr2", within_simplex[1], within_simplex[0], false);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
return 0;
|
||||
}
|
181
test/algorithms/disjoint.vcproj
Normal file
181
test/algorithms/disjoint.vcproj
Normal file
@ -0,0 +1,181 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="disjoint"
|
||||
ProjectGUID="{96D51D96-B35F-47C8-864D-371DF2280686}"
|
||||
RootNamespace="disjoint"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\disjoint.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
204
test/algorithms/distance.cpp
Normal file
204
test/algorithms/distance.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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)
|
||||
|
||||
//#define TEST_ARRAY
|
||||
|
||||
#include <sstream>
|
||||
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#ifndef TEST_ARRAY
|
||||
#include <boost/geometry/algorithms/make.hpp>
|
||||
#endif
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/boost_array_as_linestring.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_distance_result()
|
||||
{
|
||||
typedef typename boost::geometry::distance_result<P, P>::type distance_type;
|
||||
|
||||
#ifndef TEST_ARRAY
|
||||
P p1 = boost::geometry::make<P>(0, 0);
|
||||
P p2 = boost::geometry::make<P>(3, 0);
|
||||
P p3 = boost::geometry::make<P>(0, 4);
|
||||
#else
|
||||
P p1, p2, p3;
|
||||
boost::geometry::set<0>(p1, 0); boost::geometry::set<1>(p1, 0);
|
||||
boost::geometry::set<0>(p2, 3); boost::geometry::set<1>(p2, 0);
|
||||
boost::geometry::set<0>(p3, 0); boost::geometry::set<1>(p3, 4);
|
||||
#endif
|
||||
|
||||
distance_type dr12 = boost::geometry::distance(p1, p2);
|
||||
distance_type dr13 = boost::geometry::distance(p1, p3);
|
||||
distance_type dr23 = boost::geometry::distance(p2, p3);
|
||||
|
||||
BOOST_CHECK_CLOSE(double(dr12), 3.000, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(dr13), 4.000, 0.001);
|
||||
BOOST_CHECK_CLOSE(double(dr23), 5.000, 0.001);
|
||||
|
||||
// COMPILATION TESTS
|
||||
distance_type comparable = boost::geometry::make_distance_result<distance_type>(3);
|
||||
//BOOST_CHECK_CLOSE(comparable.value(), 9.000, 0.001);
|
||||
|
||||
|
||||
// Question: how to check if the implemented operator is used, and not the auto-conversion to double?
|
||||
if (comparable == dr12) {};
|
||||
if (comparable < dr12) {};
|
||||
if (comparable > dr12) {};
|
||||
|
||||
// Check streamability
|
||||
std::ostringstream s;
|
||||
s << comparable;
|
||||
|
||||
// Check comparisons with plain double
|
||||
double d = 3.0;
|
||||
if (dr12 == d) {};
|
||||
if (dr12 < d) {};
|
||||
if (dr12 > d) {};
|
||||
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_distance_point()
|
||||
{
|
||||
P p1;
|
||||
boost::geometry::set<0>(p1, 1);
|
||||
boost::geometry::set<1>(p1, 1);
|
||||
|
||||
P p2;
|
||||
boost::geometry::set<0>(p2, 2);
|
||||
boost::geometry::set<1>(p2, 2);
|
||||
|
||||
double d = boost::geometry::distance(p1, p2);
|
||||
BOOST_CHECK_CLOSE(d, 1.4142135, 0.001);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_distance_segment()
|
||||
{
|
||||
typedef typename boost::geometry::coordinate_type<P>::type coordinate_type;
|
||||
|
||||
P s1; boost::geometry::set<0>(s1, 2); boost::geometry::set<1>(s1, 2);
|
||||
P s2; boost::geometry::set<0>(s2, 3); boost::geometry::set<1>(s2, 3);
|
||||
|
||||
// Check points left, right, projected-left, projected-right, on segment
|
||||
P p1; boost::geometry::set<0>(p1, 0); boost::geometry::set<1>(p1, 0);
|
||||
P p2; boost::geometry::set<0>(p2, 4); boost::geometry::set<1>(p2, 4);
|
||||
P p3; boost::geometry::set<0>(p3, coordinate_type(2.4)); boost::geometry::set<1>(p3, coordinate_type(2.6));
|
||||
P p4; boost::geometry::set<0>(p4, coordinate_type(2.6)); boost::geometry::set<1>(p4, coordinate_type(2.4));
|
||||
P p5; boost::geometry::set<0>(p5, 2.5); boost::geometry::set<1>(p5, 2.5);
|
||||
|
||||
const boost::geometry::segment<const P> seg(s1, s2);
|
||||
|
||||
double d1 = boost::geometry::distance(p1, seg); BOOST_CHECK_CLOSE(d1, 2.8284271, 0.001);
|
||||
double d2 = boost::geometry::distance(p2, seg); BOOST_CHECK_CLOSE(d2, 1.4142135, 0.001);
|
||||
double d3 = boost::geometry::distance(p3, seg); BOOST_CHECK_CLOSE(d3, 0.141421, 0.001);
|
||||
double d4 = boost::geometry::distance(p4, seg); BOOST_CHECK_CLOSE(d4, 0.141421, 0.001);
|
||||
double d5 = boost::geometry::distance(p5, seg); BOOST_CHECK_CLOSE(d5, 0.0, 0.001);
|
||||
|
||||
// Reverse case
|
||||
double dr1 = boost::geometry::distance(seg, p1); BOOST_CHECK_CLOSE(dr1, d1, 0.001);
|
||||
double dr2 = boost::geometry::distance(seg, p2); BOOST_CHECK_CLOSE(dr2, d2, 0.001);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_distance_linestring()
|
||||
{
|
||||
typedef typename boost::geometry::coordinate_type<P>::type coordinate_type;
|
||||
|
||||
boost::array<P, 2> points;
|
||||
boost::geometry::set<0>(points[0], 1);
|
||||
boost::geometry::set<1>(points[0], 1);
|
||||
boost::geometry::set<0>(points[1], 3);
|
||||
boost::geometry::set<1>(points[1], 3);
|
||||
|
||||
#ifndef TEST_ARRAY
|
||||
P p = boost::geometry::make<P>(2, 1);
|
||||
#else
|
||||
P p;
|
||||
boost::geometry::set<0>(p, 2); boost::geometry::set<1>(p, 1);
|
||||
#endif
|
||||
|
||||
double d = boost::geometry::distance(p, points);
|
||||
BOOST_CHECK_CLOSE(d, 0.70710678, 0.001);
|
||||
|
||||
#ifndef TEST_ARRAY
|
||||
p = boost::geometry::make<P>(5, 5);
|
||||
#else
|
||||
boost::geometry::set<0>(p, 5); boost::geometry::set<1>(p, 5);
|
||||
#endif
|
||||
d = boost::geometry::distance(p, points);
|
||||
BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
|
||||
|
||||
|
||||
boost::geometry::linestring<P> line;
|
||||
#ifndef TEST_ARRAY
|
||||
line.push_back(boost::geometry::make<P>(1,1));
|
||||
line.push_back(boost::geometry::make<P>(2,2));
|
||||
line.push_back(boost::geometry::make<P>(3,3));
|
||||
#else
|
||||
{
|
||||
P lp;
|
||||
boost::geometry::set<0>(lp, 1); boost::geometry::set<1>(lp, 1); line.push_back(lp);
|
||||
boost::geometry::set<0>(lp, 2); boost::geometry::set<1>(lp, 2); line.push_back(lp);
|
||||
boost::geometry::set<0>(lp, 3); boost::geometry::set<1>(lp, 3); line.push_back(lp);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef TEST_ARRAY
|
||||
p = boost::geometry::make<P>(5, 5);
|
||||
#else
|
||||
boost::geometry::set<0>(p, 5); boost::geometry::set<1>(p, 5);
|
||||
#endif
|
||||
|
||||
d = boost::geometry::distance(p, line);
|
||||
BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
|
||||
|
||||
// Reverse case
|
||||
d = boost::geometry::distance(line, p);
|
||||
BOOST_CHECK_CLOSE(d, 2.828427, 0.001);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_distance_result<P>();
|
||||
test_distance_point<P>();
|
||||
test_distance_segment<P>();
|
||||
#ifndef TEST_ARRAY
|
||||
test_distance_linestring<P>();
|
||||
#endif
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
#ifdef TEST_ARRAY
|
||||
//test_all<int[2]>();
|
||||
test_all<float[2]>();
|
||||
test_all<double[2]>();
|
||||
test_all<test::test_point>(); // located here because of 3D
|
||||
#endif
|
||||
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
test_all<boost::tuple<float, float> >();
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/distance.vcproj
Normal file
177
test/algorithms/distance.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="distance"
|
||||
ProjectGUID="{347D08A4-22E9-45B1-A55B-AE84AA2EAA53}"
|
||||
RootNamespace="distance"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\distance"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\distance"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\distance.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
57
test/algorithms/envelope.cpp
Normal file
57
test/algorithms/envelope.cpp
Normal file
@ -0,0 +1,57 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <algorithms/test_envelope.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_2d()
|
||||
{
|
||||
test_envelope<P>("POINT(1 1)", 1, 1, 1, 1);
|
||||
test_envelope<boost::geometry::linestring<P> >("LINESTRING(1 1,2 2)", 1, 2, 1, 2);
|
||||
test_envelope<boost::geometry::polygon<P> >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3);
|
||||
|
||||
test_envelope<boost::geometry::linear_ring<P> >("POLYGON((1 1,1 3,3 3,3 1,1 1))", 1, 3, 1, 3);
|
||||
test_envelope<boost::geometry::box<P> >("BOX(1 1,3 3)", 1, 3, 1, 3);
|
||||
|
||||
typedef std::pair<P, P> segment_type;
|
||||
test_envelope<segment_type>("SEGMENT(1 1,3 3)", 1, 3, 1, 3);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_3d()
|
||||
{
|
||||
test_envelope<P>("POINT(1 2 3)", 1, 1, 2, 2, 3, 3);
|
||||
test_envelope<P>("POINT(3 2 1)", 3, 3, 2, 2, 1, 1);
|
||||
test_envelope<boost::geometry::linestring<P> >("LINESTRING(1 1 1,2 2 2)", 1, 2, 1, 2, 1, 2);
|
||||
test_envelope<boost::geometry::box<P> >("BOX(1 1 1,3 3 3)", 1, 3, 1, 3, 1, 3);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_2d<int[2]>();
|
||||
//test_2d<float[2]>();
|
||||
//test_2d<double[2]>();
|
||||
test_2d<boost::tuple<float, float> >();
|
||||
test_2d<boost::geometry::point_xy<int> >();
|
||||
test_2d<boost::geometry::point_xy<float> >();
|
||||
test_2d<boost::geometry::point_xy<double> >();
|
||||
|
||||
test_3d<test::test_point>();
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/envelope.vcproj
Normal file
182
test/algorithms/envelope.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="envelope"
|
||||
ProjectGUID="{26EFCAF4-7907-4A47-ACBF-6CAB738CDCEB}"
|
||||
RootNamespace="envelope"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\envelope"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\envelope"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\envelope.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
95
test/algorithms/equals.cpp
Normal file
95
test/algorithms/equals.cpp
Normal file
@ -0,0 +1,95 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
//
|
||||
// Copyright Barend Gehrels, Geodan B.V. 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 <algorithms/test_equals.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::box<P> box;
|
||||
typedef boost::geometry::linear_ring<P> ring;
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
|
||||
|
||||
test_geometry<P, P>("p1", "POINT(1 1)", "POINT(1 1)", true);
|
||||
test_geometry<P, P>("p2", "POINT(1 1)", "POINT(1 2)", false);
|
||||
test_geometry<box, box>("b1", "BOX(1 1,2 2)", "BOX(1 2,2 2)", false);
|
||||
test_geometry<box, box>("b1", "BOX(1 2,3 4)", "BOX(1 2,3 4)", true);
|
||||
|
||||
|
||||
std::string case_p1 = "POLYGON((0 0,0 2,2 2,0 0))";
|
||||
|
||||
// Completely equal
|
||||
test_geometry<ring, ring>("poly_eq", case_p1, case_p1, true);
|
||||
// Shifted
|
||||
test_geometry<ring, ring>("poly_sh", "POLYGON((2 2,0 0,0 2,2 2))", case_p1, true);
|
||||
// Extra coordinate
|
||||
test_geometry<ring, ring>("poly_extra", case_p1, "POLYGON((0 0,0 2,2 2,1 1,0 0))", true);
|
||||
// Degenerate points
|
||||
test_geometry<ring, ring>("poly_degenerate", "POLYGON((0 0,0 2,2 2,2 2,0 0))", "POLYGON((0 0,0 2,0 2,2 2,0 0))", true);
|
||||
|
||||
// Two different bends, same area, unequal
|
||||
test_geometry<ring, ring>("poly_bends",
|
||||
"POLYGON((4 0,5 3,8 4,7 7,4 8,0 4,4 0))",
|
||||
"POLYGON((4 0,7 1,8 4,5 5,4 8,0 4,4 0))", false);
|
||||
|
||||
// Unequal (but same area)
|
||||
test_geometry<ring, ring>("poly_uneq", case_p1, "POLYGON((1 1,1 3,3 3,1 1))", false);
|
||||
|
||||
// Polygons, exterior rings equal (shifted)
|
||||
test_geometry<polygon, polygon>("poly_sh2", case_p1, "POLYGON((0 2,2 2,0 0,0 2))", true);
|
||||
|
||||
// One having hole
|
||||
test_geometry<polygon, polygon>("poly_hole", "POLYGON((0 0,0 4,4 4,0 0))", "POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))", false);
|
||||
|
||||
// Both having holes
|
||||
test_geometry<polygon, polygon>("poly_holes",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))", true);
|
||||
|
||||
// Both having holes, outer equal, inner not equal
|
||||
test_geometry<polygon, polygon>("poly_uneq_holes",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1))",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(2 2,3 2,3 3,2 3,2 2))", false);
|
||||
|
||||
// Both having 2 holes, equal but in different order
|
||||
test_geometry<polygon, polygon>("poly_holes_diff_order",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(1 1,2 1,2 2,1 2,1 1),(2 2,3 2,3 3,2 3,2 2))",
|
||||
"POLYGON((0 0,0 4,4 4,0 0),(2 2,3 2,3 3,2 3,2 2),(1 1,2 1,2 2,1 2,1 1))", true);
|
||||
|
||||
// Both having 3 holes, equal but in different order
|
||||
test_geometry<polygon, polygon>("poly_holes_diff_order_3",
|
||||
"POLYGON((0 0,0 10,10 10,0 0),(1 1,2 1,2 2,1 2,1 1),(4 1,5 1,5 2,4 2,4 1),(2 2,3 2,3 3,2 3,2 2))",
|
||||
"POLYGON((0 0,0 10,10 10,0 0),(4 1,5 1,5 2,4 2,4 1),(2 2,3 2,3 3,2 3,2 2),(1 1,2 1,2 2,1 2,1 1))", true);
|
||||
|
||||
// polygon/ring vv
|
||||
test_geometry<polygon, ring>("poly_sh2_pr", case_p1, case_p1, true);
|
||||
test_geometry<ring, polygon>("poly_sh2_rp", case_p1, case_p1, true);
|
||||
|
||||
// Todo: ring/box, poly/box
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int test_main( int , char* [] )
|
||||
{
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
// test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
// test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/equals.vcproj
Normal file
182
test/algorithms/equals.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="equals"
|
||||
ProjectGUID="{E54F493F-BF9D-4A6D-AE2F-5F97AC95251A}"
|
||||
RootNamespace="equals"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\equals"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\equals"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\equals.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
74
test/algorithms/for_each.cpp
Normal file
74
test/algorithms/for_each.cpp
Normal file
@ -0,0 +1,74 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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 <algorithms/test_for_each.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_geometry<P>
|
||||
(
|
||||
"POINT(1 1)"
|
||||
|
||||
// per point
|
||||
, 1
|
||||
, "POINT(101 1)"
|
||||
, "POINT(101 100)"
|
||||
// per segment
|
||||
, ""
|
||||
, 0
|
||||
, "POINT(1 1)"
|
||||
);
|
||||
test_geometry<boost::geometry::linestring<P> >
|
||||
(
|
||||
"LINESTRING(1 1,2 2)"
|
||||
|
||||
, 3
|
||||
, "LINESTRING(101 1,102 2)"
|
||||
, "LINESTRING(101 100,102 200)"
|
||||
|
||||
, "((1, 1), (2, 2))"
|
||||
, std::sqrt(2.0)
|
||||
, "LINESTRING(10 1,2 2)"
|
||||
);
|
||||
test_geometry<boost::geometry::linear_ring<P> >
|
||||
(
|
||||
"POLYGON((1 1,1 4,4 4,4 1,1 1))"
|
||||
|
||||
, 11
|
||||
, "POLYGON((101 1,101 4,104 4,104 1,101 1))"
|
||||
, "POLYGON((101 100,101 400,104 400,104 100,101 100))"
|
||||
|
||||
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1))"
|
||||
, 4 * 3.0
|
||||
, "POLYGON((10 1,10 4,4 4,4 1,1 1))"
|
||||
);
|
||||
test_geometry<boost::geometry::polygon<P> >
|
||||
(
|
||||
"POLYGON((1 1,1 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
|
||||
|
||||
, 23
|
||||
, "POLYGON((101 1,101 4,104 4,104 1,101 1),(102 2,103 2,103 3,102 3,102 2))"
|
||||
, "POLYGON((101 100,101 400,104 400,104 100,101 100),(102 200,103 200,103 300,102 300,102 200))"
|
||||
|
||||
, "((1, 1), (1, 4)) ((1, 4), (4, 4)) ((4, 4), (4, 1)) ((4, 1), (1, 1)) "
|
||||
"((2, 2), (3, 2)) ((3, 2), (3, 3)) ((3, 3), (2, 3)) ((2, 3), (2, 2))"
|
||||
, 4 * 3.0 + 4 * 1.0
|
||||
, "POLYGON((10 1,10 4,4 4,4 1,1 1),(2 2,3 2,3 3,2 3,2 2))"
|
||||
);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point<double, 2, boost::geometry::cs::cartesian> >();
|
||||
return 0;
|
||||
}
|
182
test/algorithms/for_each.vcproj
Normal file
182
test/algorithms/for_each.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="for_each"
|
||||
ProjectGUID="{774F6471-D8A0-481C-9B0A-4903EAD25B70}"
|
||||
RootNamespace="for_each"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\for_each"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\for_each"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\for_each.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
276
test/algorithms/intersection.cpp
Normal file
276
test/algorithms/intersection.cpp
Normal file
@ -0,0 +1,276 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <iostream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <algorithms/test_intersection.hpp>
|
||||
#include <algorithms/test_overlay.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
|
||||
|
||||
#include <test_common/test_point.hpp>
|
||||
#include <test_common/with_pointer.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::linestring<P> linestring;
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
typedef boost::geometry::box<P> box;
|
||||
|
||||
std::string clip = "box(2 2,8 8)";
|
||||
|
||||
// Basic check: box/linestring, is clipping OK? should compile in any order
|
||||
test_one<linestring, linestring, box>("llb", "LINESTRING(0 0,10 10)", clip, 1, 2, sqrt(2.0 * 6.0 * 6.0));
|
||||
test_one<linestring, box, linestring>("lbl", clip, "LINESTRING(0 0,10 10)", 1, 2, sqrt(2.0 * 6.0 * 6.0));
|
||||
|
||||
// Completely inside
|
||||
test_one<linestring, linestring, box>("llbi", "LINESTRING(3 3,7 7)", clip, 1, 2, sqrt(2.0 * 4.0 * 4.0));
|
||||
|
||||
// Completely outside
|
||||
test_one<linestring, linestring, box>("llbo", "LINESTRING(9 9,10 10)", clip, 0, 0, 0);
|
||||
|
||||
// Touching with point (-> output linestring with ONE point)
|
||||
//std::cout << "Note: the output line is degenerate! Might be removed!" << std::endl;
|
||||
test_one<linestring, linestring, box>("llb_touch", "LINESTRING(8 8,10 10)", clip, 1, 1, 0.0);
|
||||
|
||||
// Along border
|
||||
test_one<linestring, linestring, box>("llb_along", "LINESTRING(2 2,2 8)", clip, 1, 2, 6);
|
||||
|
||||
// Outputting two lines (because of 3-4-5 constructions (0.3,0.4,0.5)
|
||||
// which occur 4 times, the length is expected to be 2.0)
|
||||
test_one<linestring, linestring, box>("llb_2", "LINESTRING(1.7 1.6,2.3 2.4,2.9 1.6,3.5 2.4,4.1 1.6)", clip, 2, 6, 4 * 0.5);
|
||||
|
||||
|
||||
test_one<polygon, box, polygon>("boxring", example_box, example_ring,
|
||||
2, 12, 1.09125);
|
||||
|
||||
test_one<polygon, box, polygon>("boxpoly", example_box, example_polygon,
|
||||
3, 19, 0.840166);
|
||||
|
||||
test_one<polygon, polygon, polygon>("star_ring", example_star, example_ring,
|
||||
1, 18, 2.80983);
|
||||
|
||||
test_one<polygon, polygon, polygon>("star_poly", example_star, example_polygon,
|
||||
1, 0, // CLN: 23 points, other types: 22 point (one is merged)
|
||||
2.5020508);
|
||||
|
||||
|
||||
test_one<polygon, box, polygon>("poly1", example_box,
|
||||
"POLYGON((3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2))",
|
||||
2, 12, 1.09125);
|
||||
|
||||
test_one<polygon, box, polygon>("clip_poly2", example_box,
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,5.3 2.5,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))",
|
||||
2, 12, 1.00375);
|
||||
test_one<polygon, box, polygon>("clip_poly3", example_box,
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
|
||||
2, 12, 1.00375);
|
||||
test_one<polygon, box, polygon>("clip_poly4", example_box,
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 2.5,4.5 2.3,5.0 2.3,5.0 2.1,4.5 2.1,4.5 1.9,4.0 1.9,4.5 1.2,4.9 0.8,2.9 0.7,2 1.3))",
|
||||
2, 16, 0.860892);
|
||||
|
||||
test_one<polygon, box, polygon>("clip_poly5", example_box,
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 2.5,4.5 1.2,2.9 0.7,2 1.3))",
|
||||
2, 11, 0.7575961);
|
||||
|
||||
test_one<polygon, box, polygon>("clip_poly6", example_box,
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.0 3.0,5.0 2.0,2.9 0.7,2 1.3))",
|
||||
2, 13, 1.0744456);
|
||||
|
||||
test_one<polygon, box, polygon>("clip_poly7", "box(0 0, 3 3)",
|
||||
"POLYGON((2 2, 1 4, 2 4, 3 3, 2 2))", 1, 4, 0.75);
|
||||
|
||||
test_one<polygon, polygon, polygon>("first_within_second1",
|
||||
first_within_second[0], first_within_second[1],
|
||||
1, 5, 1.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("first_within_second2",
|
||||
first_within_second[1], first_within_second[0],
|
||||
1, 5, 1.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("first_within_hole_of_second",
|
||||
first_within_hole_of_second[0], first_within_hole_of_second[1],
|
||||
0, 0, 0.0);
|
||||
|
||||
// Two forming new hole
|
||||
test_one<polygon, polygon, polygon>("new_hole",
|
||||
new_hole[0], new_hole[1],
|
||||
2, 10, 2.0);
|
||||
|
||||
// Two identical
|
||||
test_one<polygon, polygon, polygon>("identical",
|
||||
identical[0], identical[1],
|
||||
1, 5, 1.0);
|
||||
|
||||
// Two, inside each other, having intersections but holes are disjoint
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_disjoint",
|
||||
intersect_holes_disjoint[0], intersect_holes_disjoint[1],
|
||||
1, 15, 18.0);
|
||||
|
||||
// Two, inside each other, having intersections; holes separate intersections
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect",
|
||||
intersect_holes_intersect[0], intersect_holes_intersect[1],
|
||||
1, 14, 18.25);
|
||||
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_disjoint",
|
||||
intersect_holes_intersect_and_disjoint[0], intersect_holes_intersect_and_disjoint[1],
|
||||
1, 19, 17.25);
|
||||
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_intersect_and_touch",
|
||||
intersect_holes_intersect_and_touch[0], intersect_holes_intersect_and_touch[1],
|
||||
1, 23, 17.25);
|
||||
|
||||
test_one<polygon, polygon, polygon>("intersect_holes_new_ring",
|
||||
intersect_holes_new_ring[0], intersect_holes_new_ring[1],
|
||||
2, 23, 122.1039);
|
||||
|
||||
test_one<polygon, polygon, polygon>("winded",
|
||||
winded[0], winded[1],
|
||||
1, 22, 40.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("two_bends",
|
||||
two_bends[0], two_bends[1],
|
||||
1, 7, 24.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("star_comb_15",
|
||||
star_15, comb_15,
|
||||
28, 150, 189.952883);
|
||||
|
||||
test_one<polygon, polygon, polygon>("simplex_normal",
|
||||
simplex_normal[0], simplex_normal[1],
|
||||
1, 7, 5.47363293);
|
||||
|
||||
test_one<polygon, polygon, polygon>("fitting",
|
||||
fitting[0], fitting[1],
|
||||
0, 0, 0);
|
||||
|
||||
test_one<polygon, polygon, polygon>("dist_zero",
|
||||
distance_zero[0], distance_zero[1],
|
||||
1, 0 /* f: 4, other: 5 */, 0.29516139, 0.01);
|
||||
|
||||
test_one<polygon, polygon, polygon>("ehd",
|
||||
equal_holes_disjoint[0], equal_holes_disjoint[1],
|
||||
1, 20, 81 - 2 * 3 * 3 - 3 * 7);
|
||||
|
||||
test_one<polygon, polygon, polygon>("only_hole_intersections1",
|
||||
only_hole_intersections[0], only_hole_intersections[1],
|
||||
1, 21, 178.090909);
|
||||
test_one<polygon, polygon, polygon>("only_hole_intersection2",
|
||||
only_hole_intersections[0], only_hole_intersections[2],
|
||||
1, 21, 149.090909);
|
||||
|
||||
test_one<polygon, polygon, polygon>("intersect_exterior_and_interiors_winded",
|
||||
intersect_exterior_and_interiors_winded[0], intersect_exterior_and_interiors_winded[1],
|
||||
1, 14, 25.2166667);
|
||||
|
||||
|
||||
|
||||
return;
|
||||
|
||||
|
||||
/*
|
||||
REVERSED cases (should be handled/tested differently)
|
||||
test_one<polygon, polygon, polygon>(102,
|
||||
simplex_normal[0], simplex_reversed[1],
|
||||
1, 7, 24.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>(103,
|
||||
simplex_reversed[0], simplex_normal[1],
|
||||
1, 7, 24.0);
|
||||
|
||||
test_one<polygon, polygon, polygon>(104,
|
||||
simplex_reversed[0], simplex_reversed[1],
|
||||
1, 7, 24.0);
|
||||
*/
|
||||
|
||||
|
||||
// Icovist (submitted by Brandon during Formal Review)
|
||||
// Test the FORWARD case
|
||||
{
|
||||
std::string tn = string_from_type<typename boost::geometry::coordinate_type<P>::type>::name();
|
||||
test_one<polygon, polygon, polygon>("isovist",
|
||||
isovist[0], isovist[1],
|
||||
1,
|
||||
tn == std::string("f") ? 19 : tn == std::string("d") ? 21 : 20,
|
||||
88.19203,
|
||||
tn == std::string("f") ? 0.5 : tn == std::string("d") ? 0.1 : 0.01);
|
||||
}
|
||||
|
||||
|
||||
// Test the REVERSE case - does not give correct results yet
|
||||
/*
|
||||
test_one<polygon, polygon, polygon>("icovist_r",
|
||||
isovist[0], isovist[2],
|
||||
1, 4, 0.29516139, 0.01);
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
test_one<polygon, box, polygon>(99, "box(115041.10 471900.10, 118334.60 474523.40)",
|
||||
"POLYGON ((115483.40 474533.40, 116549.40 474059.20, 117199.90 473762.50, 117204.90 473659.50, 118339.40 472796.90, 118334.50 472757.90, 118315.10 472604.00, 118344.60 472520.90, 118277.90 472419.10, 118071.40 472536.80, 118071.40 472536.80, 117943.10 472287.70, 117744.90 472248.40, 117708.00 472034.50, 117481.90 472056.90, 117481.90 472056.90, 117272.30 471890.10, 117077.90 472161.20, 116146.60 473054.50, 115031.10 473603.30, 115483.40 474533.40))",
|
||||
1, 26, 3727690.74);
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void test_pointer_version()
|
||||
{
|
||||
std::vector<test::test_point_xy*> ln;
|
||||
test::test_point_xy* p;
|
||||
p = new test::test_point_xy; p->x = 0; p->y = 0; ln.push_back(p);
|
||||
p = new test::test_point_xy; p->x = 10; p->y = 10; ln.push_back(p);
|
||||
|
||||
boost::geometry::box<boost::geometry::point_xy<double> > box;
|
||||
boost::geometry::assign(box, 2, 2, 8, 8);
|
||||
|
||||
typedef boost::geometry::linestring<boost::geometry::point_xy<double> > output_type;
|
||||
std::vector<output_type> clip;
|
||||
boost::geometry::intersection_inserter<output_type>(box, ln, std::back_inserter(clip));
|
||||
|
||||
double length = 0;
|
||||
int n = 0;
|
||||
for (std::vector<output_type>::const_iterator it = clip.begin();
|
||||
it != clip.end(); ++it)
|
||||
{
|
||||
length += boost::geometry::length(*it);
|
||||
n += boost::geometry::num_points(*it);
|
||||
}
|
||||
|
||||
BOOST_CHECK_EQUAL(clip.size(), 1);
|
||||
BOOST_CHECK_EQUAL(n, 2);
|
||||
BOOST_CHECK_CLOSE(length, sqrt(2.0 * 6.0 * 6.0), 0.001);
|
||||
|
||||
|
||||
for (unsigned int i = 0; i < ln.size(); i++)
|
||||
{
|
||||
delete ln[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GMP)
|
||||
//test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
//test_pointer_version();
|
||||
return 0;
|
||||
}
|
182
test/algorithms/intersection.vcproj
Normal file
182
test/algorithms/intersection.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="intersection"
|
||||
ProjectGUID="{2FD8EDAB-B3C3-4654-B6C3-B25C12A063D3}"
|
||||
RootNamespace="intersection"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\intersection"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\intersection.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
129
test/algorithms/intersection_segment.cpp
Normal file
129
test/algorithms/intersection_segment.cpp
Normal file
@ -0,0 +1,129 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <algorithm>
|
||||
#include <ostream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/correct.hpp>
|
||||
#include <boost/geometry/algorithms/within.hpp>
|
||||
#include <boost/geometry/algorithms/intersection_segment.hpp>
|
||||
#include <boost/geometry/io/wkt/aswkt.hpp>
|
||||
|
||||
static std::ostream & operator<<(std::ostream &s, const boost::geometry::intersection_result& r)
|
||||
{
|
||||
switch(r)
|
||||
{
|
||||
case boost::geometry::is_intersect_no : s << "is_intersect_no"; break;
|
||||
case boost::geometry::is_intersect : s << "is_intersect"; break;
|
||||
case boost::geometry::is_parallel : s << "is_parallel"; break;
|
||||
case boost::geometry::is_collinear_no : s << "is_collinear_no"; break;
|
||||
case boost::geometry::is_collinear_one : s << "is_collinear_one"; break;
|
||||
case boost::geometry::is_collinear_connect : s << "is_collinear_connect"; break;
|
||||
case boost::geometry::is_collinear_overlap : s << "is_collinear_overlap"; break;
|
||||
case boost::geometry::is_collinear_overlap_opposite : s << "is_collinear_overlap_opposite"; break;
|
||||
case boost::geometry::is_collinear_connect_opposite : s << "is_collinear_connect_opposite"; break;
|
||||
|
||||
// detailed connection results:
|
||||
case boost::geometry::is_intersect_connect_s1p1 : s << "is_intersect_connect_s1p1"; break;
|
||||
case boost::geometry::is_intersect_connect_s1p2 : s << "is_intersect_connect_s1p2"; break;
|
||||
case boost::geometry::is_intersect_connect_s2p1 : s << "is_intersect_connect_s2p1"; break;
|
||||
case boost::geometry::is_intersect_connect_s2p2 : s << "is_intersect_connect_s2p2"; break;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
static std::string as_string(const boost::geometry::intersection_result& r)
|
||||
{
|
||||
std::stringstream out;
|
||||
out << r;
|
||||
return out.str();
|
||||
}
|
||||
|
||||
typedef boost::geometry::point<double> P;
|
||||
typedef boost::geometry::const_segment<P> S;
|
||||
|
||||
|
||||
static void test_intersection(double s1x1, double s1y1, double s1x2, double s1y2,
|
||||
double s2x1, double s2y1, double s2x2, double s2y2,
|
||||
// Expected results
|
||||
boost::geometry::intersection_result expected_result,
|
||||
int exptected_count, const P& exp_p1, const P& exp_p2)
|
||||
{
|
||||
S s1(P(s1x1, s1y1), P(s1x2, s1y2));
|
||||
S s2(P(s2x1, s2y1), P(s2x2, s2y2));
|
||||
std::vector<P> ip;
|
||||
double ra, rb;
|
||||
boost::geometry::intersection_result r = boost::geometry::intersection_s(s1, s2, ra, rb, ip);
|
||||
r = boost::geometry::intersection_connect_result(r, ra, rb);
|
||||
|
||||
BOOST_CHECK_EQUAL(ip.size(), exptected_count);
|
||||
BOOST_CHECK_EQUAL(as_string(expected_result), as_string(r));
|
||||
|
||||
if (ip.size() == 2 && ip[0] != exp_p1)
|
||||
{
|
||||
// Swap results, second point is not as expected, swap results, order is not prescribed,
|
||||
// it might be OK.
|
||||
std::reverse(ip.begin(), ip.end());
|
||||
}
|
||||
|
||||
if (ip.size() >= 1)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(ip[0], exp_p1);
|
||||
}
|
||||
if (ip.size() >= 2)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(ip[1], exp_p2);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
std::cout << exptected_count << " " << r;
|
||||
if (exptected_count >= 1) std::cout << " " << ip[0];
|
||||
if (exptected_count >= 2) std::cout << " " << ip[1];
|
||||
std::cout << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
//BOOST_AUTO_TEST_CASE( test1 )
|
||||
int test_main( int , char* [] )
|
||||
{
|
||||
// Identical cases
|
||||
test_intersection(0,0, 1,1, 0,0, 1,1, boost::geometry::is_collinear_overlap, 2, P(0,0), P(1,1));
|
||||
test_intersection(1,1, 0,0, 0,0, 1,1, boost::geometry::is_collinear_overlap_opposite, 2, P(1,1), P(0,0));
|
||||
test_intersection(0,1, 0,2, 0,1, 0,2, boost::geometry::is_collinear_overlap, 2, P(0,1), P(0,2)); // Vertical
|
||||
test_intersection(0,2, 0,1, 0,1, 0,2, boost::geometry::is_collinear_overlap_opposite, 2, P(0,2), P(0,1)); // Vertical
|
||||
// Overlap cases
|
||||
test_intersection(0,0, 1,1, -0.5,-0.5, 2,2, boost::geometry::is_collinear_overlap, 2, P(0,0), P(1,1));
|
||||
test_intersection(0,0, 1,1, 0.5,0.5, 1.5,1.5, boost::geometry::is_collinear_overlap, 2, P(0.5,0.5), P(1,1));
|
||||
test_intersection(0,0, 0,1, 0,-10, 0,10, boost::geometry::is_collinear_overlap, 2, P(0,0), P(0,1)); // Vertical
|
||||
test_intersection(0,0, 0,1, 0,10, 0,-10, boost::geometry::is_collinear_overlap_opposite, 2, P(0,0), P(0,1)); // Vertical
|
||||
test_intersection(0,0, 1,1, 1,1, 2,2, boost::geometry::is_collinear_connect, 1, P(1,1), P(0,0)); // Single point
|
||||
// Colinear, non overlap cases
|
||||
test_intersection(0,0, 1,1, 1.5,1.5, 2.5,2.5, boost::geometry::is_collinear_no, 0, P(0,0), P(0,0));
|
||||
test_intersection(0,0, 0,1, 0,5, 0,6, boost::geometry::is_collinear_no, 0, P(0,0), P(0,0)); // Vertical
|
||||
// Parallel cases
|
||||
test_intersection(0,0, 1,1, 1,0, 2,1, boost::geometry::is_parallel, 0, P(0,0), P(0,1));
|
||||
// Intersect cases
|
||||
test_intersection(0,2, 4,2, 3,0, 3,4, boost::geometry::is_intersect, 1, P(3,2), P(0,0));
|
||||
// Non intersect cases
|
||||
|
||||
// Single point cases
|
||||
test_intersection(0,0, 0,0, 1,1, 2,2, boost::geometry::is_collinear_no, 0, P(1,1), P(0,0)); // Colinear/no
|
||||
test_intersection(2,2, 2,2, 1,1, 3,3, boost::geometry::is_collinear_one, 1, P(2,2.01), P(0,0)); // On segment
|
||||
test_intersection(1,1, 3,3, 2,2, 2,2, boost::geometry::is_collinear_one, 1, P(2,2), P(0,0)); // On segment
|
||||
test_intersection(1,1, 3,3, 1,1, 1,1, boost::geometry::is_collinear_one, 1, P(1,1), P(0,0)); // On segment, start
|
||||
test_intersection(1,1, 3,3, 3,3, 3,3, boost::geometry::is_collinear_one, 1, P(3,3), P(0,0)); // On segment, end
|
||||
|
||||
return 0;
|
||||
}
|
83
test/algorithms/intersects.cpp
Normal file
83
test/algorithms/intersects.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
//
|
||||
// Copyright Barend Gehrels, Geodan B.V. 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 <algorithms/test_intersects.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <boost/geometry/geometries/cartesian2d.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/linestring.hpp>
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
// intersect <=> ! disjoint
|
||||
// so most tests are done in disjoint test.
|
||||
// We only test compilation of one case.
|
||||
test_geometry<P, boost::geometry::box<P> >("POINT(1 1)", "BOX(0 0,2 2)", true);
|
||||
|
||||
// self-intersecting is not tested in disjoint, so that is done here.
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
|
||||
// Just a normal polygon
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,1.5 2.5,2.5 1.5,4 0,0 0))", false);
|
||||
|
||||
// Self intersecting
|
||||
test_self_intersects<polygon>("POLYGON((1 2,1 1,2 1,2 2.25,3 2.25,3 0,0 0,0 3,3 3,2.75 2,1 2))", true);
|
||||
|
||||
// Self intersecting in last segment
|
||||
test_self_intersects<polygon>("POLYGON((0 2,2 4,2 0,4 2,0 2))", true);
|
||||
|
||||
// Self tangent
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,2 4,0 0))", true);
|
||||
|
||||
// Self tangent in corner
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 4,2 0,0 0))", true);
|
||||
|
||||
// With spike
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 2,6 2,4 2,4 0,0 0))", true);
|
||||
|
||||
// Non intersection, but with duplicate
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 0,4 0,0 0))", false);
|
||||
|
||||
// With many duplicates
|
||||
test_self_intersects<polygon>(
|
||||
"POLYGON((0 0,0 1,0 1,0 1,0 2,0 2,0 3,0 3,0 3,0 3,0 4,2 4,2 4,4 4,4 0,4 0,3 0,3 0,3 0,3 0,3 0,0 0))",
|
||||
false);
|
||||
|
||||
// Hole: interior tangent to exterior
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 2,2 4,3 2,1 2))", true);
|
||||
|
||||
// Hole: interior intersecting exterior
|
||||
test_self_intersects<polygon>("POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,5 4,1 1))", true);
|
||||
|
||||
// Hole: two intersecting holes
|
||||
test_self_intersects<polygon>(
|
||||
"POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,1 3,3 3,3 1,1 1),(2 2,2 3.5,3.5 3.5,3.5 2,2 2))", true);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int test_main( int , char* [] )
|
||||
{
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
//test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/intersects.vcproj
Normal file
182
test/algorithms/intersects.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="intersects"
|
||||
ProjectGUID="{B1A97F62-85CD-4239-BB56-619988B08260}"
|
||||
RootNamespace="intersects"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersects"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\intersects"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\intersects.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
123
test/algorithms/is_convex.cpp
Normal file
123
test/algorithms/is_convex.cpp
Normal file
@ -0,0 +1,123 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <cstddef>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/convex_hull.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/write_wkt.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <boost/geometry/util/as_range.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/stream_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt,
|
||||
std::size_t size_original, std::size_t size_hull,
|
||||
double expected_area)
|
||||
{
|
||||
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
|
||||
typedef typename boost::geometry::point_type<Geometry>::type P;
|
||||
typename boost::geometry::strategy_side
|
||||
<
|
||||
typename boost::geometry::cs_tag<P>::type
|
||||
>::type side;
|
||||
|
||||
typedef typename boost::geometry::range_type<Geometry>::type range_type;
|
||||
typedef typename boost::range_const_iterator<range_type>::type iterator;
|
||||
|
||||
range_type const& range = boost::geometry::as_range<range_type>(geometry);
|
||||
|
||||
iterator it1 = boost::begin(range);
|
||||
iterator it3 = it1++;
|
||||
iterator it2 = it1++;
|
||||
|
||||
for (;
|
||||
it2 != boost::end(range);
|
||||
++it1, ++it2, ++it3)
|
||||
{
|
||||
// Last/closing point
|
||||
if (it1 == boost::end(range))
|
||||
{
|
||||
it1 = boost::begin(range) + 1;
|
||||
}
|
||||
int s = side.apply(*it1, *it2, *it3);
|
||||
|
||||
if (s != 1)
|
||||
{
|
||||
std::cout << "NOT CONVEX!";
|
||||
}
|
||||
if (s == 0)
|
||||
{
|
||||
std::cout << " COLLINEAR!";
|
||||
}
|
||||
|
||||
std::cout
|
||||
<< " " << (*it3)
|
||||
<< " " << boost::geometry::wkt(*it2)
|
||||
<< " " << boost::geometry::wkt(*it1)
|
||||
<< " " << s
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
std::cout << boost::geometry::area(geometry) << " " << boost::geometry::wkt(geometry) << std::endl;
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
// rectangular, with concavity
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))",
|
||||
9, 5, 12.0);
|
||||
|
||||
|
||||
// concavity at start/closing point
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"polygon((1 1,0 2,3 3,1 0,1 1))", 9, 5, 12.0);
|
||||
|
||||
// from sample polygon, with concavity
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
|
||||
", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
|
||||
12, 8, 5.245);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
//test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
// GMP compiles but gives errors in results
|
||||
// TODO: find out what's going wrong here
|
||||
// test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/is_convex.vcproj
Normal file
182
test/algorithms/is_convex.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="is_convex"
|
||||
ProjectGUID="{65EAD0CE-1AC7-4997-B618-55712AD7D8EA}"
|
||||
RootNamespace="is_convex"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\is_convex"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\is_convex"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\is_convex.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
45
test/algorithms/length.cpp
Normal file
45
test/algorithms/length.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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 <algorithms/test_length.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/std_pair_as_segment.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
// 3-4-5 triangle
|
||||
test_geometry<std::pair<P, P> >("LINESTRING(0 0,3 4)", 5);
|
||||
|
||||
// 3-4-5 plus 1-1
|
||||
test_geometry<boost::geometry::linestring<P> >("LINESTRING(0 0,3 4,4 3)", 5 + sqrt(2.0));
|
||||
|
||||
// Geometries with length zero
|
||||
test_geometry<P>("POINT(0 0)", 0);
|
||||
test_geometry<boost::geometry::polygon<P> >("POLYGON((0 0,0 1,1 1,1 0,0 0))", 0);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<int> >();
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/length.vcproj
Normal file
182
test/algorithms/length.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="length"
|
||||
ProjectGUID="{C4D75B1E-34D5-4A98-8535-A9535BE949E4}"
|
||||
RootNamespace="length"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\length"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\length"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\length.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
125
test/algorithms/make.cpp
Normal file
125
test/algorithms/make.cpp
Normal file
@ -0,0 +1,125 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/make.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/write_wkt.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
#include <boost/geometry/geometries/adapted/tuple_cartesian.hpp>
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
using namespace boost::geometry;
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_point_2d()
|
||||
{
|
||||
P p = make<P>((T) 123, (T) 456);
|
||||
BOOST_CHECK_CLOSE( ((double) get<0>(p)), (double) 123, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<1>(p)), (double) 456, 1.0e-6);
|
||||
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_point_3d()
|
||||
{
|
||||
P p = make<P>((T) 123, (T) 456, (T) 789);
|
||||
BOOST_CHECK_CLOSE( ((double) get<0>(p)), (double) 123, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<1>(p)), (double) 456, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<2>(p)), (double) 789, 1.0e-6);
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_box_2d()
|
||||
{
|
||||
typedef box<P> B;
|
||||
B b = make<B>((T) 123, (T) 456, (T) 789, (T) 1011);
|
||||
BOOST_CHECK_CLOSE( ((double) get<min_corner, 0>(b)), (double) 123, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<min_corner, 1>(b)), (double) 456, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<max_corner, 0>(b)), (double) 789, 1.0e-6);
|
||||
BOOST_CHECK_CLOSE( ((double) get<max_corner, 1>(b)), (double) 1011, 1.0e-6);
|
||||
|
||||
b = make_inverse<B>();
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_linestring_2d()
|
||||
{
|
||||
typedef linestring<P> L;
|
||||
|
||||
T coors[][2] = {{1,2}, {3,4}};
|
||||
|
||||
L line = make<L>(coors);
|
||||
|
||||
BOOST_CHECK_EQUAL(line.size(), 2);
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_linestring_3d()
|
||||
{
|
||||
typedef linestring<P> L;
|
||||
|
||||
T coors[][3] = {{1,2,3}, {4,5,6}};
|
||||
|
||||
L line = make<L>(coors);
|
||||
|
||||
BOOST_CHECK_EQUAL(line.size(), 2);
|
||||
//std::cout << dsv(line) << std::endl;
|
||||
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_2d_t()
|
||||
{
|
||||
test_point_2d<T, P>();
|
||||
test_box_2d<T, P>();
|
||||
test_linestring_2d<T, P>();
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_2d()
|
||||
{
|
||||
test_2d_t<int, P>();
|
||||
test_2d_t<float, P>();
|
||||
test_2d_t<double, P>();
|
||||
}
|
||||
|
||||
template <typename T, typename P>
|
||||
void test_3d_t()
|
||||
{
|
||||
test_linestring_3d<T, P>();
|
||||
// test_point_3d<T, test_point>();
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_3d()
|
||||
{
|
||||
test_3d_t<int, P>();
|
||||
test_3d_t<float, P>();
|
||||
test_3d_t<double, P>();
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_2d<int[2]>();
|
||||
//test_2d<float[2]>();
|
||||
//test_2d<double[2]>();
|
||||
test_2d<point<int, 2, cs::cartesian> >();
|
||||
test_2d<point<float, 2, cs::cartesian> >();
|
||||
test_2d<point<double, 2, cs::cartesian> >();
|
||||
|
||||
|
||||
test_3d<point<double, 3, cs::cartesian> >();
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/make.vcproj
Normal file
177
test/algorithms/make.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="make"
|
||||
ProjectGUID="{BCD17F3E-8DF2-4B00-A75E-BF7372D2873B}"
|
||||
RootNamespace="make"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\make"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\make"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\make.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
63
test/algorithms/overlaps.cpp
Normal file
63
test/algorithms/overlaps.cpp
Normal file
@ -0,0 +1,63 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
||||
//
|
||||
// Copyright Barend Gehrels, Geodan B.V. 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 <algorithms/test_overlaps.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <boost/geometry/geometries/cartesian2d.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/linestring.hpp>
|
||||
#include <boost/geometry/geometries/point.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_2d()
|
||||
{
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1, 3 3)", "BOX(0 0,2 2)", true);
|
||||
|
||||
// touch -> false
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1, 3 3)", "BOX(3 3,5 5)", false);
|
||||
|
||||
// disjoint -> false
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1, 3 3)", "BOX(4 4,6 6)", false);
|
||||
|
||||
// within -> false
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,3 3)", false);
|
||||
|
||||
// within+touch -> false
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1, 5 5)", "BOX(2 2,5 5)", false);
|
||||
}
|
||||
|
||||
template <typename P>
|
||||
void test_3d()
|
||||
{
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(0 0 0,2 2 2)", true);
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(3 3 3,5 5 5)", false);
|
||||
test_geometry<boost::geometry::box<P>, boost::geometry::box<P> >("BOX(1 1 1, 3 3 3)", "BOX(4 4 4,6 6 6)", false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
int test_main( int , char* [] )
|
||||
{
|
||||
test_2d<boost::geometry::point_xy<int> >();
|
||||
test_2d<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_2d<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_2d<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
//test_3d<boost::geometry::point<double, 3, boost::geometry::cs::cartesian> >();
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/overlaps.vcproj
Normal file
182
test/algorithms/overlaps.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="overlaps"
|
||||
ProjectGUID="{30C37854-9ED6-4C1E-97FB-BF8637BD5811}"
|
||||
RootNamespace="overlaps"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\overlaps"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\overlaps"
|
||||
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="../../../..;..;../../example/contrib/gd-2.0.35"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;NONDLL;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\overlaps.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
164
test/algorithms/overlay/assemble.cpp
Normal file
164
test/algorithms/overlay/assemble.cpp
Normal file
@ -0,0 +1,164 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2010, Geodan, 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 <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/correct.hpp>
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
#include <boost/geometry/algorithms/union.hpp>
|
||||
#include <boost/geometry/algorithms/intersects.hpp>
|
||||
#include <boost/geometry/algorithms/within.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/cartesian2d.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/write_wkt.hpp>
|
||||
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
template <typename Geometry>
|
||||
inline void test_assemble(std::string const& id, Geometry const& p, Geometry const& q)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
std::vector<Geometry> u, i;
|
||||
bg::union_inserter<Geometry>(p, q, std::back_inserter(u));
|
||||
bg::intersection_inserter<Geometry>(p, q, std::back_inserter(i));
|
||||
|
||||
typedef bg::coordinate_type<Geometry>::type type;
|
||||
type area_p = bg::area(p);
|
||||
type area_q = bg::area(q);
|
||||
type area_i = 0;
|
||||
type area_u = 0;
|
||||
|
||||
BOOST_FOREACH(Geometry const& g, u)
|
||||
{
|
||||
area_u += bg::area(g);
|
||||
}
|
||||
BOOST_FOREACH(Geometry const& g, i)
|
||||
{
|
||||
area_i += bg::area(g);
|
||||
}
|
||||
|
||||
double diff = (area_p + area_q) - area_u - area_i;
|
||||
BOOST_CHECK_CLOSE(diff, 0.0, 0.0001);
|
||||
if (abs(diff) > 0.001)
|
||||
{
|
||||
std::cout
|
||||
<< id << std::endl
|
||||
<< bg::wkt(p) << std::endl
|
||||
<< bg::wkt(q) << std::endl;
|
||||
}
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "assemble_" << id << ".svg";
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<typename boost::geometry::point_type<Geometry>::type> mapper(svg, 500, 500);
|
||||
mapper.add(p);
|
||||
mapper.add(q);
|
||||
mapper.map(p, "fill-opacity:0.6;stroke-opacity:0.9;fill:rgb(0,0,255);stroke:rgb(0,0,255);stroke-width:2");
|
||||
mapper.map(q, "fill-opacity:0.6;stroke-opacity:0.9;fill:rgb(0,255,0);stroke:rgb(0,255,0);stroke-width:2");
|
||||
BOOST_FOREACH(Geometry const& geometry, u)
|
||||
{
|
||||
mapper.map(geometry,
|
||||
"stroke-opacity:0.6;fill:none;stroke:rgb(255,0,255);stroke-width:5");
|
||||
}
|
||||
BOOST_FOREACH(Geometry const& geometry, i)
|
||||
{
|
||||
mapper.map(geometry,
|
||||
"stroke-opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename Polygon>
|
||||
inline bool int_ok(Polygon const& poly)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
typename bg::point_type<Polygon>::type const& pi =
|
||||
bg::interior_rings(poly)[0].front();
|
||||
|
||||
return bg::within(pi, bg::exterior_ring(poly));
|
||||
}
|
||||
|
||||
|
||||
|
||||
void generate()
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
static std::string exteriors[4] = {
|
||||
"(0 0,0 10,10 10,10 0,0 0)",
|
||||
"(1 1,1 9,8 9,8 1,1 1)",
|
||||
"(2 0.5, 0.5 2,0.5 8,2 9.5,6 9.5,8.5 8,8.5 2,7 0.5,2 0.5)",
|
||||
"(3 3,3 7,6 7,6 3,3 3)"
|
||||
};
|
||||
static std::string interiors[4] = {
|
||||
"(2 2,2 8,7 8,7 2,2 2)",
|
||||
"(8.5 1,8.5 2,9.5 2,9.5 1,8.5 1)",
|
||||
"(4 4,4 5,5 5,5 4,4 4)",
|
||||
"(6 4,6 5,9 5,9 4,6 4)"
|
||||
};
|
||||
for (int pe = 0; pe < 4; pe++)
|
||||
{
|
||||
for (int qe = 0; qe < 4; qe++)
|
||||
{
|
||||
for (int pi = 0; pi < 4; pi++)
|
||||
{
|
||||
for (int qi = 0; qi < 4; qi++)
|
||||
{
|
||||
std::string ps = "POLYGON(" + exteriors[pe] + "," + interiors[pi] + ")";
|
||||
std::string qs = "POLYGON(" + exteriors[qe] + "," + interiors[qi] + ")";
|
||||
|
||||
bg::polygon_2d p, q;
|
||||
bg::read_wkt(ps, p);
|
||||
bg::read_wkt(qs, q);
|
||||
bg::correct(p);
|
||||
bg::correct(q);
|
||||
if (! intersects(p)
|
||||
&& ! intersects(q)
|
||||
&& int_ok(p)
|
||||
&& int_ok(q)
|
||||
)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << pe << qe << pi << qi;
|
||||
test_assemble(out.str(), p, q);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if ! defined(GGL_TEST_MULTI)
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
generate();
|
||||
return 0;
|
||||
}
|
||||
#endif
|
182
test/algorithms/overlay/assemble.vcproj
Normal file
182
test/algorithms/overlay/assemble.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="assemble"
|
||||
ProjectGUID="{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
|
||||
RootNamespace="assemble"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\assemble"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\assemble"
|
||||
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;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\assemble.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
181
test/algorithms/overlay/dissolve.cpp
Normal file
181
test/algorithms/overlay/dissolve.cpp
Normal file
File diff suppressed because one or more lines are too long
182
test/algorithms/overlay/dissolve.vcproj
Normal file
182
test/algorithms/overlay/dissolve.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="dissolve"
|
||||
ProjectGUID="{206F83D5-17F9-4856-A1DE-82301DB94439}"
|
||||
RootNamespace="dissolve"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\dissolve"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\dissolve"
|
||||
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;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\dissolve.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
180
test/algorithms/overlay/enrich_intersection_points.cpp
Normal file
180
test/algorithms/overlay/enrich_intersection_points.cpp
Normal file
@ -0,0 +1,180 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <iostream>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
|
||||
//#include <boost/geometry/algorithms/overlay/get_intersection_points.hpp>
|
||||
//#include <boost/geometry/algorithms/overlay/merge_intersection_points.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/enrich_intersection_points.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#define GGL_TEST_OVERLAY_NOT_REVERSED
|
||||
|
||||
#include <overlay_common.hpp>
|
||||
|
||||
#include <boost/algorithm/string/replace.hpp>
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
struct test_enrich_intersection_points
|
||||
{
|
||||
static inline std::string dir(int d)
|
||||
{
|
||||
return d == 0 ? "-" : (d == 1 ? "L" : "R");
|
||||
}
|
||||
|
||||
template <typename G1, typename G2>
|
||||
static void apply(std::string const& id,
|
||||
boost::tuple<int, std::string> const& expected_count_and_center,
|
||||
G1 const& g1, G2 const& g2, double precision)
|
||||
{
|
||||
//std::cout << "#" << id << std::endl;
|
||||
|
||||
typedef boost::geometry::detail::intersection::intersection_point
|
||||
<typename boost::geometry::point_type<G2>::type> ip;
|
||||
typedef typename boost::range_const_iterator<std::vector<ip> >::type iterator;
|
||||
std::vector<ip> ips;
|
||||
|
||||
boost::geometry::get_intersection_points(g1, g2, ips);
|
||||
boost::geometry::merge_intersection_points(ips);
|
||||
boost::geometry::enrich_intersection_points(ips, true);
|
||||
|
||||
std::ostringstream out;
|
||||
out << std::setprecision(2);
|
||||
|
||||
bool first = true;
|
||||
for (iterator it = boost::begin(ips); it != boost::end(ips); ++it, first = false)
|
||||
{
|
||||
out << (first ? "" : ",");
|
||||
for (unsigned int i = 0; i < it->info.size(); i++)
|
||||
{
|
||||
out << dir(it->info[i].direction);
|
||||
}
|
||||
}
|
||||
int n = boost::size(ips);
|
||||
//std::cout << n << " " << out.str() << std::endl;
|
||||
BOOST_CHECK_EQUAL(expected_count_and_center.get<0>(), n);
|
||||
BOOST_CHECK_EQUAL(expected_count_and_center.get<1>(), out.str());
|
||||
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "enrich_ip" << id << ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<typename boost::geometry::point_type<G2>::type> mapper(svg, 500, 500);
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, "fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
for (iterator it = boost::begin(ips); it != boost::end(ips); ++it)
|
||||
{
|
||||
mapper.map(it->point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
std::vector<boost::tuple<int, std::string> > expected;
|
||||
|
||||
/*
|
||||
TODO Will be refactored
|
||||
|
||||
// NOTE: the order is sometimes not really important, in GCC it is sometimes
|
||||
// different from here...
|
||||
|
||||
|
||||
// 1-6
|
||||
expected.push_back(boost::make_tuple(6, "RL,LR,LR,RL,RL,LR"));
|
||||
expected.push_back(boost::make_tuple(8, "RL,LR,LR,RL,RL,LR,LR,RL"));
|
||||
expected.push_back(boost::make_tuple(4, "RLRR,RRRL,RRRL,RRRL"));
|
||||
expected.push_back(boost::make_tuple(12, "RL,LR,RL,LR,LR,RL,RL,LR,LR,RL,LR,RL"));
|
||||
expected.push_back(boost::make_tuple(17, "LR,RL,LR,RRLR,RL,LR,RL,RL,LR,LR,RL,LR,RL,RL,LR,RL,LR"));
|
||||
expected.push_back(boost::make_tuple(2, "--RR,LR"));
|
||||
|
||||
// 7-12
|
||||
expected.push_back(boost::make_tuple(2, "LL,LL"));
|
||||
expected.push_back(boost::make_tuple(2, "RL--,LL--"));
|
||||
expected.push_back(boost::make_tuple(1, "RLLL"));
|
||||
expected.push_back(boost::make_tuple(2, "RL--,LL--"));
|
||||
expected.push_back(boost::make_tuple(1, "RRLR"));
|
||||
expected.push_back(boost::make_tuple(8, "RL,LR,RL,LR,RL,LR,RL,LR"));
|
||||
|
||||
// 13-18
|
||||
expected.push_back(boost::make_tuple(2, "LL--,LL--"));
|
||||
expected.push_back(boost::make_tuple(2, "RL--,LL--"));
|
||||
expected.push_back(boost::make_tuple(2, "RL--,LL--"));
|
||||
expected.push_back(boost::make_tuple(2, "LL,--RL"));
|
||||
expected.push_back(boost::make_tuple(2, "RR--,--LR"));
|
||||
expected.push_back(boost::make_tuple(2, "RR--,--LR"));
|
||||
|
||||
// 19-24
|
||||
expected.push_back(boost::make_tuple(2, "LL,LL"));
|
||||
expected.push_back(boost::make_tuple(0, ""));
|
||||
expected.push_back(boost::make_tuple(0, ""));
|
||||
expected.push_back(boost::make_tuple(1, "RLLLRRLR"));
|
||||
expected.push_back(boost::make_tuple(2, "RL,RLRRRRLR"));
|
||||
expected.push_back(boost::make_tuple(1, "LRRRRRLR"));
|
||||
|
||||
// 25-30
|
||||
expected.push_back(boost::make_tuple(1, "LRRRLLRL"));
|
||||
expected.push_back(boost::make_tuple(1, "LRLLLLLR"));
|
||||
expected.push_back(boost::make_tuple(2, "LR,LRRRRRRL"));
|
||||
expected.push_back(boost::make_tuple(2, "LR,LRLLRRLR"));
|
||||
expected.push_back(boost::make_tuple(2, "RL,LRRRLLLR"));
|
||||
expected.push_back(boost::make_tuple(2, "LR,LRLLLLRL"));
|
||||
|
||||
// 31-36
|
||||
expected.push_back(boost::make_tuple(1, "--LLLL--"));
|
||||
expected.push_back(boost::make_tuple(1, "LR--LLRL"));
|
||||
expected.push_back(boost::make_tuple(1, "LRLLLL--"));
|
||||
expected.push_back(boost::make_tuple(2, "LR,LRLLRR--"));
|
||||
expected.push_back(boost::make_tuple(1, "LRLLRRLR"));
|
||||
expected.push_back(boost::make_tuple(3, "RL,LR,RLLLRRLR"));
|
||||
|
||||
// 37-42
|
||||
expected.push_back(boost::make_tuple(3, "LRRRRRLR,RL,LR"));
|
||||
expected.push_back(boost::make_tuple(3, "LR--RRRL,LR,RL"));
|
||||
expected.push_back(boost::make_tuple(3, "RL,LR,LRRRRRRL"));
|
||||
|
||||
// 43-48
|
||||
expected.push_back(boost::make_tuple(4, "LR,RL,RL,LR"));
|
||||
|
||||
// 49
|
||||
expected.push_back(boost::make_tuple(16, "--RL,RRLR,RRLR,RL,LLRL,RLLLRRLR,RR--,--LR,RLRR,--LL,RL--,RL,RRRL,RL,LR,RRRLRRRL"));
|
||||
|
||||
// 101
|
||||
expected.push_back(boost::make_tuple(3, "RL,LR,RL"));
|
||||
|
||||
// ticket#17
|
||||
expected.push_back(boost::make_tuple(6, "LR,RL,LR,RL,RL,LR"));
|
||||
|
||||
//test_all<boost::geometry::point_xy<float>, test_enrich_intersection_points>(expected);
|
||||
test_all<boost::geometry::point_xy<double>, test_enrich_intersection_points>(expected);
|
||||
//test_all<boost::tuple<double, double>, test_enrich_intersection_points>(expected);
|
||||
|
||||
*/
|
||||
return 0;
|
||||
}
|
182
test/algorithms/overlay/enrich_intersection_points.vcproj
Normal file
182
test/algorithms/overlay/enrich_intersection_points.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="enrich_intersection_points"
|
||||
ProjectGUID="{20FE798A-E4EE-4C87-A988-7317E774D28A}"
|
||||
RootNamespace="enrich_intersection_points"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\enrich_intersection_points"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\enrich_intersection_points"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\enrich_intersection_points.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
848
test/algorithms/overlay/get_turn_info.cpp
Normal file
848
test/algorithms/overlay/get_turn_info.cpp
Normal file
@ -0,0 +1,848 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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 <iostream>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
#include <boost/geometry/geometries/point_xy.hpp>
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <typename P, typename T>
|
||||
void test_with_point(std::string const& caseid,
|
||||
T pi_x, T pi_y, T pj_x, T pj_y, T pk_x, T pk_y,
|
||||
T qi_x, T qi_y, T qj_x, T qj_y, T qk_x, T qk_y,
|
||||
boost::geometry::detail::overlay::method_type expected_method,
|
||||
T ip_x, T ip_y,
|
||||
std::string const& expected,
|
||||
T ip_x2, T ip_y2)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
P pi = bg::make<P>(pi_x, pi_y);
|
||||
P pj = bg::make<P>(pj_x, pj_y);
|
||||
P pk = bg::make<P>(pk_x, pk_y);
|
||||
P qi = bg::make<P>(qi_x, qi_y);
|
||||
P qj = bg::make<P>(qj_x, qj_y);
|
||||
P qk = bg::make<P>(qk_x, qk_y);
|
||||
|
||||
|
||||
typedef bg::detail::overlay::turn_info<P> turn_info;
|
||||
typedef std::vector<turn_info> tp_vector;
|
||||
turn_info model;
|
||||
tp_vector info;
|
||||
bg::detail::overlay::get_turn_info<P, P, turn_info>::apply(pi, pj, pk, qi, qj, qk,
|
||||
model, std::back_inserter(info));
|
||||
|
||||
|
||||
if (info.size() == 0)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(expected_method,
|
||||
boost::geometry::detail::overlay::method_none);
|
||||
}
|
||||
|
||||
std::string detected;
|
||||
std::string method;
|
||||
for (typename tp_vector::const_iterator it = info.begin(); it != info.end(); ++it)
|
||||
{
|
||||
for (int t = 0; t < 2; t++)
|
||||
{
|
||||
detected += bg::operation_char(it->operations[t].operation);
|
||||
method += bg::method_char(it->method);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
std::cout << caseid
|
||||
<< (caseid.find("_") == std::string::npos ? " " : "")
|
||||
<< " " << method
|
||||
<< " " << detected
|
||||
<< " " << order
|
||||
<< std::endl;
|
||||
*/
|
||||
|
||||
|
||||
BOOST_CHECK_EQUAL(detected, expected);
|
||||
|
||||
if (! info.empty())
|
||||
{
|
||||
BOOST_CHECK_EQUAL(info[0].method, expected_method);
|
||||
BOOST_CHECK_CLOSE(bg::get<0>(info[0].point), ip_x, 0.001);
|
||||
BOOST_CHECK_CLOSE(bg::get<1>(info[0].point), ip_y, 0.001);
|
||||
|
||||
if (info.size() > 1)
|
||||
{
|
||||
BOOST_CHECK_EQUAL(info.size(), 2);
|
||||
BOOST_CHECK_EQUAL(info[1].method, expected_method);
|
||||
BOOST_CHECK_CLOSE(bg::get<0>(info[1].point), ip_x2, 0.001);
|
||||
BOOST_CHECK_CLOSE(bg::get<1>(info[1].point), ip_y2, 0.001);
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "get_turn_info_" << caseid
|
||||
<< "_" << string_from_type<typename boost::geometry::coordinate_type<P>::type>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<P> mapper(svg, 500, 500);
|
||||
mapper.add(bg::make<P>(0, 0));
|
||||
mapper.add(bg::make<P>(10, 10));
|
||||
|
||||
bg::linestring<P> p; p.push_back(pi); p.push_back(pj); p.push_back(pk);
|
||||
bg::linestring<P> q; q.push_back(qi); q.push_back(qj); q.push_back(qk);
|
||||
mapper.map(p, "opacity:0.8;stroke:rgb(0,192,0);stroke-width:3");
|
||||
mapper.map(q, "opacity:0.8;stroke:rgb(0,0,255);stroke-width:3");
|
||||
|
||||
std::string style = ";font-family='Verdana';font-weight:bold";
|
||||
std::string align = ";text-anchor:end;text-align:end";
|
||||
int offset = 8;
|
||||
|
||||
mapper.text(pi, "pi", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
mapper.text(pj, "pj", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
mapper.text(pk, "pk", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
|
||||
mapper.text(qi, "qi", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
mapper.text(qj, "qj", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
mapper.text(qk, "qk", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
|
||||
|
||||
int factor = 1; // second info, if any, will go left by factor -1
|
||||
int ch = '1';
|
||||
for (typename tp_vector::const_iterator it = info.begin();
|
||||
it != info.end();
|
||||
++it, factor *= -1, ch++)
|
||||
{
|
||||
bool at_j = it->method == bg::detail::overlay::method_crosses;
|
||||
std::string op;
|
||||
op += bg::operation_char(it->operations[0].operation);
|
||||
align = ";text-anchor:middle;text-align:center";
|
||||
mapper.text(at_j ? pj : pk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
|
||||
|
||||
op.clear();
|
||||
op += bg::operation_char(it->operations[1].operation);
|
||||
mapper.text(at_j ? qj : qk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
|
||||
|
||||
// Map intersection point + method
|
||||
mapper.map(it->point, "opacity:0.8;fill:rgb(255,0,0);stroke:rgb(0,0,100);stroke-width:1");
|
||||
|
||||
op.clear();
|
||||
op += bg::method_char(it->method);
|
||||
if (info.size() != 1)
|
||||
{
|
||||
op += ch;
|
||||
op += " p:"; op += bg::operation_char(it->operations[0].operation);
|
||||
op += " q:"; op += bg::operation_char(it->operations[1].operation);
|
||||
}
|
||||
mapper.text(it->point, op, "fill:rgb(255,0,0)" + style, offset, -offset);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
template <typename P, typename T>
|
||||
void test_both(std::string const& caseid,
|
||||
T pi_x, T pi_y, T pj_x, T pj_y, T pk_x, T pk_y,
|
||||
T qi_x, T qi_y, T qj_x, T qj_y, T qk_x, T qk_y,
|
||||
boost::geometry::detail::overlay::method_type method
|
||||
= boost::geometry::detail::overlay::method_none,
|
||||
T ip_x = -1, T ip_y = -1,
|
||||
std::string const& expected = "",
|
||||
T ip_x2 = -1, T ip_y2 = -1)
|
||||
{
|
||||
test_with_point<P, double>(caseid,
|
||||
pi_x, pi_y, pj_x, pj_y, pk_x, pk_y,
|
||||
qi_x, qi_y, qj_x, qj_y, qk_x, qk_y,
|
||||
method, ip_x, ip_y, expected, ip_x2, ip_y2);
|
||||
|
||||
//return;
|
||||
|
||||
std::string reverse;
|
||||
for (int i = expected.size() - 1; i >= 0; i--)
|
||||
{
|
||||
reverse += expected[i];
|
||||
}
|
||||
if (ip_x2 >= 0 && ip_y2 >= 0)
|
||||
{
|
||||
std::swap(ip_x, ip_x2);
|
||||
std::swap(ip_y, ip_y2);
|
||||
}
|
||||
|
||||
test_with_point<P, double>(caseid + "_r",
|
||||
qi_x, qi_y, qj_x, qj_y, qk_x, qk_y, // q
|
||||
pi_x, pi_y, pj_x, pj_y, pk_x, pk_y, // p
|
||||
method, ip_x, ip_y, reverse, ip_x2, ip_y2);
|
||||
}
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
using namespace boost::geometry::detail::overlay;
|
||||
|
||||
// See powerpoint "doc/testcases/get_turn_info.ppt"
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// "Real" intersections ("i"), or, crossing
|
||||
// ------------------------------------------------------------------------
|
||||
test_both<P, double>("il1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 3, 7, 5, 8, 3, // q
|
||||
method_crosses, 5, 4, "ui");
|
||||
|
||||
test_both<P, double>("il2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 5, 7, 5, 3, 3, // q
|
||||
method_crosses, 5, 5, "ui");
|
||||
|
||||
test_both<P, double>("il3",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 3, 7, 5, 3, 5, // q
|
||||
method_crosses, 5, 4, "ui");
|
||||
|
||||
test_both<P, double>("il4",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 3, 7, 5, 4, 8, // q
|
||||
method_crosses, 5, 4, "ui");
|
||||
|
||||
test_both<P, double>("ir1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 5, 3, 3, 2, 5, // q
|
||||
method_crosses, 5, 4, "iu");
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// TOUCH INTERIOR or touch in the middle ("m")
|
||||
// ------------------------------------------------------------------------
|
||||
test_both<P, double>("ml1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 3, 5, 4, 7, 3, // q
|
||||
method_touch_interior, 5, 4, "ui");
|
||||
|
||||
test_both<P, double>("ml2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 3, 5, 4, 3, 6, // q
|
||||
method_touch_interior, 5, 4, "iu");
|
||||
|
||||
test_both<P, double>("ml3",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 6, 5, 4, 3, 3, // q
|
||||
method_touch_interior, 5, 4, "uu");
|
||||
|
||||
test_both<P, double>("mr1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 3, 5, 4, 3, 3, // q
|
||||
method_touch_interior, 5, 4, "iu");
|
||||
|
||||
test_both<P, double>("mr2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 3, 5, 4, 7, 6, // q
|
||||
method_touch_interior, 5, 4, "ui");
|
||||
|
||||
test_both<P, double>("mr3",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 6, 5, 4, 7, 3, // q
|
||||
method_touch_interior, 5, 4, "ii");
|
||||
|
||||
test_both<P, double>("mcl",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 2, 5, 3, 5, 5, // q
|
||||
method_touch_interior, 5, 3, "cc");
|
||||
|
||||
test_both<P, double>("mcr",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 2, 5, 3, 5, 5, // q
|
||||
method_touch_interior, 5, 3, "cc");
|
||||
|
||||
test_both<P, double>("mclo",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
3, 4, 5, 5, 5, 3, // q
|
||||
method_touch_interior, 5, 5, "ux");
|
||||
|
||||
test_both<P, double>("mcro",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
7, 4, 5, 5, 5, 3, // q
|
||||
method_touch_interior, 5, 5, "ix");
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// COLLINEAR
|
||||
// ------------------------------------------------------------------------
|
||||
test_both<P, double>("cll1",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 5, 5, 7, 3, 8, // q
|
||||
method_collinear, 5, 6, "ui");
|
||||
test_both<P, double>("cll2",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 3, 5, 5, 3, 6, // q
|
||||
method_collinear, 5, 5, "iu");
|
||||
test_both<P, double>("clr1",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 5, 5, 7, 6, 8, // q
|
||||
method_collinear, 5, 6, "ui");
|
||||
test_both<P, double>("clr2",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 3, 5, 5, 6, 6, // q
|
||||
method_collinear, 5, 5, "ui");
|
||||
|
||||
test_both<P, double>("crl1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 5, 5, 7, 3, 8, // q
|
||||
method_collinear, 5, 6, "iu");
|
||||
test_both<P, double>("crl2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 3, 5, 5, 3, 6, // q
|
||||
method_collinear, 5, 5, "iu");
|
||||
test_both<P, double>("crr1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 5, 5, 7, 6, 8, // q
|
||||
method_collinear, 5, 6, "iu");
|
||||
test_both<P, double>("crr2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 3, 5, 5, 6, 6, // q
|
||||
method_collinear, 5, 5, "ui");
|
||||
|
||||
test_both<P, double>("ccx1",
|
||||
5, 1, 5, 6, 5, 8, // p
|
||||
5, 5, 5, 7, 3, 8, // q
|
||||
method_collinear, 5, 6, "cc");
|
||||
test_both<P, double>("cxc1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 3, 5, 5, 5, 7, // q
|
||||
method_collinear, 5, 5, "cc");
|
||||
|
||||
// Bug in case #54 of "overlay_cases.hpp"
|
||||
test_both<P, double>("c_bug1",
|
||||
5, 0, 2, 0, 2, 2, // p
|
||||
4, 0, 1, 0, 1, 2, // q
|
||||
method_collinear, 2, 0, "iu");
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// COLLINEAR OPPOSITE
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
test_both<P, double>("clo1",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 7, 5, 5, 3, 3, // q
|
||||
method_collinear, 5, 6, "ixxu", 5, 5);
|
||||
test_both<P, double>("clo2",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 7, 5, 5, 5, 2, // q
|
||||
method_collinear, 5, 6, "ix");
|
||||
// actually "xxix", xx is skipped everywhere
|
||||
test_both<P, double>("clo3",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 7, 5, 5, 7, 3, // q
|
||||
method_collinear, 5, 6, "ixxi", 5, 5);
|
||||
|
||||
test_both<P, double>("cco1",
|
||||
5, 2, 5, 6, 5, 8, // p
|
||||
5, 7, 5, 5, 3, 3, // q
|
||||
method_collinear, 5, 5, "xu"); // "xuxx"
|
||||
test_both<P, double>("cco2",
|
||||
5, 2, 5, 6, 5, 8, // p
|
||||
5, 7, 5, 5, 5, 2); // q "xxxx"
|
||||
test_both<P, double>("cco3",
|
||||
5, 2, 5, 6, 5, 8, // p
|
||||
5, 7, 5, 5, 7, 3, // q
|
||||
method_collinear, 5, 5, "xi"); // "xixx"
|
||||
|
||||
|
||||
test_both<P, double>("cro1",
|
||||
5, 2, 5, 6, 7, 8, // p
|
||||
5, 7, 5, 5, 3, 3, // q
|
||||
method_collinear, 5, 6, "uxxu", 5, 5);
|
||||
test_both<P, double>("cro2",
|
||||
5, 2, 5, 6, 7, 8, // p
|
||||
5, 7, 5, 5, 5, 2, // q
|
||||
method_collinear, 5, 6, "ux"); // "xxux"
|
||||
test_both<P, double>("cro3",
|
||||
5, 2, 5, 6, 7, 8, // p
|
||||
5, 7, 5, 5, 7, 3, // q
|
||||
method_collinear, 5, 6, "uxxi", 5, 5);
|
||||
|
||||
test_both<P, double>("cxo1",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 5, 5, 3, 3, 1, // q
|
||||
method_collinear, 5, 3, "xu");
|
||||
test_both<P, double>("cxo2",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 5, 5, 3, 5, 0); // q "xx"
|
||||
test_both<P, double>("cxo3",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 5, 5, 3, 7, 1, // q
|
||||
method_collinear, 5, 3, "xi");
|
||||
|
||||
test_both<P, double>("cxo4",
|
||||
5, 2, 5, 6, 3, 8, // p
|
||||
5, 7, 5, 1, 3, 0, // q
|
||||
method_collinear, 5, 6, "ix");
|
||||
test_both<P, double>("cxo5",
|
||||
5, 2, 5, 6, 5, 8, // p
|
||||
5, 7, 5, 1, 3, 0); // q "xx"
|
||||
test_both<P, double>("cxo6",
|
||||
5, 2, 5, 6, 7, 8, // p
|
||||
5, 7, 5, 1, 3, 0, // q
|
||||
method_collinear, 5, 6, "ux");
|
||||
|
||||
|
||||
// Verify
|
||||
test_both<P, double>("cvo1",
|
||||
5, 3, 5, 7, 7, 9, // p
|
||||
5, 5, 5, 3, 3, 1 // q
|
||||
);
|
||||
test_both<P, double>("cvo2",
|
||||
5, 3, 5, 7, 7, 9, // p
|
||||
5, 4, 5, 2, 3, 0 // q
|
||||
);
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------
|
||||
// TOUCH - both same
|
||||
// ------------------------------------------------------------------------
|
||||
// Both left, Q turns right
|
||||
test_both<P, double>("blr1",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("blr2",
|
||||
5, 1, 5, 6, 1, 4, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("blr3",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("blr4",
|
||||
5, 1, 5, 6, 1, 8, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "xu");
|
||||
test_both<P, double>("blr5",
|
||||
5, 1, 5, 6, 4, 8, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
test_both<P, double>("blr6",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
|
||||
test_both<P, double>("blr7",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 7, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ix");
|
||||
test_both<P, double>("blr8",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 6, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "xx");
|
||||
test_both<P, double>("blr9",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 5, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ux");
|
||||
|
||||
// Variants
|
||||
test_both<P, double>("blr7-a",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
5, 8, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ix");
|
||||
test_both<P, double>("blr7-b", // in fact NOT "both-left"
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
6, 8, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ix");
|
||||
|
||||
// To check if "collinear-check" on other side
|
||||
// does not apply to this side
|
||||
test_both<P, double>("blr6-c1",
|
||||
5, 1, 5, 6, 7, 5, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
test_both<P, double>("blr6-c2",
|
||||
5, 1, 5, 6, 7, 7, // p
|
||||
3, 7, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
|
||||
|
||||
|
||||
// Both right, Q turns right
|
||||
test_both<P, double>("brr1",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
test_both<P, double>("brr2",
|
||||
5, 1, 5, 6, 9, 4, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "xu");
|
||||
test_both<P, double>("brr3",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("brr4",
|
||||
5, 1, 5, 6, 9, 8, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("brr5",
|
||||
5, 1, 5, 6, 6, 8, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("brr6",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
7, 5, 5, 6, 7, 7, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
|
||||
// Both right, Q turns left
|
||||
test_both<P, double>("brl1",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("brl2",
|
||||
5, 1, 5, 6, 9, 4, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("brl3",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("brl4",
|
||||
5, 1, 5, 6, 9, 8, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "xi");
|
||||
test_both<P, double>("brl5",
|
||||
5, 1, 5, 6, 6, 8, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
test_both<P, double>("brl6",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
7, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
test_both<P, double>("brl7",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 7, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ux");
|
||||
test_both<P, double>("brl8",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 6, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "xx");
|
||||
test_both<P, double>("brl9",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 5, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ix");
|
||||
|
||||
// Variants
|
||||
test_both<P, double>("brl7-a",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
5, 8, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ux");
|
||||
test_both<P, double>("brl7-b", // in fact NOT "both right"
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
4, 8, 5, 6, 5, 3, // q
|
||||
method_touch, 5, 6, "ux");
|
||||
|
||||
|
||||
|
||||
// Both left, Q turns left
|
||||
test_both<P, double>("bll1",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
test_both<P, double>("bll2",
|
||||
5, 1, 5, 6, 1, 4, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "xi");
|
||||
test_both<P, double>("bll3",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("bll4",
|
||||
5, 1, 5, 6, 1, 8, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("bll5",
|
||||
5, 1, 5, 6, 4, 8, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("bll6",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
3, 5, 5, 6, 3, 7, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
|
||||
// TOUCH - COLLINEAR + one side
|
||||
// Collinear/left, Q turns right
|
||||
test_both<P, double>("t-clr1",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
5, 8, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("t-clr2",
|
||||
5, 1, 5, 6, 1, 4, // p
|
||||
5, 8, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("t-clr3",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
5, 8, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("t-clr4",
|
||||
5, 1, 5, 6, 5, 8, // p
|
||||
5, 8, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "xu");
|
||||
// 5 n.a.
|
||||
test_both<P, double>("t-clr6",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
5, 8, 5, 6, 3, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
|
||||
// Collinear/right, Q turns right
|
||||
test_both<P, double>("t-crr1",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
7, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
test_both<P, double>("t-crr2",
|
||||
5, 1, 5, 6, 9, 4, // p
|
||||
7, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "xu");
|
||||
test_both<P, double>("t-crr3",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
7, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("t-crr4",
|
||||
5, 1, 5, 6, 5, 9, // p
|
||||
7, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
// 5 n.a.
|
||||
test_both<P, double>("t-crr6",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
7, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
|
||||
// Collinear/right, Q turns left
|
||||
test_both<P, double>("t-crl1",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
5, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("t-crl2",
|
||||
5, 1, 5, 6, 9, 4, // p
|
||||
5, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("t-crl3",
|
||||
5, 1, 5, 6, 7, 6, // p
|
||||
5, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("t-crl4",
|
||||
5, 1, 5, 6, 5, 8, // p
|
||||
5, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "xi");
|
||||
// 5 n.a.
|
||||
test_both<P, double>("t-crl6",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
5, 7, 5, 6, 7, 5, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
|
||||
// Collinear/left, Q turns left
|
||||
test_both<P, double>("t-cll1",
|
||||
5, 1, 5, 6, 4, 4, // p
|
||||
3, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
test_both<P, double>("t-cll2",
|
||||
5, 1, 5, 6, 1, 4, // p
|
||||
3, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "xi");
|
||||
test_both<P, double>("t-cll3",
|
||||
5, 1, 5, 6, 3, 6, // p
|
||||
3, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("t-cll4",
|
||||
5, 1, 5, 6, 5, 9, // p
|
||||
3, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
// 5 n.a.
|
||||
test_both<P, double>("t-cll6",
|
||||
5, 1, 5, 6, 6, 4, // p
|
||||
3, 5, 5, 6, 5, 8, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
|
||||
// Left to right
|
||||
test_both<P, double>("lr1",
|
||||
5, 1, 5, 6, 3, 3, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ii");
|
||||
test_both<P, double>("lr2",
|
||||
5, 1, 5, 6, 1, 5, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "xi");
|
||||
test_both<P, double>("lr3",
|
||||
5, 1, 5, 6, 4, 8, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("lr4",
|
||||
5, 1, 5, 6, 9, 5, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("lr5",
|
||||
5, 1, 5, 6, 7, 3, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
// otherwise case more thoroughly
|
||||
test_both<P, double>("lr3a",
|
||||
5, 1, 5, 6, 1, 6, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("lr3b",
|
||||
5, 1, 5, 6, 5, 10, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("lr3c",
|
||||
5, 1, 5, 6, 8, 9, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("lr3d",
|
||||
5, 1, 5, 6, 9, 7, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("lr3e",
|
||||
5, 1, 5, 6, 9, 6, // p
|
||||
1, 5, 5, 6, 9, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
|
||||
// Right to left
|
||||
test_both<P, double>("rl1",
|
||||
5, 1, 5, 6, 3, 3, // p
|
||||
9, 5, 5, 6, 1, 5, // q
|
||||
method_touch, 5, 6, "ui");
|
||||
test_both<P, double>("rl2",
|
||||
5, 1, 5, 6, 1, 5, // p
|
||||
9, 5, 5, 6, 1, 5, // q
|
||||
method_touch, 5, 6, "cc");
|
||||
test_both<P, double>("rl3",
|
||||
5, 1, 5, 6, 4, 8, // p
|
||||
9, 5, 5, 6, 1, 5, // q
|
||||
method_touch, 5, 6, "iu");
|
||||
test_both<P, double>("rl4",
|
||||
5, 1, 5, 6, 9, 5, // p
|
||||
9, 5, 5, 6, 1, 5, // q
|
||||
method_touch, 5, 6, "xu");
|
||||
test_both<P, double>("rl5",
|
||||
5, 1, 5, 6, 7, 3, // p
|
||||
9, 5, 5, 6, 1, 5, // q
|
||||
method_touch, 5, 6, "uu");
|
||||
|
||||
// Equal (p1/q1 are equal)
|
||||
test_both<P, double>("ebl1",
|
||||
5, 1, 5, 6, 3, 4, // p
|
||||
5, 1, 5, 6, 3, 8, // q
|
||||
method_equal, 5, 6, "ui");
|
||||
test_both<P, double>("ebl2",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 1, 5, 6, 3, 4, // q
|
||||
method_equal, 5, 6, "iu");
|
||||
test_both<P, double>("ebl3",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 1, 5, 6, 3, 8, // q
|
||||
method_equal, 5, 6, "cc");
|
||||
|
||||
test_both<P, double>("ebl3-c1",
|
||||
5, 1, 5, 6, 10, 1, // p
|
||||
5, 1, 5, 6, 3, 8, // q
|
||||
method_equal, 5, 6, "iu");
|
||||
|
||||
test_both<P, double>("ebr1",
|
||||
5, 1, 5, 6, 7, 4, // p
|
||||
5, 1, 5, 6, 7, 8, // q
|
||||
method_equal, 5, 6, "iu");
|
||||
test_both<P, double>("ebr2",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 1, 5, 6, 7, 4, // q
|
||||
method_equal, 5, 6, "ui");
|
||||
test_both<P, double>("ebr3",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 1, 5, 6, 7, 8, // q
|
||||
method_equal, 5, 6, "cc");
|
||||
|
||||
test_both<P, double>("ebr3-c1",
|
||||
5, 1, 5, 6, 0, 1, // p
|
||||
5, 1, 5, 6, 7, 8, // q
|
||||
method_equal, 5, 6, "ui");
|
||||
|
||||
test_both<P, double>("elr1",
|
||||
5, 1, 5, 6, 7, 8, // p
|
||||
5, 1, 5, 6, 3, 8, // q
|
||||
method_equal, 5, 6, "iu");
|
||||
test_both<P, double>("elr2",
|
||||
5, 1, 5, 6, 3, 8, // p
|
||||
5, 1, 5, 6, 7, 8, // q
|
||||
method_equal, 5, 6, "ui");
|
||||
test_both<P, double>("ec1",
|
||||
5, 1, 5, 6, 5, 8, // p
|
||||
5, 1, 5, 6, 5, 8, // q
|
||||
method_equal, 5, 6, "cc");
|
||||
test_both<P, double>("ec2",
|
||||
5, 1, 5, 6, 5, 8, // p
|
||||
5, 1, 5, 6, 5, 7, // q
|
||||
method_equal, 5, 6, "cc");
|
||||
|
||||
test_both<P, double>("snl-1",
|
||||
0, 3, 2, 3, 4, 3, // p
|
||||
4, 3, 2, 3, 0, 3, // q
|
||||
method_touch, 2, 3, "xx");
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
#include <boost/geometry/geometries/adapted/c_array_as_linestring.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_as_ring.hpp>
|
||||
#include <boost/geometry/geometries/adapted/c_array_cartesian.hpp>
|
||||
|
||||
template <typename G>
|
||||
void test2(G const& geometry)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<G>::type P;
|
||||
typedef typename boost::geometry::tag<G>::type T;
|
||||
typedef typename boost::geometry::tag<P>::type PT;
|
||||
std::cout << typeid(G).name() << std::endl;
|
||||
std::cout << typeid(T).name() << std::endl;
|
||||
std::cout << typeid(P).name() << std::endl;
|
||||
std::cout << typeid(PT).name() << std::endl;
|
||||
|
||||
|
||||
std::cout << boost::geometry::length(geometry) << std::endl;
|
||||
|
||||
typedef boost::geometry::point<float, 3, boost::geometry::cs::cartesian> P2;
|
||||
boost::geometry::linestring<P2> out;
|
||||
boost::geometry::strategy::transform::scale_transformer<float[3], P2> scaler(5);
|
||||
boost::geometry::transform(geometry, out, scaler);
|
||||
std::cout << boost::geometry::dsv(out) << std::endl;
|
||||
}
|
||||
|
||||
void test_f3()
|
||||
{
|
||||
float vertices[][3] = {
|
||||
{-1, -1, 1}, {1, -1, 1}, {1, 1, 1}, {-1, 1, 1},
|
||||
{-1, -1, -1}, {1, -1, -1}, {1, 1, -1}, {-1, 1, -1}
|
||||
};
|
||||
test2(vertices);
|
||||
}
|
||||
***/
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
return 0;
|
||||
}
|
182
test/algorithms/overlay/get_turn_info.vcproj
Normal file
182
test/algorithms/overlay/get_turn_info.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="get_turn_info"
|
||||
ProjectGUID="{8D98821A-5033-4616-9AF4-2AEAA42D8456}"
|
||||
RootNamespace="get_turn_info"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\get_turn_info"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\get_turn_info"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\get_turn_info.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
BIN
test/algorithms/overlay/get_turn_info.xls
Normal file
BIN
test/algorithms/overlay/get_turn_info.xls
Normal file
Binary file not shown.
291
test/algorithms/overlay/get_turns.cpp
Normal file
291
test/algorithms/overlay/get_turns.cpp
Normal file
@ -0,0 +1,291 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <iostream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/overlay/get_turns.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
|
||||
|
||||
|
||||
#include <overlay_common.hpp>
|
||||
#include <overlay_cases.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
// To test that "get_turns" can be called using additional information
|
||||
template <typename P>
|
||||
struct my_turn_op : public boost::geometry::detail::overlay::turn_operation
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
struct test_get_turns
|
||||
{
|
||||
template <typename G1, typename G2>
|
||||
static void apply(std::string const& id,
|
||||
boost::tuple<int, double, double> const& expected_count_and_center,
|
||||
G1 const& g1, G2 const& g2, double precision)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
typedef bg::detail::overlay::turn_info
|
||||
<
|
||||
typename boost::geometry::point_type<G2>::type
|
||||
> turn_info;
|
||||
std::vector<turn_info> turns;
|
||||
|
||||
bg::detail::get_turns::no_interrupt_policy policy;
|
||||
bg::get_turns<bg::detail::overlay::assign_null_policy>(g1, g2, turns, policy);
|
||||
|
||||
BOOST_CHECK_MESSAGE(
|
||||
expected_count_and_center.get<0>() == boost::size(turns),
|
||||
"get_turns: " << id
|
||||
<< " #turns expected: " << expected_count_and_center.get<0>()
|
||||
<< " detected: " << boost::size(turns)
|
||||
<< " type: " << string_from_type
|
||||
<typename bg::coordinate_type<G1>::type>::name()
|
||||
);
|
||||
|
||||
|
||||
typedef typename bg::coordinate_type<G1>::type coordinate_type;
|
||||
/*
|
||||
coordinate_type x = 0, y = 0;
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
{
|
||||
x += bg::get<0>(turn.point);
|
||||
y += bg::get<1>(turn.point);
|
||||
}
|
||||
|
||||
int n = boost::size(turns);
|
||||
if (n > 0)
|
||||
{
|
||||
x /= n;
|
||||
y /= n;
|
||||
}
|
||||
std::cout << std::setprecision(8) << x << ", " << y << " "
|
||||
<< expected_count_and_center.get<1>()
|
||||
<< " " << expected_count_and_center.get<2>()
|
||||
<< std::endl;
|
||||
*/
|
||||
|
||||
|
||||
// Obsolete test (too much work)
|
||||
//BOOST_CHECK_CLOSE(expected_count_and_center.get<1>(), x, precision);
|
||||
//BOOST_CHECK_CLOSE(expected_count_and_center.get<2>(), y, precision);
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::map<std::pair<coordinate_type, coordinate_type>, int> offsets;
|
||||
std::ostringstream filename;
|
||||
filename << "get_turns_" << id
|
||||
<< "_" << string_from_type<typename bg::coordinate_type<G1>::type>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<typename bg::point_type<G2>::type> mapper(svg, 500, 500);
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, "fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
int index = 0;
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
{
|
||||
mapper.map(turn.point, "fill:rgb(255,128,0);stroke:rgb(0,0,100);stroke-width:1");
|
||||
|
||||
// Map characteristics
|
||||
std::pair<coordinate_type, coordinate_type> p
|
||||
= std::make_pair(bg::get<0>(turn.point), bg::get<1>(turn.point));
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << index
|
||||
<< ": " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " " << bg::operation_char(turn.operations[1].operation)
|
||||
<< " (" << bg::method_char(turn.method) << ")"
|
||||
<< (turn.ignore ? " (ignore) " : " ")
|
||||
;
|
||||
|
||||
offsets[p] += 10;
|
||||
int offset = offsets[p];
|
||||
mapper.text(turn.point, out.str(),
|
||||
"fill:rgb(0,0,0);font-family:Arial;font-size:8px",
|
||||
5, offset);
|
||||
}
|
||||
|
||||
++index;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if ! defined(GGL_TEST_MULTI)
|
||||
template <typename T>
|
||||
void test_all()
|
||||
{
|
||||
typedef boost::geometry::point<T, 2, boost::geometry::cs::cartesian> P;
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
typedef boost::geometry::linestring<P> linestring;
|
||||
typedef boost::geometry::box<P> box;
|
||||
|
||||
// Expected count, average x, average y
|
||||
typedef boost::tuple<int, double, double> Tuple;
|
||||
|
||||
std::cout << string_from_type<T>::name() << std::endl;
|
||||
|
||||
|
||||
// snl
|
||||
/*
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("snl_2",
|
||||
boost::make_tuple(5, -122.27866617838542, 37.377897262573242),
|
||||
//snl-1
|
||||
//"POLYGON((182467 605842,182480 605954,182557 605958,182571 605958,182585 605958,182579 605843,182559 605838,182467 605842))",
|
||||
//"POLYGON((182499 605955,182511 605960,182536 605974,182536 605981,182536 606006,182563 606006,182610 605985,182613 605976,182620 605948,182628 605937,182631 605924,182639 605889,182634 605885,182603 605848,182579 605843,182585 605958,182571 605958,182557 605958,182499 605955))");
|
||||
//snl-2
|
||||
//"POLYGON((120812 525783,120845 525792,120821 525842,120789 525826,120818 525849,120831 525854,120875 525875,120887 525881,120887 525881,120920 525834,120920 525834,120811 525772,120789 525826,120812 525783))",
|
||||
//"POLYGON((120789 525826,120812 525783,120845 525792,120821 525842,120789 525826,120818 525849,120831 525854,120875 525875,120923 525836,120811 525772,120789 525826))"
|
||||
//snl-4
|
||||
"POLYGON((184913.4512400339881423860788345336914 606985.779408219968900084495544433594,184912.8999999999941792339086532592773 606987.145999999949708580970764160156,184904.4135310589917935431003570556641 606987.651360383024439215660095214844,184901.847619076987029984593391418457 607014.593436188995838165283203125,184916.3977574919990729540586471557617 607021.060164373018778860569000244141,184927.7147701499925460666418075561523 607008.126435620011761784553527832031,184926.0980706939881201833486557006836 606998.426238880958408117294311523438,184913.4512400339881423860788345336914 606985.779408219968900084495544433594),(184907.5560000000114087015390396118164 607013.300999999977648258209228515625,184905.7820000000065192580223083496094 607009.971999999950639903545379638672,184906.0039999999862629920244216918945 607005.978000000002793967723846435547,184908.4439999999885912984609603881836 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999999993480741977691650391,184919.3140000000130385160446166992188 606993.996000000042840838432312011719,184922.4200000000128056854009628295898 606995.770999999949708580970764160156,184925.7470000000030267983675003051758 606998.876999999978579580783843994141,184926.4130000000004656612873077392578 607002.871999999973922967910766601563,184925.7470000000030267983675003051758 607007.753000000026077032089233398438,184922.4200000000128056854009628295898 607012.190999999991618096828460693359,184917.0959999999904539436101913452148 607015.297999999951571226119995117188,184911.7710000000079162418842315673828 607015.297999999951571226119995117188,184907.5560000000114087015390396118164 607013.300999999977648258209228515625))",
|
||||
"POLYGON((184861.1180000010062940418720245361328 606901.158000000054016709327697753906,184893.7870000000111758708953857421875 606898.482999998959712684154510498047,184925.0430000009946525096893310546875 606913.399999998975545167922973632813,184927.1739999990095384418964385986328 606951.758999999961815774440765380859,184912.8999999990046489983797073364258 606987.146000002045184373855590820313,184877.8700000010139774531126022338867 606989.232000001007691025733947753906,184885.1030000000027939677238464355469 607023.773999999975785613059997558594,184899.0579999980109278112649917602539 607022.743000000948086380958557128906,184906.0080000009911600500345230102539 607044.947999999043531715869903564453,184966.4649999999965075403451919555664 607025.020000000018626451492309570313,184968.4420000019890721887350082397461 606961.300000000977888703346252441406,185024.7679999989923089742660522460938 606947.401999998954124748706817626953,185024.5439999999944120645523071289063 606941.354999999981373548507690429688,185027.0069999989937059581279754638672 606937.322999999043531715869903564453,185030.3660000000090803951025009155273 606934.186999998986721038818359375,185035.5159999990137293934822082519531 606933.962999999988824129104614257813,185040.4420000019890721887350082397461 606935.530999999027699232101440429688,185042.905000000988366082310676574707 606939.114999998011626303195953369141,185088.3640000000013969838619232177734 606931.385000001988373696804046630859,185089.1389999990060459822416305541992 607015.508999999961815774440765380859,185095.1999999989930074661970138549805 607011.300000000977888703346252441406,185118.8269999999902211129665374755859 606995.545000002020969986915588378906,185126.813000001013278961181640625 606991.9950000010430812835693359375,185177.7270000019925646483898162841797 606973.798999998951330780982971191406,185181.4820000010076910257339477539063 606966.67599999904632568359375,185193.5709999990067444741725921630859 606977.795000002020969986915588378906,185193.710999998991610482335090637207 606960.300000000977888703346252441406,185189.3520000019925646483898162841797 606779.020000000018626451492309570313,185167.5150000010035000741481781005859 606783.844000000972300767898559570313,185086.9600000010104849934577941894531 606801.241000000038184225559234619141,185011.7069999990053474903106689453125 606817.809000000008381903171539306641,185000 606819.304000001051463186740875244141,184994.0340000019932631403207778930664 606819.793999999994412064552307128906,184976.3979999980074353516101837158203 606819.572000000975094735622406005859,184956.6539999989909119904041290283203 606817.1310000009834766387939453125,184934.9129999990109354257583618164063 606813.136999998008832335472106933594,184893.0969999989902134984731674194336 606804.927000000956468284130096435547,184884.4450000000069849193096160888672 606831.555000000051222741603851318359,184866.9189999999944120645523071289063 606883.480999998981133103370666503906,184861.1180000010062940418720245361328 606901.158000000054016709327697753906),(184907.5560000019904691725969314575195 607013.30099999904632568359375,184905.7820000019855797290802001953125 607009.971999999019317328929901123047,184906.0040000010048970580101013183594 607005.978000000002793967723846435547,184908.4439999980095308274030685424805 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999998014420270919799804688,184919.3139999989944044500589370727539 606993.995999998995102941989898681641,184922.420000001991866156458854675293 606995.771000002045184373855590820313,184925.7470000009925570338964462280273 606998.876999999978579580783843994141,184926.4129999990109354257583618164063 607002.872000001021660864353179931641,184925.7470000009925570338964462280273 607007.752999998978339135646820068359,184922.420000001991866156458854675293 607012.190999999991618096828460693359,184917.0960000010090880095958709716797 607015.297999999951571226119995117188,184911.7710000019869767129421234130859 607015.297999999951571226119995117188,184907.5560000019904691725969314575195 607013.30099999904632568359375))"
|
||||
);
|
||||
|
||||
|
||||
return;
|
||||
*/
|
||||
|
||||
// 1-6
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("1", boost::make_tuple(6, 2.2547802, 3.0358056), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("2", boost::make_tuple(8, 2.5, 2.5), case_2[0], case_2[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("3", boost::make_tuple(4, 2.5, 2.5), case_3[0], case_3[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("4", boost::make_tuple(12, 2.5, 2.5), case_4[0], case_4[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("5", boost::make_tuple(17, 2.5987395, 2.4166667), case_5[0], case_5[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("6", boost::make_tuple(3, 3, 2.5), case_6[0], case_6[1]);
|
||||
|
||||
// 7-12
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("7", boost::make_tuple(2, 3, 2.5), case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("8", boost::make_tuple(2, 2, 2), case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("9", boost::make_tuple(1, 2, 2), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("10", boost::make_tuple(3, 2, 2), case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("11", boost::make_tuple(1, 2, 2), case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("12", boost::make_tuple(8, 2, 3.25), case_12[0], case_12[1]);
|
||||
|
||||
// 13-18
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("13", boost::make_tuple(2, 1.5, 1.5), case_13[0], case_13[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("14", boost::make_tuple(2, 2, 2), case_14[0], case_14[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("15", boost::make_tuple(2, 2, 2), case_15[0], case_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("16", boost::make_tuple(4, 1.5, 2.5), case_16[0], case_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("17", boost::make_tuple(2, 2, 2), case_17[0], case_17[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("18", boost::make_tuple(4, 2, 2), case_18[0], case_18[1]);
|
||||
|
||||
// 19-24
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("19", boost::make_tuple(2, 3, 2.5), case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("20", boost::make_tuple(3, 0, 0), case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("21", boost::make_tuple(3, 0, 0), case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("22", boost::make_tuple(1, 4, 2), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("23", boost::make_tuple(2, 3.2, 2.2), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("24", boost::make_tuple(1, 4, 2), case_24[0], case_24[1]);
|
||||
|
||||
// 25-30
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("25", boost::make_tuple(1, 4, 2), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("26", boost::make_tuple(1, 4, 2), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("27", boost::make_tuple(2, 3.04545, 1.36363), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("28", boost::make_tuple(2, 3.04545, 1.36363), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("29", boost::make_tuple(2, 3.2, 2.2), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("30", boost::make_tuple(2, 2, 1.75), case_30[0], case_30[1]);
|
||||
|
||||
// 31-36
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("31", boost::make_tuple(1, 2, 2), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("32", boost::make_tuple(1, 2, 2), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("33", boost::make_tuple(1, 2, 2), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("34", boost::make_tuple(2, 3.5, 1.5), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("35", boost::make_tuple(1, 4, 2), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("36", boost::make_tuple(3, 2.55555, 2.36111), case_36[0], case_36[1]);
|
||||
|
||||
// 37-42
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("37", boost::make_tuple(3, 2.4444444, 2.0), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("38", boost::make_tuple(3, 3.18095239, 2.8380952), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("39", boost::make_tuple(4, 5.33333, 4.0), case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("40", boost::make_tuple(3, 5.33333, 4.0), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("41", boost::make_tuple(5, 5.33333, 4.0), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("42", boost::make_tuple(5, 5.33333, 4.0), case_42[0], case_42[1]);
|
||||
|
||||
// 43-48
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("43", boost::make_tuple(4, 2.125, 1.9375), case_43[0], case_43[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("44", boost::make_tuple(4, 1.5, 1.5), case_44[0], case_44[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("45", boost::make_tuple(4, 1.5, 1.5), case_45[0], case_45[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("46", boost::make_tuple(4, 2.25, 1.5), case_46[0], case_46[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("47", boost::make_tuple(5, 2.6, 1.5), case_47[0], case_47[1]);
|
||||
|
||||
// 49-54
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("50", boost::make_tuple(4, 0.0, 0.0), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("51", boost::make_tuple(3, 0.0, 0.0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("52", boost::make_tuple(8, 0.0, 0.0), case_52[0], case_52[1]);
|
||||
// A touching point interior/ring exterior/ring can be represented in two ways:
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53a", boost::make_tuple(4, 0.0, 0.0), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("53b", boost::make_tuple(4, 0.0, 0.0), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54aa", boost::make_tuple(13, 0.0, 0.0), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ab", boost::make_tuple(13, 0.0, 0.0), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54ba", boost::make_tuple(13, 0.0, 0.0), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("54bb", boost::make_tuple(13, 0.0, 0.0), case_54[1], case_54[3]);
|
||||
|
||||
// other
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("many_situations", boost::make_tuple(31, 11.625, 13.875), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// ticket#17
|
||||
test_overlay<polygon, box, test_get_turns, Tuple>("ticket_17", boost::make_tuple(6, -122.27866617838542, 37.377897262573242), ticket_17[0], ticket_17[1]);
|
||||
|
||||
|
||||
|
||||
// pies
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_16_16", boost::make_tuple(3, 0.0, 0.0), pie_23_16_16[0], pie_23_16_16[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_4_12", boost::make_tuple(2, 0.0, 0.0), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_4_13_15", boost::make_tuple(3, 0.0, 0.0), pie_4_13_15[0], pie_4_13_15[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_16_2_15_0", boost::make_tuple(2, 0.0, 0.0), pie_16_2_15_0[0], pie_16_2_15_0[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_20_20_7_100", boost::make_tuple(3, 0.0, 0.0), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
test_overlay<polygon, polygon, test_get_turns, Tuple>("pie_23_23_3_2000", boost::make_tuple(5, 0.0, 0.0), pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
|
||||
|
||||
|
||||
// line-line
|
||||
test_overlay<linestring, linestring, test_get_turns, Tuple>("lineline1", boost::make_tuple(3, 1.6190476, 3.4761905), line_line1[0], line_line1[1]);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<float>();
|
||||
test_all<double>();
|
||||
//test_all<tt>();
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
test_all<long double>();
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
//test_all<boost::numeric_adaptor::cln_value_type>();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
//test_all<boost::numeric_adaptor::gmp_value_type>();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
182
test/algorithms/overlay/get_turns.vcproj
Normal file
182
test/algorithms/overlay/get_turns.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="get_turns"
|
||||
ProjectGUID="{B63116BF-0F0C-4374-A6CE-77061FBC34FF}"
|
||||
RootNamespace="get_turns"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\get_turns"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\get_turns"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\get_turns.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
1
test/algorithms/overlay/merge_intersection_points.cpp
Normal file
1
test/algorithms/overlay/merge_intersection_points.cpp
Normal file
@ -0,0 +1 @@
|
||||
// obsolete
|
182
test/algorithms/overlay/merge_intersection_points.vcproj
Normal file
182
test/algorithms/overlay/merge_intersection_points.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="merge_intersection_points"
|
||||
ProjectGUID="{EB8223BB-6989-4AC8-A72E-4E076FE04547}"
|
||||
RootNamespace="merge_intersection_points"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\merge_intersection_points"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\merge_intersection_points"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\merge_intersection_points.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
55
test/algorithms/overlay/overlay.sln
Normal file
55
test/algorithms/overlay/overlay.sln
Normal file
@ -0,0 +1,55 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "enrich_intersection_points", "enrich_intersection_points.vcproj", "{20FE798A-E4EE-4C87-A988-7317E774D28A}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "traverse", "traverse.vcproj", "{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "self_intersection_points", "self_intersection_points.vcproj", "{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_turn_info", "get_turn_info.vcproj", "{8D98821A-5033-4616-9AF4-2AEAA42D8456}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "get_turns", "get_turns.vcproj", "{B63116BF-0F0C-4374-A6CE-77061FBC34FF}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "relative_order", "relative_order.vcproj", "{4C012342-116A-4E5E-9869-90389D5BBEBD}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "assemble", "assemble.vcproj", "{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{20FE798A-E4EE-4C87-A988-7317E774D28A}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{20FE798A-E4EE-4C87-A988-7317E774D28A}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{20FE798A-E4EE-4C87-A988-7317E774D28A}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{20FE798A-E4EE-4C87-A988-7317E774D28A}.Release|Win32.Build.0 = Release|Win32
|
||||
{6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{6260214E-DB6F-4934-ADF7-DD2B1666171B}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{6260214E-DB6F-4934-ADF7-DD2B1666171B}.Release|Win32.Build.0 = Release|Win32
|
||||
{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}.Release|Win32.Build.0 = Release|Win32
|
||||
{8D98821A-5033-4616-9AF4-2AEAA42D8456}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{8D98821A-5033-4616-9AF4-2AEAA42D8456}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{8D98821A-5033-4616-9AF4-2AEAA42D8456}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{8D98821A-5033-4616-9AF4-2AEAA42D8456}.Release|Win32.Build.0 = Release|Win32
|
||||
{B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{B63116BF-0F0C-4374-A6CE-77061FBC34FF}.Release|Win32.Build.0 = Release|Win32
|
||||
{4C012342-116A-4E5E-9869-90389D5BBEBD}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{4C012342-116A-4E5E-9869-90389D5BBEBD}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{4C012342-116A-4E5E-9869-90389D5BBEBD}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{4C012342-116A-4E5E-9869-90389D5BBEBD}.Release|Win32.Build.0 = Release|Win32
|
||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{306E829F-ACEC-42D5-B1D4-2531B2F56EA3}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
322
test/algorithms/overlay/overlay_cases.hpp
Normal file
322
test/algorithms/overlay/overlay_cases.hpp
Normal file
File diff suppressed because one or more lines are too long
456
test/algorithms/overlay/overlay_common.hpp
Normal file
456
test/algorithms/overlay/overlay_common.hpp
Normal file
File diff suppressed because one or more lines are too long
204
test/algorithms/overlay/relative_order.cpp
Normal file
204
test/algorithms/overlay/relative_order.cpp
Normal file
@ -0,0 +1,204 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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 <iostream>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/get_relative_order.hpp>
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
template <typename P, typename T>
|
||||
void test_with_point(std::string const& caseid,
|
||||
T pi_x, T pi_y, T pj_x, T pj_y,
|
||||
T ri_x, T ri_y, T rj_x, T rj_y,
|
||||
T si_x, T si_y, T sj_x, T sj_y,
|
||||
int expected_order)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
P pi = bg::make<P>(pi_x, pi_y);
|
||||
P pj = bg::make<P>(pj_x, pj_y);
|
||||
P ri = bg::make<P>(ri_x, ri_y);
|
||||
P rj = bg::make<P>(rj_x, rj_y);
|
||||
P si = bg::make<P>(si_x, si_y);
|
||||
P sj = bg::make<P>(sj_x, sj_y);
|
||||
|
||||
int order = bg::detail::overlay::get_relative_order<P>::apply(pi, pj, ri, rj, si, sj);
|
||||
|
||||
BOOST_CHECK_EQUAL(order, expected_order);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
std::cout << caseid
|
||||
<< (caseid.find("_") == std::string::npos ? " " : "")
|
||||
<< " " << method
|
||||
<< " " << detected
|
||||
<< " " << order
|
||||
<< std::endl;
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/*#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "get_turn_info_" << caseid
|
||||
<< "_" << string_from_type<typename boost::geometry::coordinate_type<P>::type>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<P> mapper(svg, 500, 500);
|
||||
mapper.add(bg::make<P>(0, 0));
|
||||
mapper.add(bg::make<P>(10, 10));
|
||||
|
||||
bg::linestring<P> p; p.push_back(pi); p.push_back(pj); p.push_back(pk);
|
||||
bg::linestring<P> q; q.push_back(qi); q.push_back(qj); q.push_back(qk);
|
||||
mapper.map(p, "opacity:0.8;stroke:rgb(0,192,0);stroke-width:3");
|
||||
mapper.map(q, "opacity:0.8;stroke:rgb(0,0,255);stroke-width:3");
|
||||
|
||||
std::string style = ";font-family='Verdana';font-weight:bold";
|
||||
std::string align = ";text-anchor:end;text-align:end";
|
||||
int offset = 8;
|
||||
|
||||
mapper.text(pi, "pi", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
mapper.text(pj, "pj", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
mapper.text(pk, "pk", "fill:rgb(0,192,0)" + style, offset, offset);
|
||||
|
||||
mapper.text(qi, "qi", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
mapper.text(qj, "qj", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
mapper.text(qk, "qk", "fill:rgb(0,0,255)" + style + align, -offset, offset);
|
||||
|
||||
|
||||
int factor = 1; // second info, if any, will go left by factor -1
|
||||
int ch = '1';
|
||||
for (typename tp_vector::const_iterator it = info.begin();
|
||||
it != info.end();
|
||||
++it, factor *= -1, ch++)
|
||||
{
|
||||
bool at_j = it->method == bg::detail::overlay::method_crosses;
|
||||
std::string op;
|
||||
op += operation_char(it->operations[0].operation);
|
||||
align = ";text-anchor:middle;text-align:center";
|
||||
mapper.text(at_j ? pj : pk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
|
||||
|
||||
op.clear();
|
||||
op += operation_char(it->operations[1].operation);
|
||||
mapper.text(at_j ? qj : qk, op, "fill:rgb(255,128,0)" + style + align, offset * factor, -offset);
|
||||
|
||||
// Map intersection point + method
|
||||
mapper.map(it->point, "opacity:0.8;fill:rgb(255,0,0);stroke:rgb(0,0,100);stroke-width:1");
|
||||
|
||||
op.clear();
|
||||
op += method_char(it->method);
|
||||
if (info.size() != 1)
|
||||
{
|
||||
op += ch;
|
||||
op += " p:"; op += operation_char(it->operations[0].operation);
|
||||
op += " q:"; op += operation_char(it->operations[1].operation);
|
||||
}
|
||||
mapper.text(it->point, op, "fill:rgb(255,0,0)" + style, offset, -offset);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_with_point<P, double>("OLR1",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
3, 3, 7, 2, // s
|
||||
1);
|
||||
test_with_point<P, double>("OLR2",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
3, 7, 7, 6, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OLR3",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
4, 2, 9, 6, // s
|
||||
1);
|
||||
test_with_point<P, double>("OLR4",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
3, 8, 9, 4, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OLR5",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
4, 2, 8, 6, // s
|
||||
1);
|
||||
test_with_point<P, double>("OLR6",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
3, 7, 9, 4, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OLR7",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
1, 4, 7, 7, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OLR8",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
1, 6, 7, 3, // s
|
||||
1);
|
||||
|
||||
|
||||
test_with_point<P, double>("OD1",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
7, 2, 3, 3, // s
|
||||
1);
|
||||
|
||||
test_with_point<P, double>("OD9",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
7, 5, 3, 3, // s
|
||||
1);
|
||||
test_with_point<P, double>("OD10",
|
||||
5, 1, 5, 8, // p
|
||||
3, 5, 7, 5, // r
|
||||
7, 5, 3, 7, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OD11",
|
||||
5, 1, 5, 8, // p
|
||||
7, 5, 3, 5, // r
|
||||
3, 5, 7, 7, // s
|
||||
-1);
|
||||
test_with_point<P, double>("OD12",
|
||||
5, 1, 5, 8, // p
|
||||
7, 5, 3, 5, // r
|
||||
3, 5, 7, 3, // s
|
||||
1);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
return 0;
|
||||
}
|
182
test/algorithms/overlay/relative_order.vcproj
Normal file
182
test/algorithms/overlay/relative_order.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="relative_order"
|
||||
ProjectGUID="{4C012342-116A-4E5E-9869-90389D5BBEBD}"
|
||||
RootNamespace="relative_order"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\relative_order"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\relative_order"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\relative_order.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
142
test/algorithms/overlay/robustness/intersection_pies.cpp
Normal file
142
test/algorithms/overlay/robustness/intersection_pies.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2009, Geodan, 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 <iostream>
|
||||
#include <string>
|
||||
|
||||
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
|
||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
#include <test_overlay_p_q.hpp>
|
||||
|
||||
|
||||
|
||||
template <typename Polygon>
|
||||
inline void make_pie(Polygon& polygon,
|
||||
int count, int offset, int offset_y, double factor1, int total_segment_count = 36)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Polygon>::type p;
|
||||
typedef typename boost::geometry::select_most_precise
|
||||
<
|
||||
typename boost::geometry::coordinate_type<Polygon>::type,
|
||||
long double
|
||||
>::type coordinate_type;
|
||||
|
||||
// Create pie
|
||||
coordinate_type cx = 2500.0;
|
||||
coordinate_type cy = 2500.0 + offset_y;
|
||||
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(int(cx), int(cy)));
|
||||
|
||||
coordinate_type dx = 5000.0;
|
||||
coordinate_type dy = 5000.0;
|
||||
|
||||
coordinate_type half = 0.5;
|
||||
coordinate_type two = 2.0;
|
||||
|
||||
coordinate_type a = coordinate_type(factor1) * half * dx;
|
||||
coordinate_type b = coordinate_type(factor1) * half * dy;
|
||||
|
||||
coordinate_type pi = boost::math::constants::pi<long double>();
|
||||
coordinate_type delta = pi * two / total_segment_count;
|
||||
coordinate_type angle = coordinate_type(offset) * delta;
|
||||
for (int i = 0; i < count; i++, angle += delta)
|
||||
{
|
||||
coordinate_type s = sin(angle);
|
||||
coordinate_type c = cos(angle);
|
||||
coordinate_type x = cx + a * s;
|
||||
coordinate_type y = cy + b * c;
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(int(x), int(y)));
|
||||
}
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(int(cx), int(cy)));
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void test_pie(int total_segment_count, T factor_p, T factor_q)
|
||||
{
|
||||
boost::timer t;
|
||||
typedef boost::geometry::point_xy<T> point_type;
|
||||
typedef boost::geometry::polygon<point_type> polygon;
|
||||
|
||||
int good_count = 0;
|
||||
int bad_count = 0;
|
||||
|
||||
for (int a = 2; a < total_segment_count; a++)
|
||||
{
|
||||
polygon p;
|
||||
make_pie(p, a, 0, 0, factor_p, total_segment_count);
|
||||
for (int b = 2; b < total_segment_count; b++)
|
||||
{
|
||||
for (int offset = 1; offset < total_segment_count; offset++)
|
||||
{
|
||||
for (int y = 0; y <= 2500; y += 500)
|
||||
{
|
||||
polygon q;
|
||||
make_pie(q, b, offset, y, factor_q, total_segment_count);
|
||||
|
||||
std::ostringstream out;
|
||||
out << "pie_" << a << "_" << b << "_" << offset << "_" << y;
|
||||
|
||||
if (test_overlay_p_q<polygon, T>(out.str(), p, q, false, 0.01))
|
||||
{
|
||||
good_count++;
|
||||
}
|
||||
else
|
||||
{
|
||||
bad_count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::cout
|
||||
<< "Time: " << t.elapsed() << std::endl
|
||||
<< "Good: " << good_count << std::endl
|
||||
<< "Bad: " << bad_count << std::endl;
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void test_all()
|
||||
{
|
||||
test_pie<T>(24, 0.55, 0.45);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
//test_all<float>();
|
||||
test_all<double>();
|
||||
//test_all<long double>();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_all<boost::numeric_adaptor::cln_value_type>();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
//test_all<boost::numeric_adaptor::gmp_value_type>();
|
||||
#endif
|
||||
}
|
||||
catch(std::exception const& e)
|
||||
{
|
||||
std::cout << "Exception " << e.what() << std::endl;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "Other exception" << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
185
test/algorithms/overlay/robustness/intersection_pies.vcproj
Normal file
185
test/algorithms/overlay/robustness/intersection_pies.vcproj
Normal file
@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="intersection_pies"
|
||||
ProjectGUID="{24D92478-7C66-4DD5-A501-30A3D4376E4F}"
|
||||
RootNamespace="intersection_pies"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_pies"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor;.;../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="gmp.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
|
||||
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)\intersection_pies"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor;.;../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="gmp.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
|
||||
GenerateDebugInformation="true"
|
||||
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=".\intersection_pies.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
178
test/algorithms/overlay/robustness/intersection_stars.cpp
Normal file
178
test/algorithms/overlay/robustness/intersection_stars.cpp
Normal file
@ -0,0 +1,178 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2009, Geodan, 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 <iostream>
|
||||
#include <string>
|
||||
|
||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||
|
||||
#include <algorithms/test_intersection.hpp>
|
||||
#include <algorithms/test_overlay.hpp>
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/adapted/std_as_linestring.hpp>
|
||||
|
||||
#include <test_common/test_point.hpp>
|
||||
#include <test_common/with_pointer.hpp>
|
||||
|
||||
// Two at the same time not (yet) supported
|
||||
#if defined(HAVE_CLN) && defined(HAVE_GMP)
|
||||
#undef HAVE_GMP
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <typename Polygon>
|
||||
inline void make_star(Polygon& polygon,
|
||||
int count, double factor1, double factor2, long double offset = 0)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Polygon>::type p;
|
||||
typedef typename boost::geometry::select_most_precise
|
||||
<
|
||||
typename boost::geometry::coordinate_type<Polygon>::type,
|
||||
long double
|
||||
>::type coordinate_type;
|
||||
|
||||
// Create star
|
||||
coordinate_type cx = 25.0;
|
||||
coordinate_type cy = 25.0;
|
||||
|
||||
coordinate_type dx = 50.0;
|
||||
coordinate_type dy = 50.0;
|
||||
|
||||
coordinate_type half = 0.5;
|
||||
coordinate_type two = 2.0;
|
||||
|
||||
coordinate_type a1 = coordinate_type(factor1) * half * dx;
|
||||
coordinate_type b1 = coordinate_type(factor1) * half * dy;
|
||||
coordinate_type a2 = coordinate_type(factor2) * half * dx;
|
||||
coordinate_type b2 = coordinate_type(factor2) * half * dy;
|
||||
|
||||
coordinate_type pi = boost::math::constants::pi<long double>();
|
||||
coordinate_type delta = pi * two / coordinate_type(count - 1);
|
||||
coordinate_type angle = coordinate_type(offset) * delta;
|
||||
std::cout << "Start with angle: " << angle << std::endl;
|
||||
for (int i = 0; i < count - 1; i++, angle += delta)
|
||||
{
|
||||
bool even = i % 2 == 0;
|
||||
coordinate_type s = sin(angle);
|
||||
coordinate_type c = cos(angle);
|
||||
coordinate_type x = cx + (even ? a1 : a2) * s;
|
||||
coordinate_type y = cy + (even ? b1 : b2) * c;
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<p>(x, y));
|
||||
|
||||
}
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::exterior_ring(polygon).front());
|
||||
}
|
||||
|
||||
|
||||
template <typename T, typename CalculationType>
|
||||
void test_star(std::string const& p_type, std::string const& c_type,
|
||||
std::string const& p_selection, std::string const& c_selection,
|
||||
int min_points, int max_points, T rotation)
|
||||
{
|
||||
if ((! p_selection.empty() && p_selection != p_type)
|
||||
|| (! c_selection.empty() && c_selection != c_type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
std::cout << "TESTING case "
|
||||
<< p_type << " (" << sizeof(T) << ") "
|
||||
<< c_type << " (" << sizeof(CalculationType) << ")"
|
||||
<< std::endl;
|
||||
boost::timer t;
|
||||
typedef boost::geometry::point_xy<T> point_type;
|
||||
typedef boost::geometry::polygon<point_type> polygon;
|
||||
|
||||
T area_i = 0;
|
||||
T area_a = 0;
|
||||
T area_b = 0;
|
||||
//T area_u = 0;
|
||||
|
||||
for (int p = min_points; p <= max_points; p++)
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "_" << p_type << "_" << c_type << "_" << p << "_int";
|
||||
|
||||
polygon a;
|
||||
make_star(a, p * 2 + 1, 0.5, 1.0);
|
||||
polygon b;
|
||||
make_star(b, p * 2 + 1, 0.5, 1.0, rotation);
|
||||
|
||||
area_i += test_intersection<polygon, CalculationType>(out.str(), a, b);
|
||||
area_a += boost::geometry::area(a);
|
||||
area_b += boost::geometry::area(b);
|
||||
}
|
||||
|
||||
std::cout
|
||||
<< " time: " << t.elapsed() << std::endl
|
||||
<< " area: " << area_i << std::endl
|
||||
<< " area a: " << area_a << std::endl
|
||||
<< " area b: " << area_b << std::endl
|
||||
<< " diff: " << (area_i - area_a) << std::endl
|
||||
;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_all(std::string const& p_type,
|
||||
std::string const& p_selection,
|
||||
std::string const& c_selection,
|
||||
int min_points, int max_points, long double rotation)
|
||||
{
|
||||
test_star<T, float>(p_type, "f", p_selection, c_selection,
|
||||
min_points, max_points, rotation);
|
||||
test_star<T, double>(p_type, "d", p_selection, c_selection,
|
||||
min_points, max_points, rotation);
|
||||
test_star<T, long double>(p_type, "e", p_selection, c_selection,
|
||||
min_points, max_points, rotation);
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_star<T, boost::numeric_adaptor::cln_value_type>(p_type, "c",
|
||||
p_selection, c_selection, min_points, max_points, rotation);
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_star<T, boost::numeric_adaptor::gmp_value_type>(p_type, "g",
|
||||
p_selection, c_selection, min_points, max_points, rotation);
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::string p_selection = argc > 1 ? argv[1] : "";
|
||||
std::string c_selection = argc > 2 ? argv[2] : "";
|
||||
int min_points = argc > 3 ? boost::lexical_cast<int>(argv[3]) : 9;
|
||||
int max_points = argc > 4 ? boost::lexical_cast<int>(argv[4]) : min_points;
|
||||
long double rotation = argc > 5 ? boost::lexical_cast<long double>(argv[5]) : 1e-15;
|
||||
|
||||
test_all<float>("f", p_selection, c_selection, min_points, max_points, rotation);
|
||||
test_all<double>("d", p_selection, c_selection, min_points, max_points, rotation);
|
||||
test_all<long double>("e", p_selection, c_selection, min_points, max_points, rotation);
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::numeric_adaptor::cln_value_type>("c",
|
||||
p_selection, c_selection, min_points, max_points, rotation);
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::numeric_adaptor::gmp_value_type>("g",
|
||||
p_selection, c_selection, min_points, max_points, rotation);
|
||||
#endif
|
||||
}
|
||||
catch(std::exception const& e)
|
||||
{
|
||||
std::cout << "Exception " << e.what() << std::endl;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "Other exception" << std::endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
185
test/algorithms/overlay/robustness/intersection_stars.vcproj
Normal file
185
test/algorithms/overlay/robustness/intersection_stars.vcproj
Normal file
@ -0,0 +1,185 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="intersection_stars"
|
||||
ProjectGUID="{A76B81BF-B5B4-4D09-BB81-F235647891DE}"
|
||||
RootNamespace="intersection_stars"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\intersection_stars"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor;../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;TEST_WITH_SVG;HAVE_GMP;BOOST_GEOMETRY_DEBUG_INTERSECTION"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="gmp.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
|
||||
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)\intersection_stars"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="1"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories=""c:\gmp\gmp-dynamic";c:\svn\numeric_adaptor;../../../../../..;../../.."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="gmp.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""C:\gmp\gmp-dynamic""
|
||||
GenerateDebugInformation="true"
|
||||
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=".\intersection_stars.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
301
test/algorithms/overlay/robustness/random_ellipses_stars.cpp
Normal file
301
test/algorithms/overlay/robustness/random_ellipses_stars.cpp
Normal file
@ -0,0 +1,301 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2009, Geodan, 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 <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
|
||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_int.hpp>
|
||||
#include <boost/random/uniform_real.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
#include <test_overlay_p_q.hpp>
|
||||
|
||||
|
||||
/*
|
||||
template <typename OutputType, typename CalculationType, typename G1, typename G2>
|
||||
void test_overlay(int seed, int caseid, G1 const& a, G2 const& b, bool svg, double tolerance)
|
||||
{
|
||||
typedef typename boost::geometry::coordinate_type<G1>::type coordinate_type;
|
||||
typedef typename boost::geometry::point_type<G1>::type point_type;
|
||||
typedef boost::geometry::detail::intersection::intersection_point<point_type> ip_type;
|
||||
|
||||
typedef boost::geometry::strategy_intersection
|
||||
<
|
||||
typename boost::geometry::cs_tag<point_type>::type,
|
||||
G1,
|
||||
G2,
|
||||
ip_type,
|
||||
CalculationType
|
||||
> strategy;
|
||||
|
||||
std::vector<OutputType> out_i, out_u;
|
||||
|
||||
|
||||
CalculationType area_a = boost::geometry::area(a);
|
||||
CalculationType area_b = boost::geometry::area(b);
|
||||
|
||||
CalculationType area_i = 0;
|
||||
CalculationType area_u = 0;
|
||||
|
||||
boost::geometry::intersection_inserter<OutputType>(a, b, std::back_inserter(out_i), strategy());
|
||||
for (typename std::vector<OutputType>::iterator it = out_i.begin();
|
||||
it != out_i.end();
|
||||
++it)
|
||||
{
|
||||
area_i += boost::geometry::area(*it);
|
||||
}
|
||||
boost::geometry::union_inserter<OutputType>(a, b, std::back_inserter(out_u), strategy());
|
||||
for (typename std::vector<OutputType>::iterator it = out_u.begin();
|
||||
it != out_u.end();
|
||||
++it)
|
||||
{
|
||||
area_u += boost::geometry::area(*it);
|
||||
}
|
||||
|
||||
double diff = (area_a + area_b) - area_u - area_i;
|
||||
if (std::abs(diff) > tolerance)
|
||||
{
|
||||
svg = true;
|
||||
std::cout
|
||||
<< "type: " << string_from_type<CalculationType>::name()
|
||||
<< " id: " << caseid
|
||||
<< " seed: " << seed
|
||||
<< " area i: " << area_i
|
||||
<< " area u: " << area_u
|
||||
<< " area a: " << area_a
|
||||
<< " area b: " << area_b
|
||||
<< " diff: " << diff
|
||||
<< std::endl
|
||||
<< std::setprecision(20)
|
||||
<< " a: " << boost::geometry::wkt(a) << std::endl
|
||||
<< " b: " << boost::geometry::wkt(b) << std::endl
|
||||
;
|
||||
}
|
||||
|
||||
if(svg)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "overlay_random_ellipse_stars_" << caseid << "_"
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< string_from_type<CalculationType>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<point_type> mapper(svg, 500, 500);
|
||||
|
||||
mapper.add(a);
|
||||
mapper.add(b);
|
||||
|
||||
mapper.map(a, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(b, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_i.begin();
|
||||
it != out_i.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:3");
|
||||
}
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_u.begin();
|
||||
it != out_u.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,255);stroke-width:3");
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
struct star_params
|
||||
{
|
||||
int count; // points of ellipse, not of star
|
||||
double factor_1;
|
||||
double factor_2;
|
||||
double center_x;
|
||||
double center_y;
|
||||
double rotation;
|
||||
star_params(int c, double f1, double f2, double x, double y, double r = 0)
|
||||
: count(c)
|
||||
, factor_1(f1)
|
||||
, factor_2(f2)
|
||||
, center_x(x)
|
||||
, center_y(y)
|
||||
, rotation(r)
|
||||
{}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename Polygon>
|
||||
inline void make_star(Polygon& polygon, star_params const& p)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Polygon>::type P;
|
||||
typedef typename boost::geometry::select_most_precise
|
||||
<
|
||||
typename boost::geometry::coordinate_type<Polygon>::type,
|
||||
long double
|
||||
>::type coordinate_type;
|
||||
|
||||
// Create star
|
||||
coordinate_type cx = 25.0;
|
||||
coordinate_type cy = 25.0;
|
||||
|
||||
coordinate_type dx = 50.0;
|
||||
coordinate_type dy = 50.0;
|
||||
|
||||
coordinate_type half = 0.5;
|
||||
coordinate_type two = 2.0;
|
||||
|
||||
coordinate_type a1 = coordinate_type(p.factor_1) * half * dx;
|
||||
coordinate_type b1 = coordinate_type(p.factor_1) * half * dy;
|
||||
coordinate_type a2 = coordinate_type(p.factor_2) * half * dx;
|
||||
coordinate_type b2 = coordinate_type(p.factor_2) * half * dy;
|
||||
|
||||
coordinate_type pi = boost::math::constants::pi<long double>();
|
||||
coordinate_type delta = pi * two / coordinate_type(p.count - 1);
|
||||
coordinate_type angle = coordinate_type(p.rotation) * delta;
|
||||
for (int i = 0; i < p.count - 1; i++, angle += delta)
|
||||
{
|
||||
bool even = i % 2 == 0;
|
||||
coordinate_type s = sin(angle);
|
||||
coordinate_type c = cos(angle);
|
||||
coordinate_type x = p.center_x + cx + (even ? a1 : a2) * s;
|
||||
coordinate_type y = p.center_y + cy + (even ? b1 : b2) * c;
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::make<P>(x, y));
|
||||
|
||||
}
|
||||
boost::geometry::exterior_ring(polygon).push_back(boost::geometry::exterior_ring(polygon).front());
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
void test_star_ellipse(int seed, int index, star_params const& par_p,
|
||||
star_params const& par_q, bool svg, double tolerance)
|
||||
{
|
||||
typedef boost::geometry::point_xy<T> point_type;
|
||||
typedef boost::geometry::polygon<point_type> polygon;
|
||||
|
||||
polygon p, q;
|
||||
make_star(p, par_p);
|
||||
make_star(q, par_q);
|
||||
|
||||
std::ostringstream out;
|
||||
out << "rse_" << seed << "_" << index;
|
||||
test_overlay_p_q<polygon, T>(out.str(), p, q, svg, tolerance);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_all(int seed, int count, bool svg, double tolerance)
|
||||
{
|
||||
boost::timer t;
|
||||
|
||||
typedef boost::minstd_rand base_generator_type;
|
||||
|
||||
//boost::uniform_real<> random_factor(0.5, 1.2);
|
||||
//boost::uniform_real<> random_location(-10.0, 10.0);
|
||||
//boost::uniform_int<> random_points(5, 20);
|
||||
|
||||
// This set (next 4 lines) are now solved for the most part
|
||||
// 2009-12-03, 3 or 4 errors in 1000000 calls
|
||||
// 2009-12-07, no errors in 1000000 calls
|
||||
//boost::uniform_real<> random_factor(1.0 - 1e-3, 1.0 + 1e-3);
|
||||
//boost::uniform_real<> random_location(-1e-3, 1e-3);
|
||||
//boost::uniform_real<> random_rotation(-1e-3, 1e-3);
|
||||
//boost::uniform_int<> random_points(3, 3);
|
||||
|
||||
// 2009-12-08, still errors, see notes
|
||||
// 2009-12-09, (probably) solved by order on side
|
||||
// 2010-01-16: solved (no errors in 1000000 calls)
|
||||
//boost::uniform_real<> random_factor(1.0 - 1e-3, 1.0 + 1e-3);
|
||||
//boost::uniform_real<> random_location(-1e-3, -1e-3);
|
||||
//boost::uniform_real<> random_rotation(-1e-3, 1e-3);
|
||||
//boost::uniform_int<> random_points(3, 4);
|
||||
|
||||
// This set (next 4 lines) are now solved ("distance-zero"/"merge iiii" problem)
|
||||
// 2009-12-03: 5,50 -> 2:1 000 000 wrong (2009-12-03)
|
||||
// 2010-01-16: solved (no errors in 10000000 calls)
|
||||
boost::uniform_real<> random_factor(0.3, 1.2);
|
||||
boost::uniform_real<> random_location(-20.0, +20.0); // -25.0, +25.0
|
||||
boost::uniform_real<> random_rotation(0, 0.5);
|
||||
boost::uniform_int<> random_points(5, 15);
|
||||
|
||||
base_generator_type generator(seed);
|
||||
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_real<> >
|
||||
factor_generator(generator, random_factor);
|
||||
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_real<> >
|
||||
location_generator(generator, random_location);
|
||||
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_real<> >
|
||||
rotation_generator(generator, random_rotation);
|
||||
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_int<> >
|
||||
int_generator(generator, random_points);
|
||||
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
test_star_ellipse<T>(seed, i + 1,
|
||||
star_params(int_generator() * 2 + 1,
|
||||
factor_generator(), factor_generator(),
|
||||
location_generator(), location_generator(), rotation_generator()),
|
||||
star_params(int_generator() * 2 + 1,
|
||||
factor_generator(), factor_generator(),
|
||||
location_generator(), location_generator(), rotation_generator()),
|
||||
svg, tolerance);
|
||||
}
|
||||
std::cout
|
||||
<< "type: " << string_from_type<T>::name()
|
||||
<< " time: " << t.elapsed() << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = argc > 1 ? boost::lexical_cast<int>(argv[1]) : 10;
|
||||
int seed = (argc > 2 && std::string(argv[2]) != std::string("#"))
|
||||
? boost::lexical_cast<int>(argv[2])
|
||||
: static_cast<unsigned int>(std::time(0));
|
||||
bool svg = argc > 3 && std::string(argv[3]) == std::string("svg");
|
||||
|
||||
test_all<float>(seed, count, svg, 1e-3);
|
||||
//test_all<double>(seed, count, svg, 1e-6);
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_star_ellipse<boost::numeric_adaptor::cln_value_type>("c",
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
// test_star_ellipse<boost::numeric_adaptor::gmp_value_type>(selection, "g");
|
||||
#endif
|
||||
}
|
||||
catch(std::exception const& e)
|
||||
{
|
||||
std::cout << "Exception " << e.what() << std::endl;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "Other exception" << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
183
test/algorithms/overlay/robustness/random_ellipses_stars.vcproj
Normal file
183
test/algorithms/overlay/robustness/random_ellipses_stars.vcproj
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="random_ellipses_stars"
|
||||
ProjectGUID="{C16633DE-83F8-40E3-9915-3B9C872C7B1E}"
|
||||
RootNamespace="random_ellipses_stars"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\random_ellipses_stars"
|
||||
ConfigurationType="1"
|
||||
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;_WINDOWS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
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)\random_ellipses_stars"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../../../..;../../..;."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="0"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="true"
|
||||
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=".\random_ellipses_stars.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
162
test/algorithms/overlay/robustness/recursive_boxes.cpp
Normal file
162
test/algorithms/overlay/robustness/recursive_boxes.cpp
Normal file
@ -0,0 +1,162 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2009, Geodan, 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 <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
|
||||
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
|
||||
#define BOOST_GEOMETRY_NO_BOOST_TEST
|
||||
|
||||
#include <boost/timer.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/random/linear_congruential.hpp>
|
||||
#include <boost/random/uniform_int.hpp>
|
||||
#include <boost/random/uniform_real.hpp>
|
||||
#include <boost/random/variate_generator.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
#include <boost/geometry/multi/multi.hpp>
|
||||
#include <boost/geometry/multi/algorithms/overlay/assemble.hpp>
|
||||
|
||||
#include <boost/geometry/multi/geometries/multi_polygon.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
#include <test_overlay_p_q.hpp>
|
||||
|
||||
template <typename Polygon, typename Generator>
|
||||
inline void make_box(Polygon& polygon, Generator& generator)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
typedef typename bg::point_type<Polygon>::type point_type;
|
||||
typedef typename bg::coordinate_type<Polygon>::type coordinate_type;
|
||||
|
||||
coordinate_type x, y;
|
||||
x = generator();
|
||||
y = generator();
|
||||
|
||||
typename bg::ring_type<Polygon>::type& ring = bg::exterior_ring(polygon);
|
||||
|
||||
point_type p;
|
||||
bg::set<0>(p, x); bg::set<1>(p, y); ring.push_back(p);
|
||||
bg::set<0>(p, x); bg::set<1>(p, y + 1); ring.push_back(p);
|
||||
bg::set<0>(p, x + 1); bg::set<1>(p, y + 1); ring.push_back(p);
|
||||
bg::set<0>(p, x + 1); bg::set<1>(p, y); ring.push_back(p);
|
||||
bg::set<0>(p, x); bg::set<1>(p, y); ring.push_back(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename MultiPolygon, typename Generator>
|
||||
void test_recursive_boxes(MultiPolygon& result, int& index,
|
||||
Generator& generator, bool svg, int level = 3)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
MultiPolygon p, q;
|
||||
|
||||
// Generate two boxes
|
||||
if (level == 0)
|
||||
{
|
||||
p.resize(1);
|
||||
q.resize(1);
|
||||
make_box(p.front(), generator);
|
||||
make_box(q.front(), generator);
|
||||
}
|
||||
else
|
||||
{
|
||||
test_recursive_boxes(p, index, generator, svg, level - 1);
|
||||
test_recursive_boxes(q, index, generator, svg, level - 1);
|
||||
}
|
||||
|
||||
typedef typename boost::range_value<MultiPolygon>::type polygon;
|
||||
|
||||
std::ostringstream out;
|
||||
out << "recursive_box_" << index++ << "_" << level;
|
||||
test_overlay_p_q
|
||||
<
|
||||
polygon,
|
||||
typename bg::coordinate_type<MultiPolygon>::type
|
||||
>(out.str(), p, q, svg, 0.001);
|
||||
|
||||
MultiPolygon mp;
|
||||
bg::union_inserter
|
||||
<
|
||||
polygon
|
||||
>(p, q, std::back_inserter(mp));
|
||||
|
||||
result = mp;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void test_all(int seed, int count, bool svg)
|
||||
{
|
||||
boost::timer t;
|
||||
|
||||
typedef boost::minstd_rand base_generator_type;
|
||||
|
||||
boost::uniform_int<> random_coordinate(0, 9);
|
||||
base_generator_type generator(seed);
|
||||
boost::variate_generator<base_generator_type&, boost::uniform_int<> >
|
||||
int_generator(generator, random_coordinate);
|
||||
|
||||
typedef boost::geometry::polygon
|
||||
<
|
||||
boost::geometry::point_xy<T>
|
||||
> polygon;
|
||||
typedef boost::geometry::multi_polygon<polygon> mp;
|
||||
|
||||
|
||||
int index = 0;
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
|
||||
mp p;
|
||||
test_recursive_boxes<mp>(p, index, int_generator, svg);
|
||||
}
|
||||
std::cout
|
||||
<< "type: " << string_from_type<T>::name()
|
||||
<< " time: " << t.elapsed() << std::endl;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
try
|
||||
{
|
||||
int count = argc > 1 ? boost::lexical_cast<int>(argv[1]) : 10;
|
||||
int seed = (argc > 2 && std::string(argv[2]) != std::string("#"))
|
||||
? boost::lexical_cast<int>(argv[2])
|
||||
: static_cast<unsigned int>(std::time(0));
|
||||
bool svg = argc > 3 && std::string(argv[3]) == std::string("svg");
|
||||
|
||||
//test_all<float>(seed, count, svg, 1e-3);
|
||||
test_all<double>(seed, count, svg);
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
//test_recursive_boxes<boost::numeric_adaptor::cln_value_type>("c",
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
// test_recursive_boxes<boost::numeric_adaptor::gmp_value_type>(selection, "g");
|
||||
#endif
|
||||
}
|
||||
catch(std::exception const& e)
|
||||
{
|
||||
std::cout << "Exception " << e.what() << std::endl;
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
std::cout << "Other exception" << std::endl;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
183
test/algorithms/overlay/robustness/recursive_boxes.vcproj
Normal file
183
test/algorithms/overlay/robustness/recursive_boxes.vcproj
Normal file
@ -0,0 +1,183 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="recursive_boxes"
|
||||
ProjectGUID="{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}"
|
||||
RootNamespace="recursive_boxes"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\recursive_boxes"
|
||||
ConfigurationType="1"
|
||||
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;_WINDOWS;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="2"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
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)\recursive_boxes"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="1"
|
||||
WholeProgramOptimization="0"
|
||||
>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
AdditionalIncludeDirectories="../../../../../..;../../..;."
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
RuntimeLibrary="0"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="0"
|
||||
Detect64BitPortabilityProblems="true"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""
|
||||
GenerateDebugInformation="true"
|
||||
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=".\recursive_boxes.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
37
test/algorithms/overlay/robustness/robustness.sln
Normal file
37
test/algorithms/overlay/robustness/robustness.sln
Normal file
@ -0,0 +1,37 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual C++ Express 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "random_ellipses_stars", "random_ellipses_stars.vcproj", "{C16633DE-83F8-40E3-9915-3B9C872C7B1E}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection_stars", "intersection_stars.vcproj", "{A76B81BF-B5B4-4D09-BB81-F235647891DE}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersection_pies", "intersection_pies.vcproj", "{24D92478-7C66-4DD5-A501-30A3D4376E4F}"
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "recursive_boxes", "recursive_boxes.vcproj", "{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{C16633DE-83F8-40E3-9915-3B9C872C7B1E}.Release|Win32.Build.0 = Release|Win32
|
||||
{A76B81BF-B5B4-4D09-BB81-F235647891DE}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{A76B81BF-B5B4-4D09-BB81-F235647891DE}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{A76B81BF-B5B4-4D09-BB81-F235647891DE}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{A76B81BF-B5B4-4D09-BB81-F235647891DE}.Release|Win32.Build.0 = Release|Win32
|
||||
{24D92478-7C66-4DD5-A501-30A3D4376E4F}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{24D92478-7C66-4DD5-A501-30A3D4376E4F}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{24D92478-7C66-4DD5-A501-30A3D4376E4F}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{24D92478-7C66-4DD5-A501-30A3D4376E4F}.Release|Win32.Build.0 = Release|Win32
|
||||
{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{E1AA569C-858C-4789-A6FF-5CDFB41C59D7}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
118
test/algorithms/overlay/robustness/test_overlay_p_q.hpp
Normal file
118
test/algorithms/overlay/robustness/test_overlay_p_q.hpp
Normal file
@ -0,0 +1,118 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP
|
||||
#define BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
|
||||
template <typename OutputType, typename CalculationType, typename G1, typename G2>
|
||||
static bool test_overlay_p_q(std::string const& caseid, G1 const& p, G2 const& q, bool svg, double tolerance)
|
||||
{
|
||||
bool result = true;
|
||||
|
||||
typedef typename boost::geometry::coordinate_type<G1>::type coordinate_type;
|
||||
typedef typename boost::geometry::point_type<G1>::type point_type;
|
||||
typedef boost::geometry::detail::intersection::intersection_point<point_type> ip_type;
|
||||
|
||||
typedef boost::geometry::strategy_intersection
|
||||
<
|
||||
typename boost::geometry::cs_tag<point_type>::type,
|
||||
G1,
|
||||
G2,
|
||||
ip_type,
|
||||
CalculationType
|
||||
> strategy;
|
||||
|
||||
std::vector<OutputType> out_i, out_u;
|
||||
|
||||
CalculationType area_p = boost::geometry::area(p);
|
||||
CalculationType area_q = boost::geometry::area(q);
|
||||
|
||||
CalculationType area_i = 0;
|
||||
CalculationType area_u = 0;
|
||||
|
||||
boost::geometry::intersection_inserter<OutputType>(p, q, std::back_inserter(out_i), strategy());
|
||||
for (typename std::vector<OutputType>::iterator it = out_i.begin();
|
||||
it != out_i.end();
|
||||
++it)
|
||||
{
|
||||
area_i += boost::geometry::area(*it);
|
||||
}
|
||||
boost::geometry::union_inserter<OutputType>(p, q, std::back_inserter(out_u), strategy());
|
||||
for (typename std::vector<OutputType>::iterator it = out_u.begin();
|
||||
it != out_u.end();
|
||||
++it)
|
||||
{
|
||||
area_u += boost::geometry::area(*it);
|
||||
}
|
||||
|
||||
double diff = (area_p + area_q) - area_u - area_i;
|
||||
if (std::abs(diff) > tolerance
|
||||
// for creating SVG-selection: || area_i > 2.0e+006
|
||||
)
|
||||
{
|
||||
result = false;
|
||||
svg = true;
|
||||
|
||||
std::cout
|
||||
<< "type: " << string_from_type<CalculationType>::name()
|
||||
<< " id: " << caseid
|
||||
<< " area i: " << area_i
|
||||
<< " area u: " << area_u
|
||||
<< " area p: " << area_p
|
||||
<< " area q: " << area_q
|
||||
<< " diff: " << diff
|
||||
<< std::endl
|
||||
<< std::setprecision(20)
|
||||
<< " p: " << boost::geometry::wkt(p) << std::endl
|
||||
<< " q: " << boost::geometry::wkt(q) << std::endl
|
||||
;
|
||||
|
||||
}
|
||||
|
||||
|
||||
if(svg)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "overlay_" << caseid << "_"
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< string_from_type<CalculationType>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<point_type> mapper(svg, 500, 500);
|
||||
|
||||
mapper.add(p);
|
||||
mapper.add(q);
|
||||
|
||||
mapper.map(p, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(q, "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_i.begin();
|
||||
it != out_i.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:3");
|
||||
}
|
||||
for (typename std::vector<OutputType>::const_iterator it = out_u.begin();
|
||||
it != out_u.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,255);stroke-width:3");
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
#endif // BOOST_GEOMETRY_TEST_OVERLAY_P_Q_HPP
|
234
test/algorithms/overlay/self_intersection_points.cpp
Normal file
234
test/algorithms/overlay/self_intersection_points.cpp
Normal file
File diff suppressed because one or more lines are too long
182
test/algorithms/overlay/self_intersection_points.vcproj
Normal file
182
test/algorithms/overlay/self_intersection_points.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="self_intersection_points"
|
||||
ProjectGUID="{06B6DCBB-AEDA-49FA-81D9-EA8959958EFC}"
|
||||
RootNamespace="self_intersection_points"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\self_intersection_points"
|
||||
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;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\self_intersection_points"
|
||||
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;_CRT_SECURE_NO_WARNINGS"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\self_intersection_points.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
639
test/algorithms/overlay/traverse.cpp
Normal file
639
test/algorithms/overlay/traverse.cpp
Normal file
@ -0,0 +1,639 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2010, Geodan, 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 <iostream>
|
||||
#include <iomanip>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
//#define HAVE_TTMATH
|
||||
#ifdef HAVE_TTMATH
|
||||
# include <ttmath_stub.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#define BOOST_GEOMETRY_REPORT_OVERLAY_ERROR
|
||||
#define BOOST_GEOMETRY_DEBUG_SEGMENT_IDENTIFIER
|
||||
|
||||
//#define BOOST_GEOMETRY_DEBUG_OVERLAY_ONLY_ONE
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
# define BOOST_GEOMETRY_TEST_OVERLAY_NOT_REVERSED
|
||||
//# define BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
#else
|
||||
//# define BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
#endif
|
||||
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/overlay/get_turns.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/enrich_intersection_points.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/traverse.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <overlay_common.hpp>
|
||||
#include <overlay_cases.hpp>
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
template <boost::geometry::detail::overlay::operation_type Direction>
|
||||
struct test_traverse
|
||||
{
|
||||
#if defined(TEST_WITH_SVG)
|
||||
static inline std::string operation(int d)
|
||||
{
|
||||
return d == 1 ? "union" : "intersection";
|
||||
}
|
||||
#endif
|
||||
|
||||
template <typename G1, typename G2>
|
||||
static void apply(std::string const& id,
|
||||
boost::tuple<int, double> const& expected_count_area,
|
||||
G1 const& g1, G2 const& g2,
|
||||
double precision)
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
|
||||
//std::cout << "TRAVERSE " << id << "(" << int(Direction) << ")" << std::endl;
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_OVERLAY
|
||||
//std::cerr << "TRAVERSE " << id << "(" << Direction << ")" << std::endl;
|
||||
|
||||
//std::cout << bg::area(g1) << " " << bg::area(g2) << std::endl;
|
||||
#endif
|
||||
|
||||
typedef typename bg::strategy_side
|
||||
<
|
||||
typename bg::cs_tag<G1>::type
|
||||
>::type side_strategy_type;
|
||||
|
||||
|
||||
typedef bg::detail::overlay::traversal_turn_info
|
||||
<
|
||||
typename boost::geometry::point_type<G2>::type
|
||||
> turn_info;
|
||||
std::vector<turn_info> turns;
|
||||
|
||||
bg::detail::get_turns::no_interrupt_policy policy;
|
||||
bg::get_turns<bg::detail::overlay::calculate_distance_policy>(g1, g2, turns, policy);
|
||||
bg::enrich_intersection_points(turns, g1, g2, side_strategy_type());
|
||||
|
||||
typedef bg::linear_ring<typename bg::point_type<G2>::type> ring_type;
|
||||
typedef std::vector<ring_type> out_vector;
|
||||
out_vector v;
|
||||
|
||||
|
||||
bg::traverse(g1, g2, Direction, turns, v);
|
||||
|
||||
// Check number of resulting rings
|
||||
BOOST_CHECK_MESSAGE(expected_count_area.get<0>() == boost::size(v),
|
||||
"traverse: " << id
|
||||
<< " #shapes expected: " << expected_count_area.get<0>()
|
||||
<< " detected: " << boost::size(v)
|
||||
<< " type: " << string_from_type
|
||||
<typename bg::coordinate_type<G1>::type>::name()
|
||||
);
|
||||
|
||||
// Check total area of resulting rings
|
||||
typename bg::area_result<G1>::type total_area = 0;
|
||||
BOOST_FOREACH(ring_type const& ring, v)
|
||||
{
|
||||
total_area += bg::area(ring);
|
||||
}
|
||||
|
||||
#ifndef HAVE_TTMATH
|
||||
BOOST_CHECK_CLOSE(expected_count_area.get<1>(), double(total_area), precision);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "traverse_" << operation(Direction)
|
||||
<< "_" << id
|
||||
<< "_" << string_from_type<typename bg::coordinate_type<G1>::type>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<typename bg::point_type<G2>::type> mapper(svg, 500, 500);
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
// Input shapes in green/blue
|
||||
mapper.map(g1, "fill-opacity:0.5;fill:rgb(153,204,0);"
|
||||
"stroke:rgb(153,204,0);stroke-width:3");
|
||||
mapper.map(g2, "fill-opacity:0.3;fill:rgb(51,51,153);"
|
||||
"stroke:rgb(51,51,153);stroke-width:3");
|
||||
|
||||
// Traversal rings in magenta/light yellow fill
|
||||
BOOST_FOREACH(ring_type const& ring, v)
|
||||
{
|
||||
mapper.map(ring, "fill-opacity:0.05;stroke-opacity:0.4;fill:rbg(255,255,128);"
|
||||
"stroke:rgb(255,0,255);stroke-width:8");
|
||||
}
|
||||
|
||||
// turn points in orange, + enrichment/traversal info
|
||||
typedef typename bg::coordinate_type<G1>::type coordinate_type;
|
||||
|
||||
// Simple map to avoid two texts at same place (note that can still overlap!)
|
||||
std::map<std::pair<coordinate_type, coordinate_type>, int> offsets;
|
||||
int index = 0;
|
||||
int const lineheight = 10;
|
||||
int const margin = 5;
|
||||
|
||||
BOOST_FOREACH(turn_info const& turn, turns)
|
||||
{
|
||||
mapper.map(turn.point, "fill:rgb(255,128,0);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1", 3);
|
||||
|
||||
{
|
||||
// Map characteristics
|
||||
std::pair<coordinate_type, coordinate_type> p
|
||||
= std::make_pair(bg::get<0>(turn.point), bg::get<1>(turn.point));
|
||||
std::string style = "fill:rgb(0,0,0);font-family:Arial;font-size:8px";
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << index
|
||||
<< ": " << bg::operation_char(turn.operations[0].operation)
|
||||
<< " " << bg::operation_char(turn.operations[1].operation)
|
||||
<< " (" << bg::method_char(turn.method) << ")"
|
||||
<< (turn.ignore ? " (ignore) " : " ")
|
||||
;
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
mapper.text(turn.point, out.str(), style, margin, offset);
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "ip: " << turn.operations[0].enriched.travels_to_ip_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_ip_index;
|
||||
if (turn.operations[0].enriched.next_ip_index != -1
|
||||
|| turn.operations[1].enriched.next_ip_index != -1)
|
||||
{
|
||||
out << " [" << turn.operations[0].enriched.next_ip_index
|
||||
<< "/" << turn.operations[1].enriched.next_ip_index
|
||||
<< "]"
|
||||
;
|
||||
}
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
mapper.text(turn.point, out.str(), style, margin, offset);
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << "vx:" << turn.operations[0].enriched.travels_to_vertex_index
|
||||
<< "/" << turn.operations[1].enriched.travels_to_vertex_index;
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
mapper.text(turn.point, out.str(), style, margin, offset);
|
||||
}
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << std::setprecision(3)
|
||||
<< "dist: " << turn.operations[0].enriched.distance
|
||||
<< " / " << turn.operations[1].enriched.distance;
|
||||
|
||||
offsets[p] += lineheight;
|
||||
int offset = offsets[p];
|
||||
mapper.text(turn.point, out.str(), style, margin, offset);
|
||||
}
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_TEST_MULTI)
|
||||
template <typename T>
|
||||
void test_all()
|
||||
{
|
||||
namespace bg = boost::geometry;
|
||||
using namespace boost::geometry::detail::overlay;
|
||||
|
||||
typedef bg::point<T, 2, bg::cs::cartesian> P;
|
||||
typedef bg::polygon<P> polygon;
|
||||
typedef bg::box<P> box;
|
||||
typedef boost::tuple<int, double> Tuple;
|
||||
|
||||
|
||||
std::cout << std::setprecision(10);
|
||||
|
||||
#ifdef BOOST_GEOMETRY_DEBUG_OVERLAY_ONLY_ONE
|
||||
{
|
||||
// distance-zero-2
|
||||
std::string dz[2] = {
|
||||
"POLYGON((24.587966918945313 61.027225494384766,32.1783447265625 62.988296508789063,34.655326843261719 55.550270080566406,41.730445861816406 52.173538208007812,38.846851348876953 44.883510589599609,42.096187591552734 37.748981475830078,35.201282501220703 34.018035888671875,33.104434967041016 26.46403694152832,25.42442512512207 28.037921905517578,18.962528228759766 23.599054336547852,14.090974807739258 29.741334915161133,6.2876262664794922 30.494592666625977,6.5039811134338379 38.331226348876953,1.0104535818099976 43.924152374267578,6.2134823799133301 49.788291931152344,5.6002583503723145 57.603889465332031,13.355405807495117 58.751640319824219,17.909420013427734 65.132911682128906,24.587966918945313 61.027225494384766))",
|
||||
"POLYGON((43.551433563232422 47.905071258544922,46.384872436523438 39.57366943359375,53.589195251464844 44.627212524414063,50.984420776367188 36.221515655517578,59.783241271972656 36.075325012207031,52.735191345214844 30.806018829345703,59.767654418945313 25.51593017578125,50.968441009521484 25.395713806152344,53.548389434814453 16.982362747192383,46.359016418457031 22.057153701782227,43.500991821289063 13.734155654907227,40.667552947998047 22.065553665161133,33.463230133056641 17.012012481689453,36.068000793457031 25.417709350585938,27.269184112548828 25.563901901245117,34.317234039306641 30.833206176757812,27.284770965576172 36.123294830322266,36.083980560302734 36.243511199951172,33.504035949707031 44.6568603515625,40.693408966064453 39.582073211669922,43.551433563232422 47.905071258544922))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 68.678921274288541), dz[0], dz[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 1505.4202304878663), dz[0], dz[1]);
|
||||
}
|
||||
return;
|
||||
#endif
|
||||
|
||||
/*
|
||||
// SNL problem
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("snl-3",
|
||||
boost::make_tuple(1, 99),
|
||||
"POLYGON((184913.4512400339881423860788345336914 606985.779408219968900084495544433594,184912.8999999999941792339086532592773 606987.145999999949708580970764160156,184904.4135310589917935431003570556641 606987.651360383024439215660095214844,184901.847619076987029984593391418457 607014.593436188995838165283203125,184916.3977574919990729540586471557617 607021.060164373018778860569000244141,184927.7147701499925460666418075561523 607008.126435620011761784553527832031,184926.0980706939881201833486557006836 606998.426238880958408117294311523438,184913.4512400339881423860788345336914 606985.779408219968900084495544433594),(184907.5560000000114087015390396118164 607013.300999999977648258209228515625,184905.7820000000065192580223083496094 607009.971999999950639903545379638672,184906.0039999999862629920244216918945 607005.978000000002793967723846435547,184908.4439999999885912984609603881836 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999999993480741977691650391,184919.3140000000130385160446166992188 606993.996000000042840838432312011719,184922.4200000000128056854009628295898 606995.770999999949708580970764160156,184925.7470000000030267983675003051758 606998.876999999978579580783843994141,184926.4130000000004656612873077392578 607002.871999999973922967910766601563,184925.7470000000030267983675003051758 607007.753000000026077032089233398438,184922.4200000000128056854009628295898 607012.190999999991618096828460693359,184917.0959999999904539436101913452148 607015.297999999951571226119995117188,184911.7710000000079162418842315673828 607015.297999999951571226119995117188,184907.5560000000114087015390396118164 607013.300999999977648258209228515625))",
|
||||
"POLYGON((184861.1180000010062940418720245361328 606901.158000000054016709327697753906,184893.7870000000111758708953857421875 606898.482999998959712684154510498047,184925.0430000009946525096893310546875 606913.399999998975545167922973632813,184927.1739999990095384418964385986328 606951.758999999961815774440765380859,184912.8999999990046489983797073364258 606987.146000002045184373855590820313,184877.8700000010139774531126022338867 606989.232000001007691025733947753906,184885.1030000000027939677238464355469 607023.773999999975785613059997558594,184899.0579999980109278112649917602539 607022.743000000948086380958557128906,184906.0080000009911600500345230102539 607044.947999999043531715869903564453,184966.4649999999965075403451919555664 607025.020000000018626451492309570313,184968.4420000019890721887350082397461 606961.300000000977888703346252441406,185024.7679999989923089742660522460938 606947.401999998954124748706817626953,185024.5439999999944120645523071289063 606941.354999999981373548507690429688,185027.0069999989937059581279754638672 606937.322999999043531715869903564453,185030.3660000000090803951025009155273 606934.186999998986721038818359375,185035.5159999990137293934822082519531 606933.962999999988824129104614257813,185040.4420000019890721887350082397461 606935.530999999027699232101440429688,185042.905000000988366082310676574707 606939.114999998011626303195953369141,185088.3640000000013969838619232177734 606931.385000001988373696804046630859,185089.1389999990060459822416305541992 607015.508999999961815774440765380859,185095.1999999989930074661970138549805 607011.300000000977888703346252441406,185118.8269999999902211129665374755859 606995.545000002020969986915588378906,185126.813000001013278961181640625 606991.9950000010430812835693359375,185177.7270000019925646483898162841797 606973.798999998951330780982971191406,185181.4820000010076910257339477539063 606966.67599999904632568359375,185193.5709999990067444741725921630859 606977.795000002020969986915588378906,185193.710999998991610482335090637207 606960.300000000977888703346252441406,185189.3520000019925646483898162841797 606779.020000000018626451492309570313,185167.5150000010035000741481781005859 606783.844000000972300767898559570313,185086.9600000010104849934577941894531 606801.241000000038184225559234619141,185011.7069999990053474903106689453125 606817.809000000008381903171539306641,185000 606819.304000001051463186740875244141,184994.0340000019932631403207778930664 606819.793999999994412064552307128906,184976.3979999980074353516101837158203 606819.572000000975094735622406005859,184956.6539999989909119904041290283203 606817.1310000009834766387939453125,184934.9129999990109354257583618164063 606813.136999998008832335472106933594,184893.0969999989902134984731674194336 606804.927000000956468284130096435547,184884.4450000000069849193096160888672 606831.555000000051222741603851318359,184866.9189999999944120645523071289063 606883.480999998981133103370666503906,184861.1180000010062940418720245361328 606901.158000000054016709327697753906),(184907.5560000019904691725969314575195 607013.30099999904632568359375,184905.7820000019855797290802001953125 607009.971999999019317328929901123047,184906.0040000010048970580101013183594 607005.978000000002793967723846435547,184908.4439999980095308274030685424805 606998.876999999978579580783843994141,184912.2149999999965075403451919555664 606994.217999998014420270919799804688,184919.3139999989944044500589370727539 606993.995999998995102941989898681641,184922.420000001991866156458854675293 606995.771000002045184373855590820313,184925.7470000009925570338964462280273 606998.876999999978579580783843994141,184926.4129999990109354257583618164063 607002.872000001021660864353179931641,184925.7470000009925570338964462280273 607007.752999998978339135646820068359,184922.420000001991866156458854675293 607012.190999999991618096828460693359,184917.0960000010090880095958709716797 607015.297999999951571226119995117188,184911.7710000019869767129421234130859 607015.297999999951571226119995117188,184907.5560000019904691725969314575195 607013.30099999904632568359375))");
|
||||
|
||||
return;
|
||||
*/
|
||||
|
||||
|
||||
// 1-6
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("1", boost::make_tuple(1, 5.4736), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("2", boost::make_tuple(1, 12.0545), case_2[0], case_2[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("3", boost::make_tuple(1, 5), case_3[0], case_3[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("4", boost::make_tuple(1, 10.2212), case_4[0], case_4[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("5", boost::make_tuple(2, 12.8155), case_5[0], case_5[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("6", boost::make_tuple(1, 4.5), case_6[0], case_6[1]);
|
||||
|
||||
// 7-12
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("7", boost::make_tuple(0, 0), case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("8", boost::make_tuple(0, 0), case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("9", boost::make_tuple(0, 0), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("10", boost::make_tuple(0, 0), case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("11", boost::make_tuple(1, 1), case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("12", boost::make_tuple(2, 0.63333), case_12[0], case_12[1]);
|
||||
|
||||
// 13-18
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("13", boost::make_tuple(0, 0), case_13[0], case_13[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("14", boost::make_tuple(0, 0), case_14[0], case_14[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("15", boost::make_tuple(0, 0), case_15[0], case_15[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("16", boost::make_tuple(0, 0), case_16[0], case_16[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("17", boost::make_tuple(1, 2), case_17[0], case_17[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("18", boost::make_tuple(1, 2), case_18[0], case_18[1]);
|
||||
|
||||
// 19-24
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("19", boost::make_tuple(0, 0), case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("20", boost::make_tuple(1, 5.5), case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("21", boost::make_tuple(0, 0), case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("22", boost::make_tuple(0, 0), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("23", boost::make_tuple(1, 1.4), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("24", boost::make_tuple(1, 1.0), case_24[0], case_24[1]);
|
||||
|
||||
// 25-30
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("25", boost::make_tuple(0, 0), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("26", boost::make_tuple(0, 0), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("27", boost::make_tuple(1, 0.9545454), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("28", boost::make_tuple(1, 0.9545454), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("29", boost::make_tuple(1, 1.4), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("30", boost::make_tuple(1, 0.5), case_30[0], case_30[1]);
|
||||
|
||||
// 31-36
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("31", boost::make_tuple(0, 0), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("32", boost::make_tuple(0, 0), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("33", boost::make_tuple(0, 0), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("34", boost::make_tuple(1, 0.5), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("35", boost::make_tuple(1, 1.0), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("36", boost::make_tuple(1, 1.625), case_36[0], case_36[1]);
|
||||
|
||||
// 37-42
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("37", boost::make_tuple(2, 0.666666), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("38", boost::make_tuple(2, 0.971429), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("39", boost::make_tuple(1, 24), case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("40", boost::make_tuple(0, 0), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("41", boost::make_tuple(1, 5), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("42", boost::make_tuple(1, 5), case_42[0], case_42[1]);
|
||||
|
||||
// 43-48
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("43", boost::make_tuple(2, 0.75), case_43[0], case_43[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("44", boost::make_tuple(1, 44), case_44[0], case_44[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("45", boost::make_tuple(1, 45), case_45[0], case_45[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("46", boost::make_tuple(1, 46), case_46[0], case_46[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("47", boost::make_tuple(1, 47), case_47[0], case_47[1]);
|
||||
|
||||
// 49-54
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("50", boost::make_tuple(0, 0), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("51", boost::make_tuple(0, 0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("52", boost::make_tuple(1, 10.5), case_52[0], case_52[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53a", boost::make_tuple(0, 0), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("53b", boost::make_tuple(0, 0), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54aa", boost::make_tuple(1, 2), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54ab", boost::make_tuple(1, 2), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54ba", boost::make_tuple(1, 2), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("54bb", boost::make_tuple(1, 2), case_54[1], case_54[3]);
|
||||
|
||||
// 55-60
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("55", boost::make_tuple(1, 2), case_55[0], case_55[1]);
|
||||
|
||||
|
||||
// other
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("collinear_overlaps", boost::make_tuple(1, 24), collinear_overlaps[0], collinear_overlaps[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("many_situations", boost::make_tuple(1, 184), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// pies (went wrong when not all cases where implemented, especially some collinear (opposite) cases
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_16_4_12",
|
||||
boost::make_tuple(1, 491866.5), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_23_21_12_500",
|
||||
boost::make_tuple(2, 2363199.3313), pie_23_21_12_500[0], pie_23_21_12_500[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_23_23_3_2000",
|
||||
boost::make_tuple(2, 1867779.9349), pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_23_16_16",
|
||||
boost::make_tuple(2, 2128893.9555), pie_23_16_16[0], pie_23_16_16[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_16_2_15_0",
|
||||
boost::make_tuple(0, 0), pie_16_2_15_0[0], pie_16_2_15_0[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_4_13_15",
|
||||
boost::make_tuple(1, 490887.06678), pie_4_13_15[0], pie_4_13_15[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("pie_20_20_7_100",
|
||||
boost::make_tuple(2, 2183372.2718), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
|
||||
|
||||
// 1-6
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("1", boost::make_tuple(1, 11.5264), case_1[0], case_1[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("2", boost::make_tuple(1, 17.9455), case_2[0], case_2[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("3", boost::make_tuple(1, 9), case_3[0], case_3[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("4", boost::make_tuple(3, 17.7788), case_4[0], case_4[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("5", boost::make_tuple(2, 18.4345), case_5[0], case_5[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("6", boost::make_tuple(1, 9), case_6[0], case_6[1]);
|
||||
|
||||
// 7-12
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("7", boost::make_tuple(1, 9), case_7[0], case_7[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("8", boost::make_tuple(1, 12), case_8[0], case_8[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("9", boost::make_tuple(0, 0), case_9[0], case_9[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("10", boost::make_tuple(1, 9), case_10[0], case_10[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("11", boost::make_tuple(1, 8), case_11[0], case_11[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("12", boost::make_tuple(2, 8.36667), case_12[0], case_12[1]);
|
||||
|
||||
// 13-18
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("13", boost::make_tuple(1, 4), case_13[0], case_13[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("14", boost::make_tuple(1, 12), case_14[0], case_14[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("15", boost::make_tuple(1, 12), case_15[0], case_15[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("16", boost::make_tuple(1, 9), case_16[0], case_16[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("17", boost::make_tuple(1, 8), case_17[0], case_17[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("18", boost::make_tuple(1, 8), case_18[0], case_18[1]);
|
||||
|
||||
// 19-24
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("19", boost::make_tuple(1, 10), case_19[0], case_19[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("20", boost::make_tuple(1, 5.5), case_20[0], case_20[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("21", boost::make_tuple(0, 0), case_21[0], case_21[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("22", boost::make_tuple(0, 0), case_22[0], case_22[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("23", boost::make_tuple(1, 6.1), case_23[0], case_23[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("24", boost::make_tuple(1, 5.5), case_24[0], case_24[1]);
|
||||
|
||||
// 25-30
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("25", boost::make_tuple(0, 0), case_25[0], case_25[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("26", boost::make_tuple(0, 0), case_26[0], case_26[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("27", boost::make_tuple(1, 8.04545), case_27[0], case_27[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("28", boost::make_tuple(1, 10.04545), case_28[0], case_28[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("29", boost::make_tuple(1, 8.1), case_29[0], case_29[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("30", boost::make_tuple(1, 6.5), case_30[0], case_30[1]);
|
||||
|
||||
// 31-36
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("31", boost::make_tuple(0, 0), case_31[0], case_31[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("32", boost::make_tuple(0, 0), case_32[0], case_32[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("33", boost::make_tuple(0, 0), case_33[0], case_33[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("34", boost::make_tuple(1, 6.0), case_34[0], case_34[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("35", boost::make_tuple(1, 10.5), case_35[0], case_35[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("36", boost::make_tuple(1, 14.375), case_36[0], case_36[1]);
|
||||
|
||||
// 37-42
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("37", boost::make_tuple(1, 7.33333), case_37[0], case_37[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("38", boost::make_tuple(1, 9.52857), case_38[0], case_38[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("39", boost::make_tuple(1, 40.0), case_39[0], case_39[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("40", boost::make_tuple(0, 0), case_40[0], case_40[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("41", boost::make_tuple(1, 5), case_41[0], case_41[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("42", boost::make_tuple(1, 5), case_42[0], case_42[1]);
|
||||
|
||||
// 43-48
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("43", boost::make_tuple(3, 8.1875), case_43[0], case_43[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("44", boost::make_tuple(1, 44), case_44[0], case_44[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("45", boost::make_tuple(1, 45), case_45[0], case_45[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("46", boost::make_tuple(1, 46), case_46[0], case_46[1]);
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("47", boost::make_tuple(1, 47), case_47[0], case_47[1]);
|
||||
|
||||
// 49-54
|
||||
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("50", boost::make_tuple(1, 25), case_50[0], case_50[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("51", boost::make_tuple(0, 0), case_51[0], case_51[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("52", boost::make_tuple(1, 15.5), case_52[0], case_52[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53a", boost::make_tuple(2, 16), case_53[0], case_53[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("53b", boost::make_tuple(2, 16), case_53[0], case_53[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54aa", boost::make_tuple(2, 20), case_54[0], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54ab", boost::make_tuple(2, 20), case_54[0], case_54[3]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54ba", boost::make_tuple(2, 20), case_54[1], case_54[2]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("54bb", boost::make_tuple(2, 20), case_54[1], case_54[3]);
|
||||
|
||||
|
||||
// 55-60
|
||||
// 55 is going wrong!
|
||||
// TODO: implement "node" behaviour which merges nodes
|
||||
//test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("55", boost::make_tuple(3, 18), case_55[0], case_55[1]);
|
||||
|
||||
// other
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("collinear_overlaps",
|
||||
boost::make_tuple(1, 50), collinear_overlaps[0], collinear_overlaps[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("many_situations",
|
||||
boost::make_tuple(1, 207), case_many_situations[0], case_many_situations[1]);
|
||||
|
||||
|
||||
// pies (went wrong when not all cases where implemented, especially some collinear (opposite) cases
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_16_4_12",
|
||||
boost::make_tuple(1, 3669665.5), pie_16_4_12[0], pie_16_4_12[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_23_21_12_500",
|
||||
boost::make_tuple(1, 6295516.7185), pie_23_21_12_500[0], pie_23_21_12_500[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_23_23_3_2000",
|
||||
boost::make_tuple(1, 7118735.0530), pie_23_23_3_2000[0], pie_23_23_3_2000[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_23_16_16",
|
||||
boost::make_tuple(1, 5710474.5406), pie_23_16_16[0], pie_23_16_16[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_16_2_15_0",
|
||||
boost::make_tuple(1, 3833641.5), pie_16_2_15_0[0], pie_16_2_15_0[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_4_13_15",
|
||||
boost::make_tuple(1, 2208122.43322), pie_4_13_15[0], pie_4_13_15[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("pie_20_20_7_100",
|
||||
boost::make_tuple(1, 5577158.72823), pie_20_20_7_100[0], pie_20_20_7_100[1]);
|
||||
|
||||
|
||||
// From "Random Ellipse Stars", this all went wrong
|
||||
// when using Determinant/ra/rb and comparing with 0/1
|
||||
// Solved now.
|
||||
// ("hv" means "high volume")
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((24.995166778564453 50.011310577392578,46.630809783935547 37.494682312011719,46.661380767822266 12.499360084533691,25.003841400146484 0.020658308640122414,3.3419711589813232 12.491842269897461,3.3638687133789062 37.487174987792969,24.995166778564453 50.011310577392578))",
|
||||
"POLYGON((25.025228500366211 49.992599487304688,46.6719970703125 37.482185363769531,46.631874084472656 12.480358123779297,24.974153518676758 -0.011088892817497253,3.3419976234436035 12.524576187133789,3.3529467582702637 37.526435852050781,25.025228500366211 49.992599487304688))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv1", boost::make_tuple(1, 1624.508688461573), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv1", boost::make_tuple(1, 1622.7200125123809), hv[0], hv[1], 0.1);
|
||||
}
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((24.988700866699219 49.986705780029297,46.643772125244141 37.5079345703125,46.645118713378906 12.514699935913086,25.010652542114258 0.00024537215358577669,3.3652000427246094 12.495694160461426,3.3445985317230225 37.488922119140625,24.988700866699219 49.986705780029297))",
|
||||
"POLYGON((24.993022918701172 49.977996826171875,46.643772125244141 37.503200531005859,46.634654998779297 12.51569938659668,25.005790710449219 0.0029967525042593479,3.3705389499664307 12.504646301269531,3.348651647567749 37.492141723632812,24.993022918701172 49.977996826171875))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv2", boost::make_tuple(1, 1622.9193392726836), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv2", boost::make_tuple(1, 1622.1733591429329), hv[0], hv[1], 0.1);
|
||||
}
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((25.007728576660156 49.988899230957031,46.667163848876953 37.501667022705078,46.637229919433594 12.500443458557129,24.993251800537109 -0.01356174610555172,3.3565254211425781 12.512973785400391,3.3410670757293701 37.514209747314453,25.007728576660156 49.988899230957031))",
|
||||
"POLYGON((24.998353958129883 49.993511199951172,46.659591674804688 37.507373809814453,46.646518707275391 12.505118370056152,25.002584457397461 -0.0109936548396945,3.3565335273742676 12.501456260681152,3.3392288684844971 37.503707885742188,24.998353958129883 49.993511199951172))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv3", boost::make_tuple(1, 1624.22079205664), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv3", boost::make_tuple(1, 1623.8265057282042), hv[0], hv[1], 0.1);
|
||||
}
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((25.009130477905273 50.022209167480469,46.670387268066406 37.500617980957031,46.666873931884766 12.480625152587891,24.992231369018555 -0.017777863889932632,3.3260366916656494 12.495262145996094,3.3394229412078857 37.515254974365234,25.009130477905273 50.022209167480469))",
|
||||
"POLYGON((25.00263786315918 50.019630432128906,46.669231414794922 37.507579803466797,46.666202545166016 12.487733840942383,24.997152328491211 -0.020060751587152481,3.3308455944061279 12.492485046386719,3.3333024978637695 37.5123291015625,25.00263786315918 50.019630432128906))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv4", boost::make_tuple(1, 1626.5146964146334), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv4", boost::make_tuple(1, 1626.2580370864305), hv[0], hv[1], 0.1);
|
||||
}
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((24.987522125244141 49.997768402099609,46.643741607666016 37.509471893310547,46.654956817626953 12.510490417480469,25.011669158935547 -0.00019846600480377674,3.3563058376312256 12.489578247070313,3.3433761596679687 37.488559722900391,24.987522125244141 49.997768402099609))",
|
||||
"POLYGON((25.005760192871094 50.008182525634766,46.648590087890625 37.491542816162109,46.655918121337891 12.489977836608887,24.994773864746094 0.0050580352544784546,3.3391191959381104 12.499494552612305,3.3574333190917969 37.501052856445312,25.005760192871094 50.008182525634766))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv5", boost::make_tuple(1, 1624.2158307261871), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv5", boost::make_tuple(1, 1623.4506071521519), hv[0], hv[1], 0.1);
|
||||
}
|
||||
|
||||
|
||||
// Case 2009-12-07
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((25.011470794677734 50.017532348632813,42.678981781005859 42.661365509033203,50.017532348632813 24.986530303955078,42.661365509033203 7.3190178871154785,24.986530303955078 -0.019533095881342888,7.3190178871154785 7.336634635925293,-0.019533095881342888 25.011470794677734,7.336634635925293 42.678981781005859,25.011470794677734 50.017532348632813))",
|
||||
"POLYGON((25.002880096435547 50.013965606689453,46.671913146972656 37.507381439208984,46.660655975341797 12.488155364990234,24.9951171875 -0.024483053013682365,3.3334629535675049 12.494877815246582,3.3299689292907715 37.514102935791016,25.002880096435547 50.013965606689453))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv6", boost::make_tuple(1, 1604.6318757402121), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv6", boost::make_tuple(1, 1790.091872401327), hv[0], hv[1], 0.1);
|
||||
}
|
||||
|
||||
// Case 2009-12-08, needing sorting on side in enrich_intersection_points
|
||||
{
|
||||
std::string hv[2] = {
|
||||
"POLYGON((24.983684539794922 49.995647430419922,46.643482208251953 37.513137817382813,46.654392242431641 12.51393985748291,25.014318466186523 -0.0027416276279836893,3.3589246273040771 12.487411499023438,3.3391971588134766 37.486602783203125,24.983684539794922 49.995647430419922))",
|
||||
"POLYGON((24.990163803100586 49.9993896484375,46.655281066894531 37.512466430664062,46.654388427734375 12.506458282470703,25.007841110229492 -0.012621366418898106,3.3524465560913086 12.491152763366699,3.3338801860809326 37.497154235839844,24.990163803100586 49.9993896484375))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("hv7", boost::make_tuple(1, 1624.5779453641017), hv[0], hv[1], 0.1);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("hv7", boost::make_tuple(1, 1623.6936420295772), hv[0], hv[1], 0.1);
|
||||
}
|
||||
|
||||
|
||||
// From "Random Ellipse Stars", this all went wrong
|
||||
// when distances was zero (dz)
|
||||
// "Distance zero", dz, means: the distance between two intersection points
|
||||
// on a same segment is 0, therefore it can't be sorted normally, therefore
|
||||
// the chance is 50% that the segments are not sorted correctly and the wrong
|
||||
// decision is taken.
|
||||
// Solved (by sorting on sides instead of on distance)
|
||||
{
|
||||
// distance-zero-1
|
||||
std::string dz[2] = {
|
||||
"POLYGON((30.526203155517578 56.781166076660156,38.987510681152344 58.710700988769531,41.042613983154297 50.279010772705078,48.390048980712891 45.660350799560547,43.881126403808594 38.245067596435547,45.810657501220703 29.783760070800781,37.378971099853516 27.728654861450195,32.760307312011719 20.381219863891602,25.345026016235352 24.890144348144531,16.883718490600586 22.960611343383789,14.828612327575684 31.392299652099609,7.481177806854248 36.010959625244141,11.990103721618652 43.426242828369141,10.060568809509277 51.887550354003906,18.492258071899414 53.942657470703125,23.110919952392578 61.290092468261719,30.526203155517578 56.781166076660156))",
|
||||
"POLYGON((12.580197334289551 33.274467468261719,14.852641105651855 24.577714920043945,21.524574279785156 30.601236343383789,18.734457015991211 22.056488037109375,27.603805541992188 23.51667594909668,20.636968612670898 17.836828231811523,28.887777328491211 14.270085334777832,19.956142425537109 13.258448600769043,24.968837738037109 5.7971897125244141,16.908138275146484 9.7749528884887695,17.091224670410156 0.78807485103607178,12.460672378540039 8.4923257827758789,7.7560214996337891 0.83309894800186157,8.0257854461669922 9.8177928924560547,-0.072908863425254822 5.9179673194885254,5.0115232467651367 13.330527305603027,-3.9099369049072266 14.42827033996582,4.3748917579650879 17.915260314941406,-2.5368332862854004 23.662046432495117,6.3180174827575684 22.116373062133789,3.6104514598846436 30.687637329101563,10.223971366882324 24.600040435791016,12.580197334289551 33.274467468261719))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_1",
|
||||
boost::make_tuple(3, 16.887537949472005), dz[0], dz[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_1",
|
||||
boost::make_tuple(3, 1444.2621305732864), dz[0], dz[1]);
|
||||
}
|
||||
{
|
||||
// distance-zero-2
|
||||
std::string dz[2] = {
|
||||
"POLYGON((24.587966918945313 61.027225494384766,32.1783447265625 62.988296508789063,34.655326843261719 55.550270080566406,41.730445861816406 52.173538208007812,38.846851348876953 44.883510589599609,42.096187591552734 37.748981475830078,35.201282501220703 34.018035888671875,33.104434967041016 26.46403694152832,25.42442512512207 28.037921905517578,18.962528228759766 23.599054336547852,14.090974807739258 29.741334915161133,6.2876262664794922 30.494592666625977,6.5039811134338379 38.331226348876953,1.0104535818099976 43.924152374267578,6.2134823799133301 49.788291931152344,5.6002583503723145 57.603889465332031,13.355405807495117 58.751640319824219,17.909420013427734 65.132911682128906,24.587966918945313 61.027225494384766))",
|
||||
"POLYGON((43.551433563232422 47.905071258544922,46.384872436523438 39.57366943359375,53.589195251464844 44.627212524414063,50.984420776367188 36.221515655517578,59.783241271972656 36.075325012207031,52.735191345214844 30.806018829345703,59.767654418945313 25.51593017578125,50.968441009521484 25.395713806152344,53.548389434814453 16.982362747192383,46.359016418457031 22.057153701782227,43.500991821289063 13.734155654907227,40.667552947998047 22.065553665161133,33.463230133056641 17.012012481689453,36.068000793457031 25.417709350585938,27.269184112548828 25.563901901245117,34.317234039306641 30.833206176757812,27.284770965576172 36.123294830322266,36.083980560302734 36.243511199951172,33.504035949707031 44.6568603515625,40.693408966064453 39.582073211669922,43.551433563232422 47.905071258544922))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 68.678921274288541), dz[0], dz[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_2",
|
||||
boost::make_tuple(2, 1505.4202304878663), dz[0], dz[1]);
|
||||
}
|
||||
|
||||
{
|
||||
// distance-zero-3
|
||||
std::string dz[2] = {
|
||||
"POLYGON((20.813335418701172 73.060707092285156,22.815366744995117 61.968788146972656,31.383756637573242 69.291458129882813,28.001794815063477 58.539661407470703,38.991741180419922 61.041633605957031,31.000555038452148 53.093067169189453,41.894393920898437 50.201171875,31.124666213989258 46.876754760742188,39.426750183105469 39.253490447998047,28.345697402954102 41.314804077148438,32.154121398925781 30.706569671630859,23.300275802612305 37.681396484375,21.742572784423828 26.518407821655273,17.144247055053711 36.808895111083984,10.5772705078125 27.648460388183594,11.287883758544922 38.897186279296875,1.2160475254058838 33.837848663330078,7.0728073120117187 43.467861175537109,-4.1965517997741699 43.668655395507812,5.4646410942077637 49.473834991455078,-4.4205660820007324 54.888763427734375,6.8317971229553223 55.539215087890625,0.59532338380813599 64.927780151367187,10.861076354980469 60.274494171142578,9.7020368576049805 71.485885620117188,16.629419326782227 62.594875335693359,20.813335418701172 73.060707092285156))",
|
||||
"POLYGON((1.6459450721740723 46.720386505126953,10.693820953369141 61.892372131347656,7.2385158538818359 44.568569183349609,23.921955108642578 50.3751220703125,10.139513969421387 39.325347900390625,26.652151107788086 33.049518585205078,8.9915294647216797 33.444084167480469,17.606916427612305 18.02239990234375,4.3317174911499023 29.676681518554687,1.0186206102371216 12.32512378692627,-1.6595441102981567 29.785955429077148,-15.35089111328125 18.623508453369141,-6.1788778305053711 33.720771789550781,-23.842140197753906 33.970470428466797,-7.1116366386413574 39.639987945556641,-20.481979370117188 51.184993743896484,-4.0213727951049805 44.773937225341797,-6.8426628112792969 62.212215423583984,1.6459450721740723 46.720386505126953))"
|
||||
};
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("dz_3",
|
||||
boost::make_tuple(6, 192.49316937645651), dz[0], dz[1]);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("dz_3",
|
||||
boost::make_tuple(6, 1446.496005965641), dz[0], dz[1]);
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
return;
|
||||
|
||||
// They still have errors
|
||||
|
||||
// ticket#17
|
||||
test_overlay<polygon, box, test_traverse<operation_intersection>, Tuple>("ticket_17", boost::make_tuple(2, 2.687433027e-006), ticket_17[0], ticket_17[1], 0.1);
|
||||
test_overlay<polygon, box, test_traverse<operation_union>, Tuple>("ticket_17", boost::make_tuple(3, 0.00922511561516), ticket_17[0], ticket_17[1], 0.1);
|
||||
|
||||
// Boost.List during Formal Review, isovists Brandon
|
||||
// For FP, they may deviate more.
|
||||
/***
|
||||
static const bool is_float = string_from_type<T>::name() == std::string("f");
|
||||
static const bool is_double = string_from_type<T>::name() == std::string("d");
|
||||
test_overlay<polygon, polygon, test_traverse<operation_intersection>, Tuple>("isov",
|
||||
boost::make_tuple(1, 88.19203119), isovist[0], isovist[1],
|
||||
is_float || is_double ? 1.0 : 0.01);
|
||||
test_overlay<polygon, polygon, test_traverse<operation_union>, Tuple>("isov",
|
||||
boost::make_tuple(1, 313.3603646234), isovist[0], isovist[1],
|
||||
is_float || is_double ? 1.0 : 0.01);
|
||||
***/
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<float>();
|
||||
test_all<double>();
|
||||
#ifdef HAVE_TTMATH
|
||||
test_all<tt>();
|
||||
#endif
|
||||
|
||||
#if ! defined(_MSC_VER)
|
||||
test_all<long double>();
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::numeric_adaptor::cln_value_type>();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::numeric_adaptor::gmp_value_type>();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
182
test/algorithms/overlay/traverse.vcproj
Normal file
182
test/algorithms/overlay/traverse.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="traverse"
|
||||
ProjectGUID="{6260214E-DB6F-4934-ADF7-DD2B1666171B}"
|
||||
RootNamespace="traverse"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\traverse"
|
||||
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=".;../../../../..;../..;c:\svn\msm"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;TEST_WITH_SVG"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\traverse"
|
||||
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=".;../../../../..;../..;c:\svn\msm"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\traverse.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
216
test/algorithms/overlay/traverse_gmp.cpp
Normal file
216
test/algorithms/overlay/traverse_gmp.cpp
Normal file
@ -0,0 +1,216 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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)
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning( disable : 4244 )
|
||||
#pragma warning( disable : 4267 )
|
||||
#endif
|
||||
|
||||
//#define GGL_DEBUG_INTERSECTION
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <string>
|
||||
#include <fstream>
|
||||
|
||||
#include <boost/numeric_adaptor/numeric_adaptor.hpp>
|
||||
#include <boost/numeric_adaptor/gmp_value_type.hpp>
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
# include <boost/numeric_adaptor/cln_value_type.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
#include <boost/geometry/geometry.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/detail/overlay/turn_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/enrichment_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/traversal_info.hpp>
|
||||
#include <boost/geometry/algorithms/detail/overlay/calculate_distance_policy.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/get_turns.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/enrich_intersection_points.hpp>
|
||||
#include <boost/geometry/algorithms/overlay/traverse.hpp>
|
||||
|
||||
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
#define TEST_WITH_SVG
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_traverse(std::string const& caseid, G1 const& g1, G2 const& g2)
|
||||
{
|
||||
|
||||
typedef boost::geometry::detail::intersection::intersection_point
|
||||
<typename boost::geometry::point_type<G2>::type> ip;
|
||||
typedef typename boost::range_const_iterator<std::vector<ip> >::type iterator;
|
||||
typedef std::vector<ip> ip_vector;
|
||||
ip_vector ips;
|
||||
|
||||
typedef typename boost::geometry::strategy_side
|
||||
<
|
||||
typename boost::geometry::cs_tag<G1>::type
|
||||
>::type strategy_type;
|
||||
|
||||
|
||||
typedef bg::detail::overlay::traversal_turn_info
|
||||
<
|
||||
typename boost::geometry::point_type<G2>::type
|
||||
> turn_info;
|
||||
typedef typename boost::range_iterator<const std::vector<turn_info> >::type iterator;
|
||||
std::vector<turn_info> ips;
|
||||
|
||||
bg::get_turns<bg::detail::overlay::calculate_distance_policy>(g1, g2, ips);
|
||||
boost::geometry::enrich_intersection_points(ips, g1, g2, strategy_type());
|
||||
|
||||
typedef boost::geometry::linear_ring<typename boost::geometry::point_type<G2>::type> ring_type;
|
||||
typedef std::vector<ring_type> out_vector;
|
||||
out_vector v;
|
||||
|
||||
|
||||
|
||||
boost::geometry::traverse
|
||||
<
|
||||
strategy_type,
|
||||
ring_type
|
||||
>
|
||||
(
|
||||
g1, g2, -1, ips, std::back_inserter(v)
|
||||
);
|
||||
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "intersection_" << caseid << ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
// Trick to have this always LongDouble
|
||||
//typedef boost::geometry::point_xy<long double> P;
|
||||
typedef typename boost::geometry::point_type<G1>::type P;
|
||||
//typename boost::geometry::replace_point_type<G1, P>::type rg1;
|
||||
//typename boost::geometry::replace_point_type<G2, P>::type rg2;
|
||||
|
||||
|
||||
|
||||
svg_mapper<P> mapper(svg, 1000, 800);
|
||||
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
// Input shapes in green/blue
|
||||
mapper.map(g1, "opacity:0.8;fill:rgb(0,255,0);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.8;fill:rgb(0,0,255);"
|
||||
"stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
// Traversal rings in red
|
||||
for (typename out_vector::const_iterator it = boost::begin(v);
|
||||
it != boost::end(v);
|
||||
++it)
|
||||
{
|
||||
mapper.map(*it, "fill-opacity:0.1;stroke-opacity:0.9;"
|
||||
"fill:rgb(255,0,0);stroke:rgb(255,0,0);stroke-width:5");
|
||||
|
||||
std::cout << boost::geometry::wkt(*it) << std::endl;
|
||||
std::cout << boost::geometry::area(*it) << std::endl;
|
||||
}
|
||||
|
||||
// IP's in orange
|
||||
for (iterator it = boost::begin(ips); it != boost::end(ips); ++it)
|
||||
{
|
||||
mapper.map(it->point, "fill:rgb(255,128,0);"
|
||||
"stroke:rgb(0,0,100);stroke-width:1");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
void test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2)
|
||||
{
|
||||
G1 g1;
|
||||
boost::geometry::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
boost::geometry::read_wkt(wkt2, g2);
|
||||
|
||||
boost::geometry::correct(g1);
|
||||
boost::geometry::correct(g2);
|
||||
std::cout << "area1 " << boost::geometry::area(g1) << " " << " area2: " << boost::geometry::area(g2) << std::endl;
|
||||
|
||||
test_traverse<OutputType>(caseid, g1, g2);
|
||||
}
|
||||
|
||||
|
||||
#if ! defined(GGL_TEST_MULTI)
|
||||
|
||||
template <typename P>
|
||||
void test_traverse_gmp(std::string const& caseid)
|
||||
{
|
||||
typedef boost::geometry::polygon<P> polygon;
|
||||
std::cout << typeid(typename boost::geometry::coordinate_type<P>::type).name() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<float>::epsilon() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<double>::epsilon() << std::endl;
|
||||
std::cout << std::setprecision(30) << std::numeric_limits<long double>::epsilon() << std::endl;
|
||||
|
||||
static std::string brandon[3] =
|
||||
{
|
||||
//37.43402099609375 1.470055103302002,
|
||||
"POLYGON((37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,50.974888957147442 -30.277285722290763,57.297810222148939 -37.546793343968417,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.523914387974358 -8.5152102535033496,47.585065917176543 -6.1314922196594779,45.389434814453125 -4.5143837928771973,46.296027072709599 -2.4984308554828116,37.29449462890625 1.7902572154998779))",
|
||||
"POLYGON((42.399410247802734 1.4956772327423096,42.721500396728516 2.2342472076416016,42.721500396728516 3.6584999561309814,51.20102152843122 7.1738039562841562,51.370888500897557 7.4163459734570729,37.43402099609375 1.470055103302002,37.29449462890625 1.7902572154998779,37.000419616699219 1.664225697517395,37.140213012695313 1.3446992635726929,36.954700469970703 1.2597870826721191,26.472516656201325 -3.5380830513658776,27.069889344709196 -4.2926591211028242,30.501169204711914 -2.3718316555023193,32.708126068115234 -2.3611266613006592,32.708126068115234 -2.3611700534820557,32.708168029785156 -2.3611698150634766,32.718830108642578 -4.3281683921813965,29.135100397190627 -8.9262827849488211,29.619997024536133 -9.5368013381958008,30.339155197143555 -8.9838371276855469,30.670633316040039 -8.8180980682373047,30.896280288696289 -9.1206979751586914,30.207040612748258 -10.275926149505661,30.947774887084961 -11.208560943603516,31.669155120849609 -10.653837203979492,32.000633239746094 -10.488097190856934,32.226280212402344 -10.790698051452637,31.682494778186321 -12.133624901803865,32.274600982666016 -12.879127502441406,32.998821258544922 -12.323249816894531,33.339523315429688 -12.147735595703125,33.566280364990234 -12.450697898864746,33.164891643669634 -14.000060288415174,33.598796844482422 -14.546377182006836,34.328716278076172 -13.992490768432617,34.658355712890625 -13.81736946105957,34.886280059814453 -14.120697975158691,34.634240447128811 -15.85007183479255,34.931102752685547 -16.223842620849609,35.656356811523438 -15.66030216217041,35.963497161865234 -15.476018905639648,37.326129913330078 -17.190576553344727,38.823680877685547 -16.296066284179688,39.966808319091797 -17.625011444091797,40.800632476806641 -17.208097457885742,41.821544647216797 -19.211688995361328,41.988733475572282 -19.945838749437218,57.524304765518266 -37.807195733984784,41.590042114257813 -7.2021245956420898,40.6978759765625 -5.4500408172607422,40.758884429931641 -5.418975830078125,42.577911376953125 -4.4901103973388672,42.577877044677734 -4.4900407791137695,42.699958801269531 -4.4278755187988281,46.559533858616469 -8.435196445683264,47.604561877161387 -6.087697464505224,45.389434814453125 -4.5143837928771973,46.695858001708984 -1.6093428134918213,47.263670054709685 -1.784876824891044,47.830955505371094 -0.69758313894271851,48.43512638981781 -0.81299959072453376,49.071769542946825 0.61489892713413252,43.764598846435547 0.93951499462127686,43.644271850585938 0.96149998903274536,42.399410247802734 1.4956772327423096))",
|
||||
"POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
|
||||
};
|
||||
|
||||
|
||||
// Test the FORWARD case
|
||||
test_one<polygon, polygon, polygon>(caseid, brandon[0], brandon[1]);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
int mode = (argc > 1) ? atol(argv[1]) : 1;
|
||||
switch(mode)
|
||||
{
|
||||
case 1 :
|
||||
test_traverse_gmp<boost::geometry::point_xy<float> >("float");
|
||||
break;
|
||||
case 2 :
|
||||
test_traverse_gmp<boost::geometry::point_xy<double> >("double");
|
||||
break;
|
||||
case 3 :
|
||||
test_traverse_gmp<boost::geometry::point_xy<long double> >("long double");
|
||||
break;
|
||||
case 4 :
|
||||
#if defined(HAVE_GMP)
|
||||
test_traverse_gmp<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >("gmp");
|
||||
#endif
|
||||
break;
|
||||
case 5 :
|
||||
#if defined(HAVE_CLN)
|
||||
test_traverse_gmp<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >("cln");
|
||||
#endif
|
||||
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
42
test/algorithms/perimeter.cpp
Normal file
42
test/algorithms/perimeter.cpp
Normal file
@ -0,0 +1,42 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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 <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <algorithms/test_perimeter.hpp>
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
// 3-4-5 triangle
|
||||
//test_geometry<std::pair<P, P> >("LINESTRING(0 0,3 4)", 5);
|
||||
|
||||
test_geometry<boost::geometry::linear_ring<P> >(
|
||||
"POLYGON((0 0,0 1,1 1,1 0,0 0))", 4);
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,0 1,1 0,0 0))", 1.0 + 1.0 + sqrt(2.0));
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))", 20);
|
||||
}
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
#if defined(HAVE_CLN)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::cln_value_type> >();
|
||||
#endif
|
||||
#if defined(HAVE_GMP)
|
||||
test_all<boost::geometry::point_xy<boost::numeric_adaptor::gmp_value_type> >();
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
182
test/algorithms/perimeter.vcproj
Normal file
182
test/algorithms/perimeter.vcproj
Normal file
@ -0,0 +1,182 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="perimeter"
|
||||
ProjectGUID="{EFC23FC0-86D3-4C81-A218-26F0D5A4D50B}"
|
||||
RootNamespace="perimeter"
|
||||
Keyword="Win32Proj"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\perimeter"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
ExceptionHandling="2"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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)\perimeter"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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=".\perimeter.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
170
test/algorithms/sectionalize.cpp
Normal file
170
test/algorithms/sectionalize.cpp
Normal file
File diff suppressed because one or more lines are too long
177
test/algorithms/sectionalize.vcproj
Normal file
177
test/algorithms/sectionalize.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="sectionalize"
|
||||
ProjectGUID="{50410F81-7B83-49D9-BDAE-FA3F0ADB2ADC}"
|
||||
RootNamespace="sectionalize"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\sectionalize"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\sectionalize"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\sectionalize.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
86
test/algorithms/simplify.cpp
Normal file
86
test/algorithms/simplify.cpp
Normal file
@ -0,0 +1,86 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, Amsterdam, the Netherlands
|
||||
// Copyright Bruno Lalande 2008, 2009
|
||||
// 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 <iterator>
|
||||
|
||||
|
||||
#include <algorithms/test_simplify.hpp>
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
|
||||
#include <test_common/test_point.hpp>
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_all()
|
||||
{
|
||||
test_geometry<boost::geometry::linestring<P> >(
|
||||
"LINESTRING(0 0,5 5,10 10)",
|
||||
"LINESTRING(0 0,10 10)", 1.0);
|
||||
|
||||
test_geometry<boost::geometry::linestring<P> >(
|
||||
"LINESTRING(0 0, 5 5, 6 5, 10 10)",
|
||||
"LINESTRING(0 0,10 10)", 1.0);
|
||||
|
||||
test_geometry<boost::geometry::linestring<P> >(
|
||||
"LINESTRING(0 0,5 5,7 5,10 10)",
|
||||
"LINESTRING(0 0,5 5,7 5,10 10)", 1.0);
|
||||
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
|
||||
|
||||
test_geometry<boost::geometry::polygon<P> >(
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0),(7 3,7 6,1 6,1 3,4 3,7 3))",
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0),(7 3,7 6,1 6,1 3,7 3))", 1.0);
|
||||
|
||||
/*
|
||||
|
||||
Above can be checked in PostGIS by:
|
||||
|
||||
select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 10 10)'),1.0)) as simplified
|
||||
union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 6 5, 10 10)'),1.0))
|
||||
union all select astext(ST_Simplify(geomfromtext('LINESTRING(0 0, 5 5, 7 5, 10 10)'),1.0))
|
||||
union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0))'),1.0))
|
||||
union all select astext(ST_Simplify(geomfromtext('POLYGON((4 0, 8 2, 8 7, 4 9, 0 7, 0 2, 2 1, 4 0),(7 3, 7 6, 1 6, 1 3, 4 3, 7 3))'),1.0))
|
||||
*/
|
||||
|
||||
// Just check compilation
|
||||
test_geometry<P>(
|
||||
"POINT(0 0)",
|
||||
"POINT(0 0)", 1.0);
|
||||
|
||||
|
||||
test_geometry<boost::geometry::linear_ring<P> >(
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,2 1,4 0))",
|
||||
"POLYGON((4 0,8 2,8 7,4 9,0 7,0 2,4 0))", 1.0);
|
||||
}
|
||||
|
||||
|
||||
template <typename P>
|
||||
void test_spherical()
|
||||
{
|
||||
test_geometry<boost::geometry::linestring<P> >(
|
||||
"LINESTRING(4.1 52.1,4.2 52.2,4.3 52.3)",
|
||||
"LINESTRING(4.1 52.1,4.3 52.3)", 0.01);
|
||||
}
|
||||
|
||||
|
||||
int test_main(int, char* [])
|
||||
{
|
||||
// Integer compiles, but simplify-process fails (due to distances)
|
||||
//test_all<boost::geometry::point_xy<int> >();
|
||||
//test_all<boost::geometry::point_xy<float> >();
|
||||
test_all<boost::geometry::point_xy<double> >();
|
||||
|
||||
test_spherical<boost::geometry::point<double, 2, boost::geometry::cs::spherical<boost::geometry::degree> > >();
|
||||
|
||||
return 0;
|
||||
}
|
177
test/algorithms/simplify.vcproj
Normal file
177
test/algorithms/simplify.vcproj
Normal file
@ -0,0 +1,177 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="8.00"
|
||||
Name="simplify"
|
||||
ProjectGUID="{B1760CB8-553B-42AB-B54E-3D0320FF252F}"
|
||||
RootNamespace="simplify"
|
||||
Keyword="Win32Proj"
|
||||
TargetFrameworkVersion="131072"
|
||||
>
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"
|
||||
/>
|
||||
</Platforms>
|
||||
<ToolFiles>
|
||||
</ToolFiles>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\simplify"
|
||||
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"
|
||||
MinimalRebuild="true"
|
||||
RuntimeLibrary="3"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="4"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="2"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
||||
IntermediateDirectory="$(ConfigurationName)\simplify"
|
||||
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"
|
||||
RuntimeLibrary="2"
|
||||
ExceptionHandling="2"
|
||||
UsePrecompiledHeader="0"
|
||||
DebugInformationFormat="3"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCManagedResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"
|
||||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="kernel32.lib $(NoInherit)"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="true"
|
||||
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="VCPostBuildEventTool"
|
||||
/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<File
|
||||
RelativePath=".\simplify.cpp"
|
||||
>
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
65
test/algorithms/test_area.hpp
Normal file
65
test/algorithms/test_area.hpp
Normal file
@ -0,0 +1,65 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_AREA_HPP
|
||||
#define BOOST_GEOMETRY_TEST_AREA_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_area(Geometry const& geometry, long double expected_area)
|
||||
{
|
||||
long double area = boost::geometry::area(geometry);
|
||||
|
||||
#ifdef GGL_TEST_DEBUG
|
||||
std::ostringstream out;
|
||||
out << typeid(typename boost::geometry::coordinate_type<Geometry>::type).name()
|
||||
<< " "
|
||||
<< typeid(typename boost::geometry::area_result<Geometry>::type).name()
|
||||
<< " "
|
||||
<< "area : " << boost::geometry::area(geometry)
|
||||
<< std::endl;
|
||||
std::cout << out.str();
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_CLOSE(area, expected_area, 0.0001);
|
||||
|
||||
// Test with explicitly defined strategies
|
||||
boost::geometry::strategy::area::by_triangles
|
||||
<
|
||||
typename boost::geometry::point_type<Geometry>::type
|
||||
> strategy1;
|
||||
|
||||
area = boost::geometry::area(geometry, strategy1);
|
||||
|
||||
boost::geometry::strategy::area::by_triangles
|
||||
<
|
||||
typename boost::geometry::point_type<Geometry>::type,
|
||||
long double
|
||||
> strategy2;
|
||||
|
||||
area = boost::geometry::area(geometry, strategy2);
|
||||
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt, double expected_area)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
test_area(geometry, expected_area);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
95
test/algorithms/test_centroid.hpp
Normal file
95
test/algorithms/test_centroid.hpp
Normal file
@ -0,0 +1,95 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_CENTROID_HPP
|
||||
#define BOOST_GEOMETRY_TEST_CENTROID_HPP
|
||||
|
||||
// Test-functionality, shared between single and multi tests
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
#include <boost/geometry/algorithms/centroid.hpp>
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template<std::size_t D>
|
||||
struct check_result
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct check_result<2>
|
||||
{
|
||||
template <typename Point, typename T>
|
||||
static void apply(Point const& p, T const& x, T const& y, T const&)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(p)), double(x), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(p)), double(y), 0.001);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <>
|
||||
struct check_result<3>
|
||||
{
|
||||
template <typename Point, typename T>
|
||||
static void apply(Point const& p, T const& x, T const& y, T const& z)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<0>(p)), double(x), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<1>(p)), double(y), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<2>(p)), double(z), 0.001);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename CalculationType, typename Geometry, typename Point>
|
||||
void test_with_other_calculation_type(Geometry const& geometry, Point& c1)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
// Calculate it with user defined strategy
|
||||
point_type c2;
|
||||
boost::geometry::centroid(geometry, c2,
|
||||
boost::geometry::strategy::centroid_::bashein_detmer<point_type, point_type, CalculationType>());
|
||||
|
||||
std::cout << typeid(CalculationType).name() << ": " << std::setprecision(20)
|
||||
<< boost::geometry::get<0>(c2) << " " << boost::geometry::get<1>(c2)
|
||||
<< " -> difference: " << boost::geometry::distance(c1, c2)
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
template <typename Geometry, typename T>
|
||||
void test_centroid(std::string const& wkt, T const& x, T const& y, T const& z = T())
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
point_type c1;
|
||||
boost::geometry::centroid(geometry, c1);
|
||||
check_result<boost::geometry::dimension<Geometry>::type::value>::apply(c1, x, y, z);
|
||||
|
||||
#ifdef REPORT_RESULTS
|
||||
std::cout << "normal: " << std::setprecision(20) << boost::geometry::get<0>(c1) << " " << boost::geometry::get<1>(c1) << std::endl;
|
||||
|
||||
//test_with_other_calculation_type<long long>(geometry, c1);
|
||||
test_with_other_calculation_type<float>(geometry, c1);
|
||||
test_with_other_calculation_type<long double>(geometry, c1);
|
||||
#if defined(HAVE_GMP)
|
||||
test_with_other_calculation_type<boost::numeric_adaptor::gmp_value_type>(geometry, c1);
|
||||
#endif
|
||||
#if defined(HAVE_CLN)
|
||||
test_with_other_calculation_type<boost::numeric_adaptor::cln_value_type>(geometry, c1);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#endif
|
55
test/algorithms/test_combine.hpp
Normal file
55
test/algorithms/test_combine.hpp
Normal file
@ -0,0 +1,55 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_COMBINE_HPP
|
||||
#define BOOST_GEOMETRY_TEST_COMBINE_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/combine.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/algorithms/assign.hpp>
|
||||
#include <boost/geometry/util/write_dsv.hpp>
|
||||
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
void test_combine(Box& box,
|
||||
std::string const& wkt,
|
||||
std::string const& expected)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
|
||||
boost::geometry::combine(box, geometry);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::dsv(box, ",", "(", ")", ",", "", "");
|
||||
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
template <typename Geometry, typename Box>
|
||||
void test_combine_other_strategy(Box& box,
|
||||
std::string const& wkt,
|
||||
std::string const& expected)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
|
||||
|
||||
boost::geometry::combine(box, geometry);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::dsv(box, ",", "(", ")", ",", "", "");
|
||||
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
113
test/algorithms/test_convex_hull.hpp
Normal file
113
test/algorithms/test_convex_hull.hpp
Normal file
@ -0,0 +1,113 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_CONVEX_HULL_HPP
|
||||
#define BOOST_GEOMETRY_TEST_CONVEX_HULL_HPP
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/convex_hull.hpp>
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/write_wkt.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
|
||||
template <typename Geometry, typename Hull>
|
||||
void test_convex_hull(Geometry const& geometry, Hull const& hull,
|
||||
std::size_t size_original, std::size_t size_hull,
|
||||
double expected_area, bool reverse)
|
||||
{
|
||||
|
||||
std::size_t n = boost::geometry::num_points(hull);
|
||||
|
||||
BOOST_CHECK_MESSAGE(n == size_hull,
|
||||
"convex hull: " << boost::geometry::wkt(geometry)
|
||||
<< " -> " << boost::geometry::wkt(hull)
|
||||
<< " type "
|
||||
<< (typeid(typename boost::geometry::coordinate_type<Hull>::type).name())
|
||||
<< " -> Expected: " << size_hull
|
||||
<< " detected: " << n);
|
||||
|
||||
|
||||
BOOST_CHECK(boost::geometry::num_points(geometry) == size_original);
|
||||
|
||||
double ah = boost::geometry::area(hull);
|
||||
if (reverse)
|
||||
{
|
||||
ah = -ah;
|
||||
}
|
||||
|
||||
//std::cout << "Area: " << boost::geometry::area(geometry) << std::endl;
|
||||
//std::cout << boost::geometry::wkt(hull) << std::endl;
|
||||
|
||||
BOOST_CHECK_CLOSE(ah, expected_area, 0.001);
|
||||
}
|
||||
|
||||
template <typename Geometry, bool Clockwise>
|
||||
void test_geometry_order(std::string const& wkt,
|
||||
std::size_t size_original, std::size_t size_hull,
|
||||
double expected_area)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
|
||||
boost::geometry::polygon
|
||||
<
|
||||
typename boost::geometry::point_type<Geometry>::type,
|
||||
std::vector,
|
||||
std::vector,
|
||||
Clockwise
|
||||
> hull;
|
||||
|
||||
// Test version with output iterator
|
||||
convex_hull_inserter(geometry, std::back_inserter(hull.outer()));
|
||||
test_convex_hull(geometry, hull,
|
||||
size_original, size_hull, expected_area, ! Clockwise);
|
||||
|
||||
// Test version with ring as output
|
||||
boost::geometry::clear(hull);
|
||||
boost::geometry::convex_hull(geometry, hull.outer());
|
||||
test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
|
||||
|
||||
// Test version with polygon as output
|
||||
boost::geometry::clear(hull);
|
||||
boost::geometry::convex_hull(geometry, hull);
|
||||
test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
|
||||
|
||||
// Test version with strategy
|
||||
boost::geometry::clear(hull);
|
||||
boost::geometry::strategy::convex_hull::graham_andrew
|
||||
<
|
||||
Geometry,
|
||||
typename boost::geometry::point_type<Geometry>::type
|
||||
> graham;
|
||||
boost::geometry::convex_hull(geometry, hull.outer(), graham);
|
||||
test_convex_hull(geometry, hull, size_original, size_hull, expected_area, false);
|
||||
|
||||
// Test version with output iterator and strategy
|
||||
boost::geometry::clear(hull);
|
||||
boost::geometry::convex_hull_inserter(geometry, std::back_inserter(hull.outer()), graham);
|
||||
test_convex_hull(geometry, hull, size_original, size_hull, expected_area, ! Clockwise);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt,
|
||||
std::size_t size_original, std::size_t size_hull,
|
||||
double expected_area)
|
||||
{
|
||||
test_geometry_order<Geometry, true>(wkt, size_original, size_hull, expected_area);
|
||||
test_geometry_order<Geometry, false>(wkt, size_original, size_hull, expected_area);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
88
test/algorithms/test_envelope.hpp
Normal file
88
test/algorithms/test_envelope.hpp
Normal file
@ -0,0 +1,88 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_ENVELOPE_HPP
|
||||
#define BOOST_GEOMETRY_TEST_ENVELOPE_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/envelope.hpp>
|
||||
#include <boost/geometry/geometries/box.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template<std::size_t DimensionCount>
|
||||
struct check_result
|
||||
{};
|
||||
|
||||
template <>
|
||||
struct check_result<2>
|
||||
{
|
||||
template <typename Box, typename T>
|
||||
static void apply(Box const& b, const T& x1, const T& y1, const T& z1,
|
||||
const T& x2, const T& y2, const T& z2)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::min_corner, 0>(b)), double(x1), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::min_corner, 1>(b)), double(y1), 0.001);
|
||||
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::max_corner, 0>(b)), double(x2), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::max_corner, 1>(b)), double(y2), 0.001);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct check_result<3>
|
||||
{
|
||||
template <typename Box, typename T>
|
||||
static void apply(Box const& b, const T& x1, const T& y1, const T& z1,
|
||||
const T& x2, const T& y2, const T& z2)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::min_corner, 0>(b)), double(x1), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::min_corner, 1>(b)), double(y1), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::min_corner, 2>(b)), double(z1), 0.001);
|
||||
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::max_corner, 0>(b)), double(x2), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::max_corner, 1>(b)), double(y2), 0.001);
|
||||
BOOST_CHECK_CLOSE(double(boost::geometry::get<boost::geometry::max_corner, 2>(b)), double(z2), 0.001);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry, typename T>
|
||||
void test_envelope(std::string const& wkt,
|
||||
const T& x1, const T& x2,
|
||||
const T& y1, const T& y2,
|
||||
const T& z1 = 0, const T& z2 = 0)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
boost::geometry::box<typename boost::geometry::point_type<Geometry>::type > b;
|
||||
boost::geometry::envelope(geometry, b);
|
||||
|
||||
check_result<boost::geometry::dimension<Geometry>::type::value>::apply(b, x1, y1, z1, x2, y2, z2);
|
||||
}
|
||||
|
||||
template <typename Geometry, typename T>
|
||||
void test_envelope_strategy(std::string const& wkt,
|
||||
const T& x1, const T& x2,
|
||||
const T& y1, const T& y2,
|
||||
const T& z1 = 0, const T& z2 = 0)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
boost::geometry::box<typename boost::geometry::point_type<Geometry>::type > b;
|
||||
boost::geometry::envelope(geometry, b);
|
||||
|
||||
check_result<boost::geometry::dimension<Geometry>::type::value>::apply(b, x1, y1, z1, x2, y2, z2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
44
test/algorithms/test_equals.hpp
Normal file
44
test/algorithms/test_equals.hpp
Normal file
@ -0,0 +1,44 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_EQUALS_HPP
|
||||
#define BOOST_GEOMETRY_TEST_EQUALS_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/algorithms/equals.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void test_geometry(std::string const& caseid,
|
||||
std::string const& wkt1,
|
||||
std::string const& wkt2, bool expected)
|
||||
{
|
||||
//std::cout << caseid << " expected: " << int(expected) << std::endl;
|
||||
//std::cout << wkt1 << std::endl;
|
||||
Geometry1 geometry1;
|
||||
Geometry2 geometry2;
|
||||
|
||||
boost::geometry::read_wkt(wkt1, geometry1);
|
||||
boost::geometry::read_wkt(wkt2, geometry2);
|
||||
|
||||
bool detected = boost::geometry::equals(geometry1, geometry2);
|
||||
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"case: " << caseid
|
||||
<< " equals: " << wkt1
|
||||
<< " to " << wkt2
|
||||
<< " -> Expected: " << expected
|
||||
<< " detected: " << detected);
|
||||
}
|
||||
|
||||
#endif
|
216
test/algorithms/test_for_each.hpp
Normal file
216
test/algorithms/test_for_each.hpp
Normal file
@ -0,0 +1,216 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_FOR_EACH_HPP
|
||||
#define BOOST_GEOMETRY_TEST_FOR_EACH_HPP
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/for_each.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
#include <boost/geometry/util/write_dsv.hpp>
|
||||
|
||||
|
||||
template<typename Point>
|
||||
inline void translate_x_function(Point& p)
|
||||
{
|
||||
boost::geometry::set<0>(p, boost::geometry::get<0>(p) + 100.0);
|
||||
}
|
||||
|
||||
template<typename Point>
|
||||
struct scale_y_functor
|
||||
{
|
||||
inline void operator()(Point& p)
|
||||
{
|
||||
boost::geometry::set<1>(p, boost::geometry::get<1>(p) * 100.0);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Point>
|
||||
struct sum_x_functor
|
||||
{
|
||||
int sum;
|
||||
|
||||
sum_x_functor()
|
||||
: sum(0)
|
||||
{}
|
||||
|
||||
inline void operator()(Point const& p)
|
||||
{
|
||||
sum += int(boost::geometry::get<0>(p));
|
||||
}
|
||||
};
|
||||
|
||||
// Per segment
|
||||
static std::ostringstream g_out;
|
||||
|
||||
template<typename Segment>
|
||||
inline void stream_segment(Segment const& s)
|
||||
{
|
||||
g_out << boost::geometry::dsv(s) << " ";
|
||||
}
|
||||
|
||||
template<typename Segment>
|
||||
struct sum_segment_length
|
||||
{
|
||||
double sum;
|
||||
|
||||
sum_segment_length()
|
||||
: sum(0)
|
||||
{}
|
||||
inline void operator()(Segment const& s)
|
||||
{
|
||||
sum += boost::geometry::distance(s.first, s.second);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename Segment>
|
||||
inline void modify_segment(Segment& s)
|
||||
{
|
||||
if (boost::geometry::math::equals(boost::geometry::get<0,0>(s), 1.0))
|
||||
{
|
||||
boost::geometry::set<0,0>(s, 10.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_point_const(Geometry const& geometry, int expected)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
|
||||
sum_x_functor<point_type> functor;
|
||||
functor = boost::geometry::for_each_point(geometry, functor);
|
||||
BOOST_CHECK_EQUAL(functor.sum, expected);
|
||||
}
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_point_non_const(Geometry& geometry,
|
||||
std::string const& expected1,
|
||||
std::string const& expected2)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
|
||||
// function
|
||||
boost::geometry::for_each_point(geometry, translate_x_function<point_type>);
|
||||
std::ostringstream out1;
|
||||
out1 << boost::geometry::wkt(geometry);
|
||||
|
||||
BOOST_CHECK_MESSAGE(out1.str() == expected1,
|
||||
"for_each_point: "
|
||||
<< " expected " << expected1
|
||||
<< " got " << boost::geometry::wkt(geometry));
|
||||
|
||||
// functor
|
||||
boost::geometry::for_each_point(geometry, scale_y_functor<point_type>());
|
||||
|
||||
std::ostringstream out2;
|
||||
out2 << boost::geometry::wkt(geometry);
|
||||
|
||||
BOOST_CHECK_MESSAGE(out2.str() == expected2,
|
||||
"for_each_point: "
|
||||
<< " expected " << expected2
|
||||
<< " got " << boost::geometry::wkt(geometry));
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_point(std::string const& wkt
|
||||
, int expected_sum_x
|
||||
, std::string const& expected1
|
||||
, std::string const& expected2
|
||||
)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
test_per_point_const(geometry, expected_sum_x);
|
||||
test_per_point_non_const(geometry, expected1, expected2);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_segment_const(Geometry const& geometry,
|
||||
std::string const& expected_dsv,
|
||||
double expected_length)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
|
||||
// function
|
||||
g_out.str("");
|
||||
g_out.clear();
|
||||
boost::geometry::for_each_segment(geometry,
|
||||
stream_segment<boost::geometry::segment<const point_type> >);
|
||||
std::string out = g_out.str();
|
||||
boost::trim(out);
|
||||
BOOST_CHECK_EQUAL(out, expected_dsv);
|
||||
|
||||
// functor
|
||||
sum_segment_length<boost::geometry::segment<const point_type> > functor;
|
||||
functor = boost::geometry::for_each_segment(geometry, functor);
|
||||
|
||||
BOOST_CHECK_EQUAL(functor.sum, expected_length);
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_segment_non_const(Geometry& geometry,
|
||||
std::string const& expected_wkt)
|
||||
{
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
|
||||
// function
|
||||
boost::geometry::for_each_segment(geometry,
|
||||
modify_segment<boost::geometry::segment<point_type> >);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::wkt(geometry);
|
||||
|
||||
BOOST_CHECK_MESSAGE(out.str() == expected_wkt,
|
||||
"for_each_segment: "
|
||||
<< " expected " << expected_wkt
|
||||
<< " got " << boost::geometry::wkt(geometry));
|
||||
|
||||
// function is working here, functor works for all others,
|
||||
// it will also work here.
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_per_segment(std::string const& wkt
|
||||
, std::string const& expected_dsv
|
||||
, double expected_length
|
||||
, std::string const& expected_wkt
|
||||
)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
test_per_segment_const(geometry, expected_dsv, expected_length);
|
||||
test_per_segment_non_const(geometry, expected_wkt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt
|
||||
, int expected_sum_x
|
||||
, std::string const& expected1
|
||||
, std::string const& expected2
|
||||
, std::string const& expected_dsv
|
||||
, double expected_length
|
||||
, std::string const& expected_wkt
|
||||
)
|
||||
{
|
||||
test_per_point<Geometry>(wkt, expected_sum_x, expected1, expected2);
|
||||
test_per_segment<Geometry>(wkt, expected_dsv, expected_length, expected_wkt);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
174
test/algorithms/test_intersection.hpp
Normal file
174
test/algorithms/test_intersection.hpp
Normal file
@ -0,0 +1,174 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_INTERSECTION_HPP
|
||||
#define BOOST_GEOMETRY_TEST_INTERSECTION_HPP
|
||||
|
||||
#include <fstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/intersection.hpp>
|
||||
#include <boost/geometry/algorithms/area.hpp>
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
#include <boost/geometry/algorithms/num_points.hpp>
|
||||
#include <boost/geometry/algorithms/unique.hpp>
|
||||
|
||||
#include <boost/geometry/geometries/geometries.hpp>
|
||||
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
# include <boost/geometry/extensions/io/svg/svg_mapper.hpp>
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
template <typename OutputType, typename CalculationType, typename G1, typename G2>
|
||||
double test_intersection(std::string const& caseid, G1 const& g1, G2 const& g2,
|
||||
int expected_count = 0, int expected_point_count = 0,
|
||||
double expected_length_or_area = 0,
|
||||
double percentage = 0.0001,
|
||||
bool make_unique = true)
|
||||
{
|
||||
static const bool is_line = boost::geometry::geometry_id<OutputType>::type::value == 2;
|
||||
|
||||
std::vector<OutputType> clip;
|
||||
|
||||
typedef typename boost::geometry::coordinate_type<G1>::type coordinate_type;
|
||||
typedef typename boost::geometry::point_type<G1>::type point_type;
|
||||
|
||||
typedef boost::geometry::strategy_intersection
|
||||
<
|
||||
typename boost::geometry::cs_tag<point_type>::type,
|
||||
G1,
|
||||
G2,
|
||||
point_type,
|
||||
CalculationType
|
||||
> strategy;
|
||||
|
||||
boost::geometry::intersection_inserter<OutputType>(g1, g2, std::back_inserter(clip), strategy());
|
||||
|
||||
double length_or_area = 0;
|
||||
std::size_t n = 0;
|
||||
for (typename std::vector<OutputType>::iterator it = clip.begin();
|
||||
it != clip.end();
|
||||
++it)
|
||||
{
|
||||
if (expected_point_count > 0)
|
||||
{
|
||||
if (make_unique)
|
||||
{
|
||||
// Get a correct point-count without duplicate points
|
||||
// (note that overlay might be adapted to avoid duplicates)
|
||||
boost::geometry::unique(*it);
|
||||
n += boost::geometry::num_points(*it);
|
||||
}
|
||||
else
|
||||
{
|
||||
n += boost::geometry::num_points(*it);
|
||||
}
|
||||
}
|
||||
|
||||
// instead of specialization we check it run-time here
|
||||
length_or_area += is_line
|
||||
? boost::geometry::length(*it)
|
||||
: boost::geometry::area(*it);
|
||||
|
||||
/*
|
||||
std::cout << std::endl << "case " << caseid << " ";
|
||||
std::cout
|
||||
<< std::setprecision(20)
|
||||
<< boost::geometry::dsv(*it) << std::endl;
|
||||
*/
|
||||
}
|
||||
|
||||
|
||||
#if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST)
|
||||
if (expected_point_count > 0)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(int(n) == expected_point_count,
|
||||
"intersection: " << caseid
|
||||
<< " #points expected: " << expected_point_count
|
||||
<< " detected: " << n
|
||||
<< " type: " << string_from_type<coordinate_type>::name()
|
||||
);
|
||||
}
|
||||
|
||||
if (expected_count > 0)
|
||||
{
|
||||
BOOST_CHECK_MESSAGE(int(clip.size()) == expected_count,
|
||||
"intersection: " << caseid
|
||||
<< " #outputs expected: " << expected_count
|
||||
<< " detected: " << clip.size()
|
||||
<< " type: " << string_from_type<coordinate_type>::name()
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(length_or_area, expected_length_or_area, percentage);
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
std::ostringstream filename;
|
||||
filename << "intersection_"
|
||||
<< caseid << "_"
|
||||
<< string_from_type<coordinate_type>::name()
|
||||
<< string_from_type<CalculationType>::name()
|
||||
<< ".svg";
|
||||
|
||||
std::ofstream svg(filename.str().c_str());
|
||||
|
||||
svg_mapper<point_type> mapper(svg, 500, 500);
|
||||
|
||||
mapper.add(g1);
|
||||
mapper.add(g2);
|
||||
|
||||
mapper.map(g1, is_line
|
||||
? "opacity:0.6;stroke:rgb(0,0,255);stroke-width:5"
|
||||
: "opacity:0.6;fill:rgb(0,0,255);stroke:rgb(0,0,0);stroke-width:1");
|
||||
mapper.map(g2, "opacity:0.6;fill:rgb(0,255,0);stroke:rgb(0,0,0);stroke-width:1");
|
||||
|
||||
for (typename std::vector<OutputType>::const_iterator it = clip.begin();
|
||||
it != clip.end(); ++it)
|
||||
{
|
||||
mapper.map(*it, "opacity:0.6;fill:none;stroke:rgb(255,0,0);stroke-width:5");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return length_or_area;
|
||||
}
|
||||
|
||||
template <typename OutputType, typename G1, typename G2>
|
||||
double test_one(std::string const& caseid, std::string const& wkt1, std::string const& wkt2,
|
||||
int expected_count = 0, int expected_point_count = 0,
|
||||
double expected_length_or_area = 0,
|
||||
double percentage = 0.0001,
|
||||
bool make_unique = true)
|
||||
{
|
||||
G1 g1;
|
||||
boost::geometry::read_wkt(wkt1, g1);
|
||||
|
||||
G2 g2;
|
||||
boost::geometry::read_wkt(wkt2, g2);
|
||||
|
||||
return test_intersection<OutputType, void>(caseid, g1, g2,
|
||||
expected_count, expected_point_count,
|
||||
expected_length_or_area, percentage, make_unique);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
60
test/algorithms/test_intersects.hpp
Normal file
60
test/algorithms/test_intersects.hpp
Normal file
@ -0,0 +1,60 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_INTERSECTS_HPP
|
||||
#define BOOST_GEOMETRY_TEST_INTERSECTS_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/algorithms/intersects.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void test_geometry(std::string const& wkt1,
|
||||
std::string const& wkt2, bool expected)
|
||||
{
|
||||
Geometry1 geometry1;
|
||||
Geometry2 geometry2;
|
||||
|
||||
boost::geometry::read_wkt(wkt1, geometry1);
|
||||
boost::geometry::read_wkt(wkt2, geometry2);
|
||||
|
||||
bool detected = boost::geometry::intersects(geometry1, geometry2);
|
||||
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"intersects: " << wkt1
|
||||
<< " with " << wkt2
|
||||
<< " -> Expected: " << expected
|
||||
<< " detected: " << detected);
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_self_intersects(std::string const& wkt, bool expected)
|
||||
{
|
||||
Geometry geometry;
|
||||
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
|
||||
bool detected = boost::geometry::intersects(geometry);
|
||||
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"intersects: " << wkt
|
||||
<< " -> Expected: " << expected
|
||||
<< " detected: " << detected);
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
47
test/algorithms/test_length.hpp
Normal file
47
test/algorithms/test_length.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_LENGTH_HPP
|
||||
#define BOOST_GEOMETRY_TEST_LENGTH_HPP
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/length.hpp>
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_length(Geometry const& geometry, long double expected_length)
|
||||
{
|
||||
long double length = boost::geometry::length(geometry);
|
||||
|
||||
#ifdef GGL_TEST_DEBUG
|
||||
std::ostringstream out;
|
||||
out << typeid(typename boost::geometry::coordinate_type<Geometry>::type).name()
|
||||
<< std::endl
|
||||
<< typeid(typename boost::geometry::length_result<Geometry>::type).name()
|
||||
<< std::endl
|
||||
<< "length : " << boost::geometry::length(geometry)
|
||||
<< std::endl;
|
||||
std::cout << out.str();
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_CLOSE(length, expected_length, 0.0001);
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt, double expected_length)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
test_length(geometry, expected_length);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
43
test/algorithms/test_overlaps.hpp
Normal file
43
test/algorithms/test_overlaps.hpp
Normal file
@ -0,0 +1,43 @@
|
||||
// Generic Geometry2 Library test file
|
||||
//
|
||||
// Copyright Barend Gehrels, 1995-2009, Geodan Holding B.V. 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_OVERLAPS_HPP
|
||||
#define BOOST_GEOMETRY_TEST_OVERLAPS_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/core/ring_type.hpp>
|
||||
#include <boost/geometry/algorithms/overlaps.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
#include <boost/geometry/geometries/linear_ring.hpp>
|
||||
#include <boost/geometry/geometries/polygon.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry1, typename Geometry2>
|
||||
void test_geometry(std::string const& wkt1,
|
||||
std::string const& wkt2, bool expected)
|
||||
{
|
||||
Geometry1 geometry1;
|
||||
Geometry2 geometry2;
|
||||
|
||||
boost::geometry::read_wkt(wkt1, geometry1);
|
||||
boost::geometry::read_wkt(wkt2, geometry2);
|
||||
|
||||
bool detected = boost::geometry::overlaps(geometry1, geometry2);
|
||||
|
||||
BOOST_CHECK_MESSAGE(detected == expected,
|
||||
"overlaps: " << wkt1
|
||||
<< " with " << wkt2
|
||||
<< " -> Expected: " << expected
|
||||
<< " detected: " << detected);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
167
test/algorithms/test_overlay.hpp
Normal file
167
test/algorithms/test_overlay.hpp
Normal file
@ -0,0 +1,167 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_OVERLAY_HPP
|
||||
#define BOOST_GEOMETRY_TEST_OVERLAY_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
static std::string example_box = "box(1.5 1.5, 4.5 2.5)";
|
||||
static std::string example_ring =
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3))";
|
||||
|
||||
static std::string example_polygon =
|
||||
"POLYGON((2 1.3,2.4 1.7,2.8 1.8,3.4 1.2,3.7 1.6,3.4 2,4.1 3,5.3 2.6,5.4 1.2,4.9 0.8,2.9 0.7,2 1.3)"
|
||||
"(4.0 2.0, 4.2 1.4, 4.8 1.9, 4.4 2.2, 4.0 2.0))";
|
||||
|
||||
|
||||
|
||||
static std::string example_star =
|
||||
"POLYGON((4.0 -0.5 , 3.5 1.0 , 2.0 1.5 , 3.5 2.0 , 4.0 3.5 , 4.5 2.0 , 6.0 1.5 , 4.5 1.0 , 4.0 -0.5))";
|
||||
|
||||
static std::string identical[2] =
|
||||
{"POLYGON((0 0,0 1,1 1,1 0,0 0))",
|
||||
"POLYGON((1 1,1 0,0 0,0 1,1 1))"};
|
||||
|
||||
|
||||
static std::string new_hole[2] =
|
||||
{"POLYGON((2 2,2 5,5 5,5 2,2 2))",
|
||||
"POLYGON((0 0,0 6,3 6,3 4,1 4,1 3,3 3,3 0,0 0))"};
|
||||
|
||||
static std::string two_bends[2] =
|
||||
{"POLYGON((0 4,4 8,7 7,8 4,5 3,4 0,0 4))",
|
||||
"POLYGON((0 4,4 8,5 5,8 4,7 1,4 0,0 4))"};
|
||||
|
||||
static std::string side_side[2] =
|
||||
{"POLYGON((0 0,0 1,1 1,1 0,0 0))",
|
||||
"POLYGON((1 0,1 1,2 1,2 0,1 0))"};
|
||||
|
||||
|
||||
// First within second
|
||||
static std::string first_within_second[2] =
|
||||
{"POLYGON((2 2,2 3,3 3,3 2,2 2))",
|
||||
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0))"};
|
||||
|
||||
|
||||
// First within hole of second
|
||||
static std::string first_within_hole_of_second[2] =
|
||||
{"POLYGON((2 2,2 3,3 3,3 2,2 2))",
|
||||
"POLYGON((0 0, 0 5, 5 5, 5 0, 0 0),(1 1,4 1,4 4,1 4,1 1))"};
|
||||
|
||||
|
||||
// within each other, having no intersections but many holes within each other
|
||||
static std::string winded[2] =
|
||||
{"POLYGON((0 0,0 11,11 11,11 0,0 0),(3 3,4 3,4 4,3 4,3 3),(5 3,6 3,6 4,5 4,5 3),(2 6,7 6,7 6,7 9,2 9,2 6),(9 2,10 2,10 5,9 5,9 2))",
|
||||
"POLYGON((1 1,1 10,10 10,10 6,8 6,8 1,1 1),(2 2,7 2,7 5,2 5,2 2),(3 7,4 7,4 8,3 8,3 7),(5 7,6 7,6 8,5 8,5 7),(8 7,9 7,9 8,8 8,8 7))"};
|
||||
|
||||
static std::string intersect_holes_disjoint[2] =
|
||||
{"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
|
||||
"POLYGON((1 1,1 6,6 6,6 1,1 1),(2 4,3 4,3 5,2 5,2 4))"};
|
||||
|
||||
static std::string within_holes_disjoint[2] =
|
||||
{"POLYGON((0 0,0 7,7 7,7 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
|
||||
"POLYGON((1 1,1 6,6 6,6 1,1 1),(2 4,3 4,3 5,2 5,2 4))"};
|
||||
|
||||
static std::string intersect_holes_intersect[2] =
|
||||
{"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2))",
|
||||
"POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5))"};
|
||||
|
||||
static std::string intersect_holes_intersect_and_disjoint[2] =
|
||||
{"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2),(2 4,3 4,3 5,2 5,2 4))",
|
||||
"POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5))"};
|
||||
|
||||
|
||||
static std::string intersect_holes_intersect_and_touch[2] =
|
||||
{"POLYGON((0 0,0 7,5 7,5 0,0 0),(2 2,3 2,3 3,2 3,2 2),(2.5 4,3 4.5,2.5 5,2 4.5,2.5 4))",
|
||||
"POLYGON((1 1,1 6,6 6,6 1,1 1),(2.5 2.5,3.5 2.5,3.5 3.5,2.5 3.5,2.5 2.5),(3.5 4,4 4.5,3.5 5,3 4.5,3.5 4))"};
|
||||
|
||||
static std::string intersect_holes_new_ring[2] =
|
||||
{"POLYGON((4 4,4 16,16 16,16 4,4 4),(7 6,14 10,7 14,11 10,7 6))",
|
||||
"POLYGON((2 2,2 18,18 18,18 2,2 2),(13 6,9 10,13 14,6 10,13 6))"};
|
||||
|
||||
// case 2102 from "algorithms/overlay/robustness/assemble.hpp"
|
||||
static std::string intersect_exterior_and_interiors_winded[2] =
|
||||
{"POLYGON((2 0.5,0.5 2,0.5 8,2 9.5,6 9.5,8.5 8,8.5 2,7 0.5,2 0.5),(2 2,7 2,7 8,2 8,2 2))",
|
||||
"POLYGON((1 1,1 9,8 9,8 1,1 1),(4 4,5 4,5 5,4 5,4 4))"};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
static std::string simplex_normal[2] =
|
||||
{"POLYGON((0 1,2 5,5 3,0 1))",
|
||||
"POLYGON((3 0,0 3,4 5,3 0))"};
|
||||
|
||||
static std::string simplex_reversed[2] =
|
||||
{"POLYGON((0 1,5 3,2 5,0 1))",
|
||||
"POLYGON((3 0,4 5,0 3,3 0))"};
|
||||
|
||||
static std::string star_15 =
|
||||
"POLYGON((25 52.5,27.1694 29.5048,46.5004 42.146,29.8746 26.1126,51.8105 18.8807,28.9092 21.8826,36.9318 0.223356,25 20,13.0682 0.223356,21.0908 21.8826,-1.81052 18.8807,20.1254 26.1126,3.49963 42.146,22.8306 29.5048,25 52.5))";
|
||||
static std::string comb_15 =
|
||||
"POLYGON((25 0,0 25,25 50,50 25,49.0741 24.0741,25 48.1481,24.0741 47.2222,48.1481 23.1481,47.2222 22.2222,23.1481 46.2963,22.2222 45.3704,46.2963 21.2963,45.3704 20.3704,21.2963 44.4444,20.3704 43.5185,44.4444 19.4444,43.5185 18.5185,19.4444 42.5926,18.5185 41.6667,42.5926 17.5926,41.6667 16.6667,17.5926 40.7407,16.6667 39.8148,40.7407 15.7407,39.8148 14.8148,15.7407 38.8889,14.8148 37.963,38.8889 13.8889,37.963 12.963,13.8889 37.037,12.963 36.1111,37.037 12.037,36.1111 11.1111,12.037 35.1852,11.1111 34.2593,35.1852 10.1852,34.2593 9.25926,10.1852 33.3333,9.25926 32.4074,33.3333 8.33333,32.4074 7.40741,8.33333 31.4815,7.40741 30.5556,31.4815 6.48148,30.5556 5.55556,6.48148 29.6296,5.55556 28.7037,29.6296 4.62963,28.7037 3.7037,4.62963 27.7778,3.7037 26.8519,27.7778 2.77778,26.8519 1.85185,2.77778 25.9259,1.85185 25,25.9259 0.925926,25 0))";
|
||||
|
||||
static std::string only_hole_intersections[3] =
|
||||
{"POLYGON((0 0,0 10,20 10,20 0,0 0),(1 1,7 5,5 7,1 1),(11 1,17 5,15 7,11 1))",
|
||||
"POLYGON((0 0,0 10,20 10,20 0,0 0),(1 1,7 6,6 7,1 1),(11 1,17 6,16 7,11 1))",
|
||||
"POLYGON((0.5 0.5,0.5 9.5,19.5 9.5,19.5 0.5,0.5 0.5),(1 1,7 6,6 7,1 1),(11 1,17 6,16 7,11 1))"};
|
||||
|
||||
static std::string equal_holes_disjoint[2] =
|
||||
{"POLYGON((0 0,0 9,9 9,9 0,0 0),(1 1,4 1,4 8,1 8,1 1),(5 1,8 1,8 4,5 4,5 1))",
|
||||
"POLYGON((0 0,0 9,9 9,9 0,0 0),(1 1,4 1,4 8,1 8,1 1),(5 5,8 5,8 8,5 8,5 5))"};
|
||||
|
||||
// == case 52
|
||||
static std::string fitting[2] =
|
||||
{"POLYGON((0 0,0 5,5 5,5 0,0 0),(4 1,3 4,1 2,4 1))",
|
||||
"POLYGON((1 2,3 4,4 1,1 2))"};
|
||||
|
||||
// == case 53
|
||||
static std::string wrapped[3] = {
|
||||
"POLYGON((2 2,2 3,3 3,3 2,2 2))",
|
||||
/*a:*/ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,3 2,3 1,4 1,4 4,1 4,1 3,2 3,2 2,0 2))", // NOT st_isvalid
|
||||
/*b:*/ "POLYGON((0 2,0 5,5 5,5 0,2 0,2 2,0 2),(1 3,2 3,2 2,3 2,3 1,4 1,4 4,1 4,1 3))" // st_isvalid
|
||||
};
|
||||
|
||||
|
||||
|
||||
// e-45 gives 'convenient' IEEE-single-FP-error,
|
||||
static std::string epsilon[2] =
|
||||
{"POLYGON((0.0 0.0"
|
||||
",3.0e-45 4.0e-45"
|
||||
",4.0e-45 1.0e-45"
|
||||
",0.0 0.0))",
|
||||
"POLYGON((2.0e-45 2.0e-45"
|
||||
",6.0e-45 4.0e-45"
|
||||
",4.0e-45 -1.0e-45"
|
||||
",2.0e-45 2.0e-45))"};
|
||||
|
||||
static std::string epsilon_multi_ip[2] =
|
||||
{
|
||||
"POLYGON("
|
||||
"(0.0e-44 2.0e-44,0.5e-44 2.5e-44,1.2e-44 2.0e-44,1.7e-44 2.5e-44,2.5e-44 2.0e-44,2.0e-44 1.5e-44"
|
||||
",2.5e-44 1.0e-44,2.0e-44 0.5e-44,1.7e-44 0.0e-44,1.5e-44 0.5e-44,1.2e-44 0.0e-44,1.0e-44 0.5e-44"
|
||||
",0.7e-44 0.0e-44,0.5e-44 1.7e-44,0.12e-44 1.5e-44,0.5e-44 1.2e-44,0.0e-44 1.0e-44,0.0e-44 2.0e-44))",
|
||||
"POLYGON("
|
||||
"(0.2e-44 0.2e-44,0.2e-44 2.2e-44,2.2e-44 2.2e-44,2.2e-44 0.2e-44,0.2e-44 0.2e-44))"
|
||||
};
|
||||
|
||||
|
||||
static std::string distance_zero[2] =
|
||||
{"POLYGON((1 1,1 4,4 4,4 1,1 1))",
|
||||
"POLYGON((1.9 0.9,2.0 4.000001,2.1 1.0,1.9 0.9))"};
|
||||
|
||||
|
||||
static std::string isovist[2] =
|
||||
{
|
||||
"POLYGON((37.29449462890625 1.7902572154998779, 46.296027072709599 -2.4984308554828116, 45.389434814453125 -4.5143837928771973, 47.585065917176543 -6.1314922196594779, 46.523914387974358 -8.5152102535033496, 42.699958801269531 -4.4278755187988281, 42.577877044677734 -4.4900407791137695, 42.577911376953125 -4.4901103973388672, 40.758884429931641 -5.418975830078125, 40.6978759765625 -5.4500408172607422, 41.590042114257813 -7.2021245956420898, 57.297810222148939 -37.546793343968417, 50.974888957147442 -30.277285722290763, 37.140213012695313 1.3446992635726929, 37.000419616699219 1.664225697517395, 37.29449462890625 1.7902572154998779))",
|
||||
"POLYGON((43.644271850585938 0.96149998903274536,43.764598846435547 0.93951499462127686,49.071769542946825 0.61489892713413252,48.43512638981781 -0.81299959072453376,47.830955505371094 -0.69758313894271851,47.263670054709685 -1.784876824891044,46.695858001708984 -1.6093428134918213,45.389434814453125 -4.5143837928771973,47.604561877161387 -6.087697464505224,46.559533858616469 -8.435196445683264,42.699958801269531 -4.4278755187988281,42.577877044677734 -4.4900407791137695,42.577911376953125 -4.4901103973388672,40.758884429931641 -5.418975830078125,40.6978759765625 -5.4500408172607422,41.590042114257813 -7.2021245956420898,57.524304765518266 -37.807195733984784,41.988733475572282 -19.945838749437218,41.821544647216797 -19.211688995361328,40.800632476806641 -17.208097457885742,39.966808319091797 -17.625011444091797,38.823680877685547 -16.296066284179688,37.326129913330078 -17.190576553344727,35.963497161865234 -15.476018905639648,35.656356811523438 -15.66030216217041,34.931102752685547 -16.223842620849609,34.634240447128811 -15.85007183479255,34.886280059814453 -14.120697975158691,34.658355712890625 -13.81736946105957,34.328716278076172 -13.992490768432617,33.598796844482422 -14.546377182006836,33.164891643669634 -14.000060288415174,33.566280364990234 -12.450697898864746,33.339523315429688 -12.147735595703125,32.998821258544922 -12.323249816894531,32.274600982666016 -12.879127502441406,31.682494778186321 -12.133624901803865,32.226280212402344 -10.790698051452637,32.000633239746094 -10.488097190856934,31.669155120849609 -10.653837203979492,30.947774887084961 -11.208560943603516,30.207040612748258 -10.275926149505661,30.896280288696289 -9.1206979751586914,30.670633316040039 -8.8180980682373047,30.339155197143555 -8.9838371276855469,29.619997024536133 -9.5368013381958008,29.135100397190627 -8.9262827849488211,32.718830108642578 -4.3281683921813965,32.708168029785156 -2.3611698150634766,32.708126068115234 -2.3611700534820557,32.708126068115234 -2.3611266613006592,30.501169204711914 -2.3718316555023193,27.069889344709196 -4.2926591211028242,26.472516656201325 -3.5380830513658776,36.954700469970703 1.2597870826721191,37.140213012695313 1.3446992635726929,37.000419616699219 1.664225697517395,37.29449462890625 1.7902572154998779,37.43402099609375 1.470055103302002,51.370888500897557 7.4163459734570729,51.20102152843122 7.1738039562841562,42.721500396728516 3.6584999561309814,42.721500396728516 2.2342472076416016,42.399410247802734 1.4956772327423096,43.644271850585938 0.96149998903274536))"
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
50
test/algorithms/test_perimeter.hpp
Normal file
50
test/algorithms/test_perimeter.hpp
Normal file
@ -0,0 +1,50 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_PERIMETER_HPP
|
||||
#define BOOST_GEOMETRY_TEST_PERIMETER_HPP
|
||||
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
|
||||
#include <boost/geometry/algorithms/perimeter.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_perimeter(Geometry const& geometry, long double expected_perimeter)
|
||||
{
|
||||
long double perimeter = boost::geometry::perimeter(geometry);
|
||||
|
||||
#ifdef GGL_TEST_DEBUG
|
||||
std::ostringstream out;
|
||||
out << typeid(typename boost::geometry::coordinate_type<Geometry>::type).name()
|
||||
<< std::endl
|
||||
<< typeid(typename boost::geometry::perimeter_result<Geometry>::type).name()
|
||||
<< std::endl
|
||||
<< "perimeter : " << boost::geometry::perimeter(geometry)
|
||||
<< std::endl;
|
||||
std::cout << out.str();
|
||||
#endif
|
||||
|
||||
BOOST_CHECK_CLOSE(perimeter, expected_perimeter, 0.0001);
|
||||
}
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt, double expected_perimeter)
|
||||
{
|
||||
Geometry geometry;
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
test_perimeter(geometry, expected_perimeter);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
32
test/algorithms/test_relate.hpp
Normal file
32
test/algorithms/test_relate.hpp
Normal file
@ -0,0 +1,32 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2010, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_RELATE_HPP
|
||||
#define BOOST_GEOMETRY_TEST_RELATE_HPP
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
static std::string disjoint_simplex[2] =
|
||||
{"POLYGON((0 0,0 2,2 2,0 0))",
|
||||
"POLYGON((1 0,3 2,3 0,1 0))"};
|
||||
|
||||
static std::string touch_simplex[2] =
|
||||
{"POLYGON((0 0,0 2,2 2,0 0))",
|
||||
"POLYGON((2 2,3 2,3 0,2 2))"};
|
||||
|
||||
static std::string overlaps_box[2] =
|
||||
{"POLYGON((0 0,0 2,2 2,0 0))",
|
||||
"POLYGON((1 1,3 2,3 0,1 1))"};
|
||||
|
||||
static std::string within_simplex[2] =
|
||||
{"POLYGON((0 0,1 4,4 1,0 0))",
|
||||
"POLYGON((1 1,1 3,3 1,1 1))"};
|
||||
|
||||
|
||||
|
||||
#endif
|
95
test/algorithms/test_simplify.hpp
Normal file
95
test/algorithms/test_simplify.hpp
Normal file
@ -0,0 +1,95 @@
|
||||
// Boost.Geometry (aka GGL, Generic Geometry Library) test file
|
||||
//
|
||||
// Copyright Barend Gehrels 2007-2009, Geodan, 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)
|
||||
|
||||
#ifndef BOOST_GEOMETRY_TEST_SIMPLIFY_HPP
|
||||
#define BOOST_GEOMETRY_TEST_SIMPLIFY_HPP
|
||||
|
||||
// Test-functionality, shared between single and multi tests
|
||||
|
||||
#include <ggl_test_common.hpp>
|
||||
#include <boost/geometry/algorithms/simplify.hpp>
|
||||
#include <boost/geometry/algorithms/distance.hpp>
|
||||
#include <boost/geometry/strategies/strategies.hpp>
|
||||
|
||||
#include <boost/geometry/extensions/gis/io/wkt/wkt.hpp>
|
||||
|
||||
template <typename Tag, typename Geometry>
|
||||
struct test_inserter
|
||||
{
|
||||
static void apply(Geometry& , std::string const& , double )
|
||||
{}
|
||||
};
|
||||
|
||||
template <typename Geometry>
|
||||
struct test_inserter<boost::geometry::linestring_tag, Geometry>
|
||||
{
|
||||
static void apply(Geometry& geometry, std::string const& expected, double distance)
|
||||
{
|
||||
Geometry simplified;
|
||||
boost::geometry::simplify_inserter(geometry,
|
||||
std::back_inserter(simplified), distance);
|
||||
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::wkt(simplified);
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_geometry(std::string const& wkt, std::string const& expected, double distance)
|
||||
{
|
||||
Geometry geometry, simplified;
|
||||
|
||||
// Generate polygon using only integer coordinates and obvious results
|
||||
// Polygon is a hexagon, having one extra point (2,1) on a line which should be filtered out.
|
||||
boost::geometry::read_wkt(wkt, geometry);
|
||||
boost::geometry::simplify(geometry, simplified, distance);
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::wkt(simplified);
|
||||
|
||||
BOOST_CHECK_MESSAGE(out.str() == expected,
|
||||
"simplify: " << boost::geometry::wkt(geometry)
|
||||
<< " expected " << expected
|
||||
<< " got " << boost::geometry::wkt(simplified));
|
||||
}
|
||||
|
||||
// Check using user-specified strategy
|
||||
typedef typename boost::geometry::point_type<Geometry>::type point_type;
|
||||
typedef typename boost::geometry::cs_tag<point_type>::type tag;
|
||||
typedef boost::geometry::strategy::distance::projected_point
|
||||
<
|
||||
point_type,
|
||||
point_type
|
||||
> strategy;
|
||||
typedef boost::geometry::strategy::simplify::douglas_peucker
|
||||
<
|
||||
point_type,
|
||||
strategy
|
||||
> simplify_strategy_type;
|
||||
|
||||
BOOST_CONCEPT_ASSERT( (boost::geometry::concept::SimplifyStrategy<simplify_strategy_type>) );
|
||||
boost::geometry::simplify(geometry, simplified, distance, simplify_strategy_type());
|
||||
|
||||
{
|
||||
std::ostringstream out;
|
||||
out << boost::geometry::wkt(simplified);
|
||||
BOOST_CHECK_EQUAL(out.str(), expected);
|
||||
}
|
||||
|
||||
// Check inserter (if applicable)
|
||||
test_inserter
|
||||
<
|
||||
typename boost::geometry::tag<Geometry>::type,
|
||||
Geometry
|
||||
>::apply(geometry, expected, distance);
|
||||
}
|
||||
|
||||
|
||||
#endif
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user