Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
GSoC acknowledgement, unused parameter removal, simplify type selecti…
…on in side_robust
  • Loading branch information
tinko92 committed Oct 10, 2019
commit 97f397672e09fd3f0abd601d82f13d17265eb312
3 changes: 3 additions & 0 deletions extensions/test/triangulation/in_circle_robust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.

// 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)
Expand Down
3 changes: 3 additions & 0 deletions extensions/test/triangulation/side_robust.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.

// 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.

// 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.

// 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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

// Copyright (c) 2019 Tinko Bartels, Berlin, Germany.

// Contributed and/or modified by Tinko Bartels,
// as part of Google Summer of Code 2019 program.

// 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)
Expand All @@ -10,6 +13,7 @@
#define BOOST_GEOMETRY_EXTENSIONS_TRIANGULATION_STRATEGIES_CARTESIAN_SIDE_ROBUST_HPP

#include <boost/geometry/util/select_most_precise.hpp>
#include <boost/geometry/util/select_calculation_type.hpp>
#include <boost/geometry/extensions/triangulation/strategies/cartesian/detail/precise_math.hpp>

namespace boost { namespace geometry
Expand Down Expand Up @@ -37,7 +41,6 @@ struct side_robust
//! \brief Computes double the signed area of the CCW triangle p1, p2, p
template
<
typename CoordinateType,
typename PromotedType,
typename P1,
typename P2,
Expand All @@ -62,32 +65,20 @@ struct side_robust
>
static inline int apply(P1 const& p1, P2 const& p2, P const& p)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is too generic. What is the case where p1 and p2 are of different types?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot imagine such a case, however, my choice to be that generic was motivated by side_by_triangle having the same interface and I wanted to be as compatible with it as possible.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the same interface is OK.

{
typedef typename coordinate_type<P1>::type coordinate_type1;
typedef typename coordinate_type<P2>::type coordinate_type2;
typedef typename coordinate_type<P>::type coordinate_type3;

typedef typename boost::mpl::if_c
typedef typename select_calculation_type_alt
<
boost::is_void<CalculationType>::type::value,
typename select_most_precise
<
typename select_most_precise
<
coordinate_type1, coordinate_type2
>::type,
coordinate_type3
>::type,
CalculationType
CalculationType,
P1,
P2,
P
>::type coordinate_type;
typedef typename select_most_precise
<
coordinate_type,
double
>::type promoted_type;


promoted_type sv =
side_value<coordinate_type, promoted_type>(p1, p2, p);
promoted_type sv = side_value<promoted_type>(p1, p2, p);
return sv > 0 ? 1
: sv < 0 ? -1
: 0;
Expand Down