Skip to content

Commit

Permalink
Revive Frechet_distance_traits.h
Browse files Browse the repository at this point in the history
  • Loading branch information
afabri committed Dec 9, 2024
1 parent c8303ae commit 7370c94
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <CGAL/STL_Extension/internal/Has_nested_type_Has_filtered_predicates_tag.h>
#include <CGAL/Frechet_distance_traits_2.h>
#include <CGAL/Frechet_distance_traits_3.h>
#include <CGAL/Frechet_distance_traits_d.h>
#include <CGAL/Frechet_distance_traits.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Exact_rational.h>
Expand Down
74 changes: 74 additions & 0 deletions Frechet_distance/include/CGAL/Frechet_distance_traits.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
// Copyright (c) 2024 Max-Planck-Institute Saarbruecken (Germany), GeometryFactory (France)
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial
//
// Author(s) : André Nusser <[email protected]>
// Marvin Künnemann <[email protected]>
// Karl Bringmann <[email protected]>
// Andreas Fabri
// =============================================================================

#ifndef CGAL_FRECHET_DISTANCE_TRAITS_H
#define CGAL_FRECHET_DISTANCE_TRAITS_H

#include <CGAL/license/Frechet_distance.h>

#include <CGAL/Bbox.h>
#include <array>

namespace CGAL
{

template <class NT, int dimension>
class Frechet_distance_traits
{
public:
using Dimension = Dimension_tag<dimension>;

using FT = NT;
using Point_d = std::array<FT, dimension>;
using Cartesian_const_iterator_d = typename Point_d::const_iterator;

struct Construct_bbox_d
{
Bbox<Dimension, double> operator()(const Point_d& p) const
{
Bbox<Dimension, double> bb;
for (int i=0;i<dimension; ++i)
{
bb.min(i)=to_interval(p[i]).first;
bb.max(i)=to_interval(p[i]).second;
}

return bb;
}
};

struct Construct_cartesian_const_iterator_d
{
Cartesian_const_iterator_d operator()(const Point_d& p) const
{
return p.begin();
}
Cartesian_const_iterator_d operator()(const Point_d& p, int) const
{
return p.end();
}
};

Construct_bbox_d construct_bbox_d_object() const { return Construct_bbox_d(); }

Construct_cartesian_const_iterator_d construct_cartesian_const_iterator_d_object() const
{
return Construct_cartesian_const_iterator_d();
}
};

} // end of namespace CGAL

#endif // CGAL_FRECHET_DISTANCE_TRAITS_H

0 comments on commit 7370c94

Please sign in to comment.