/
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/buffer_side_straight.hpp
(4587B)
// Boost.Geometry (aka GGL, Generic Geometry Library) // Copyright (c) 2012-2014 Barend Gehrels, Amsterdam, the Netherlands. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_SIDE_STRAIGHT_HPP #define BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_SIDE_STRAIGHT_HPP #include <cstddef> #include <boost/math/special_functions/fpclassify.hpp> #include <boost/geometry/core/coordinate_type.hpp> #include <boost/geometry/core/access.hpp> #include <boost/geometry/util/math.hpp> #include <boost/geometry/util/select_most_precise.hpp> #include <boost/geometry/strategies/buffer.hpp> #include <boost/geometry/strategies/side.hpp> namespace boost { namespace geometry { namespace strategy { namespace buffer { /*! \brief Let the buffer use straight sides along segments (the default) \ingroup strategies \details This strategy can be used as SideStrategy for the buffer algorithm. It is currently the only provided strategy for this purpose \qbk{ [heading Example] See the examples for other buffer strategies\, for example [link geometry.reference.strategies.strategy_buffer_join_round join_round] [heading See also] \* [link geometry.reference.algorithms.buffer.buffer_7_with_strategies buffer (with strategies)] } */ class side_straight { public : #ifndef DOXYGEN_SHOULD_SKIP_THIS template < typename Point, typename OutputRange, typename DistanceStrategy > static inline result_code apply( Point const& input_p1, Point const& input_p2, buffer_side_selector side, DistanceStrategy const& distance, OutputRange& output_range) { typedef typename coordinate_type<Point>::type coordinate_type; typedef typename geometry::select_most_precise < coordinate_type, double >::type promoted_type; // Generate a block along (left or right of) the segment // Simulate a vector d (dx,dy) coordinate_type const dx = get<0>(input_p2) - get<0>(input_p1); coordinate_type const dy = get<1>(input_p2) - get<1>(input_p1); // For normalization [0,1] (=dot product d.d, sqrt) promoted_type const length = geometry::math::sqrt(dx * dx + dy * dy); if (! boost::math::isfinite(length)) { // In case of coordinates differences of e.g. 1e300, length // will overflow and we should not generate output #ifdef BOOST_GEOMETRY_DEBUG_BUFFER_WARN std::cout << "Error in length calculation for points " << geometry::wkt(input_p1) << " " << geometry::wkt(input_p2) << " length: " << length << std::endl; #endif return result_error_numerical; } if (geometry::math::equals(length, 0)) { // Coordinates are simplified and therefore most often not equal. // But if simplify is skipped, or for lines with two // equal points, length is 0 and we cannot generate output. return result_no_output; } promoted_type const d = distance.apply(input_p1, input_p2, side); // Generate the normalized perpendicular p, to the left (ccw) promoted_type const px = -dy / length; promoted_type const py = dx / length; if (geometry::math::equals(px, 0) && geometry::math::equals(py, 0)) { // This basically should not occur - because of the checks above. // There are no unit tests triggering this condition #ifdef BOOST_GEOMETRY_DEBUG_BUFFER_WARN std::cout << "Error in perpendicular calculation for points " << geometry::wkt(input_p1) << " " << geometry::wkt(input_p2) << " length: " << length << " distance: " << d << std::endl; #endif return result_no_output; } output_range.resize(2); set<0>(output_range.front(), get<0>(input_p1) + px * d); set<1>(output_range.front(), get<1>(input_p1) + py * d); set<0>(output_range.back(), get<0>(input_p2) + px * d); set<1>(output_range.back(), get<1>(input_p2) + py * d); return result_normal; } #endif // DOXYGEN_SHOULD_SKIP_THIS }; }} // namespace strategy::buffer }} // namespace boost::geometry #endif // BOOST_GEOMETRY_STRATEGIES_CARTESIAN_BUFFER_SIDE_STRAIGHT_HPP
Save
cmd:
run