Compute an index masks of points to remove to simplify the curve attribute using the Ramer-Douglas-Peucker algorithm. The Ramer-Douglas-Peucker algorithm finds a set of points in a polyline to remove so that the overall shape of the polyline is similar. How similar can be controlled by the distance `epsilon`. The function takes a `GSpan` so it can be used with any attribute (that has a type `float`, `float2`, or `float3`). Pull Request: https://projects.blender.org/blender/blender/pulls/118560
24 lines
781 B
C++
24 lines
781 B
C++
/* SPDX-FileCopyrightText: 2024 Blender Authors
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BKE_curves.hh"
|
|
|
|
namespace blender::geometry {
|
|
|
|
/**
|
|
* Compute an index masks of points to remove to simplify the curve attribute using the
|
|
* Ramer-Douglas-Peucker algorithm.
|
|
*/
|
|
IndexMask simplify_curve_attribute(const Span<float3> positions,
|
|
const IndexMask &curves_selection,
|
|
const OffsetIndices<int> points_by_curve,
|
|
const VArray<bool> &cyclic,
|
|
float epsilon,
|
|
GSpan attribute_data,
|
|
IndexMaskMemory &memory);
|
|
|
|
} // namespace blender::geometry
|