During hair grooming in curves sculpt mode, it is very useful when hair strands are prevented from intersecting with the surface mesh. Unfortunately, it also decreases performance significantly so we don't want it to be turned on all the time. The surface collision is used by the Comb, Pinch and Puff brushes currently. It can be turned on or off on a per-geometry basis. The intersection prevention quality of this patch is not perfect yet. This can be improved over time using a better solver. Overall, perfect collision detection at the cost of bad performance is not necessary for interactive sculpting, because the user can fix small mistakes very quickly. Nevertheless, the quality can probably still be improved significantly without too big slow-downs depending on the use case. This can be done separately from this patch. Pull Request #104469
28 lines
1.2 KiB
C++
28 lines
1.2 KiB
C++
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
|
|
#pragma once
|
|
|
|
#include "BKE_curves.hh"
|
|
|
|
namespace blender::geometry::curve_constraints {
|
|
|
|
void compute_segment_lengths(OffsetIndices<int> points_by_curve,
|
|
Span<float3> positions,
|
|
IndexMask curve_selection,
|
|
MutableSpan<float> r_segment_lengths);
|
|
|
|
void solve_length_constraints(OffsetIndices<int> points_by_curve,
|
|
IndexMask curve_selection,
|
|
Span<float> segment_lenghts,
|
|
MutableSpan<float3> positions);
|
|
|
|
void solve_length_and_collision_constraints(OffsetIndices<int> points_by_curve,
|
|
IndexMask curve_selection,
|
|
Span<float> segment_lengths,
|
|
Span<float3> start_positions,
|
|
const Mesh &surface,
|
|
const bke::CurvesSurfaceTransforms &transforms,
|
|
MutableSpan<float3> positions);
|
|
|
|
} // namespace blender::geometry::curve_constraints
|