CGAL 6.1 - 2D Polyline Simplification

Loading...
Searching...
No Matches
List of all members | Public Member Functions
CGAL::Polyline_simplification_2::Hybrid_squared_distance_cost< FT > Class Template Reference
Reference Manual » Polyline Simplification Classes

`#include <CGAL/Polyline_simplification_2/Hybrid_squared_distance_cost.h>`

## Definition

template<class FT>
class CGAL::Polyline_simplification_2::Hybrid_squared_distance_cost< FT >

This class is a cost function which calculates the cost as the square of the distance between the original and simplified polylines, possibly scaled based on a factor.

Is model of
  `PolylineSimplificationCostFunction`

## Public Member Functions
| Hybrid_squared_distance_cost (FT ratio)
| Initializes the cost function with the specified `ratio`
template<class CDT >
std::optional< typename CDT::Geom_traits::FT > | operator() (const Constrained_triangulation_plus_2< CDT > &pct, typename Constrained_triangulation_plus_2< CDT >::Vertices_in_constraint_iterator vicq) const
| Compute the hybrid squared distance cost.

## Member Function Documentation

## ◆ operator()()

template<class FT >
template<class CDT >

std::optional< typename CDT::Geom_traits::FT > CGAL::Polyline_simplification_2::Hybrid_squared_distance_cost< FT >::operator() | ( | const Constrained_triangulation_plus_2< CDT > & | pct,
|  | typename Constrained_triangulation_plus_2< CDT >::Vertices_in_constraint_iterator | vicq
| ) |  | const

Compute the hybrid squared distance cost.

Given a vertex in constraint iterator `vicq` computes `vicp=std::prev(vicq)` and `vicr=std::next(vicq)`, returns the maximal square distance between each point along the original subpolyline, between `vicp` and `vicr`, and the straight line segment from `*vicp->point() to *vicr->point()` divided by the smallest of

- the square of the ratio given to the constructor of the cost function,
- and the shortest squared distance between that segment and each of the vertices adjacent to `vicq`.

Template Parameters

  CDT | must be `CGAL::Constrained_Delaunay_triangulation_2` with a vertex type that is model of `PolylineSimplificationVertexBase_2`.