/
usr
/
include
/
boost
/
geometry
/
strategies
/
cartesian
/
/usr/include/boost/geometry/strategies/cartesian
mkdir
upload
Name
Size
Mode
Actions
area.hpp
3958
0644
edit
dl
rm
area_surveyor.hpp
1221
0644
edit
dl
rm
azimuth.hpp
1212
0644
edit
dl
rm
box_in_box.hpp
10614
0644
edit
dl
rm
buffer_end_flat.hpp
3757
0644
edit
dl
rm
buffer_end_round.hpp
6084
0644
edit
dl
rm
buffer_join_miter.hpp
4540
0644
edit
dl
rm
buffer_join_round.hpp
6206
0644
edit
dl
rm
buffer_join_round_by_divide.hpp
4659
0644
edit
dl
rm
buffer_point_circle.hpp
4016
0644
edit
dl
rm
buffer_point_square.hpp
3654
0644
edit
dl
rm
buffer_side_straight.hpp
4587
0644
edit
dl
rm
centroid_average.hpp
2880
0644
edit
dl
rm
centroid_bashein_detmer.hpp
8541
0644
edit
dl
rm
centroid_weighted_length.hpp
4855
0644
edit
dl
rm
densify.hpp
3902
0644
edit
dl
rm
disjoint_box_box.hpp
2985
0644
edit
dl
rm
disjoint_segment_box.hpp
8965
0644
edit
dl
rm
distance_projected_point.hpp
9635
0644
edit
dl
rm
distance_projected_point_ax.hpp
9835
0644
edit
dl
rm
distance_pythagoras.hpp
7674
0644
edit
dl
rm
distance_pythagoras_box_box.hpp
8993
0644
edit
dl
rm
distance_pythagoras_point_box.hpp
9230
0644
edit
dl
rm
distance_segment_box.hpp
6893
0644
edit
dl
rm
envelope.hpp
4299
0644
edit
dl
rm
envelope_box.hpp
3479
0644
edit
dl
rm
envelope_multipoint.hpp
1442
0644
edit
dl
rm
envelope_point.hpp
2963
0644
edit
dl
rm
envelope_segment.hpp
2458
0644
edit
dl
rm
expand_box.hpp
1868
0644
edit
dl
rm
expand_point.hpp
3340
0644
edit
dl
rm
expand_segment.hpp
1900
0644
edit
dl
rm
index.hpp
6976
0644
edit
dl
rm
intersection.hpp
30855
0644
edit
dl
rm
io.hpp
1873
0644
edit
dl
rm
line_interpolate.hpp
3772
0644
edit
dl
rm
point_in_box.hpp
8761
0644
edit
dl
rm
point_in_point.hpp
3543
0644
edit
dl
rm
point_in_poly_crossings_multiply.hpp
3593
0644
edit
dl
rm
point_in_poly_franklin.hpp
3464
0644
edit
dl
rm
point_in_poly_winding.hpp
9889
0644
edit
dl
rm
point_order.hpp
1024
0644
edit
dl
rm
side_by_triangle.hpp
9669
0644
edit
dl
rm
turn_in_ring_winding.hpp
7463
0644
edit
dl
rm
Edit:
/usr/include/boost/geometry/strategies/cartesian/densify.hpp
(3902B)
// Boost.Geometry // Copyright (c) 2017-2018, Oracle and/or its affiliates. // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle // Licensed under the Boost Software License version 1.0. // http://www.boost.org/users/license.html #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DENSIFY_HPP #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DENSIFY_HPP #include <boost/geometry/algorithms/detail/convert_point_to_point.hpp> #include <boost/geometry/algorithms/detail/signed_size_type.hpp> #include <boost/geometry/arithmetic/arithmetic.hpp> #include <boost/geometry/arithmetic/dot_product.hpp> #include <boost/geometry/core/assert.hpp> #include <boost/geometry/core/coordinate_dimension.hpp> #include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/geometries/point.hpp> #include <boost/geometry/strategies/densify.hpp> #include <boost/geometry/util/math.hpp> #include <boost/geometry/util/select_most_precise.hpp> namespace boost { namespace geometry { namespace strategy { namespace densify { /*! \brief Densification of cartesian segment. \ingroup strategies \tparam CalculationType \tparam_calculation \qbk{ [heading See also] [link geometry.reference.algorithms.densify.densify_4_with_strategy densify (with strategy)] } */ template < typename CalculationType = void > class cartesian { public: template <typename Point, typename AssignPolicy, typename T> static inline void apply(Point const& p0, Point const& p1, AssignPolicy & policy, T const& length_threshold) { typedef typename AssignPolicy::point_type out_point_t; typedef typename select_most_precise < typename coordinate_type<Point>::type, typename coordinate_type<out_point_t>::type, CalculationType >::type calc_t; typedef model::point<calc_t, geometry::dimension<Point>::value, cs::cartesian> calc_point_t; calc_point_t cp0, cp1; geometry::detail::conversion::convert_point_to_point(p0, cp0); geometry::detail::conversion::convert_point_to_point(p1, cp1); // dir01 = xy1 - xy0 calc_point_t dir01 = cp1; geometry::subtract_point(dir01, cp0); calc_t const dot01 = geometry::dot_product(dir01, dir01); calc_t const len = math::sqrt(dot01); BOOST_GEOMETRY_ASSERT(length_threshold > T(0)); signed_size_type n = signed_size_type(len / length_threshold); if (n <= 0) { return; } // NOTE: Normalization will not work for integral coordinates // normalize //geometry::divide_value(dir01, len); calc_t step = len / (n + 1); calc_t d = step; for (signed_size_type i = 0 ; i < n ; ++i, d += step) { // pd = xy0 + d * dir01 calc_point_t pd = dir01; // without normalization geometry::multiply_value(pd, calc_t(i + 1)); geometry::divide_value(pd, calc_t(n + 1)); // with normalization //geometry::multiply_value(pd, d); geometry::add_point(pd, cp0); // NOTE: Only needed if types calc_point_t and out_point_t are different // otherwise pd could simply be passed into policy out_point_t p; assert_dimension_equal<calc_point_t, out_point_t>(); geometry::detail::conversion::convert_point_to_point(pd, p); policy.apply(p); } } }; #ifndef DOXYGEN_NO_STRATEGY_SPECIALIZATIONS namespace services { template <> struct default_strategy<cartesian_tag> { typedef strategy::densify::cartesian<> type; }; } // namespace services #endif // DOXYGEN_NO_STRATEGY_SPECIALIZATIONS }} // namespace strategy::densify }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_DENSIFY_HPP
Save
cmd:
run