2023-08-15 16:20:26 +02:00
|
|
|
/* SPDX-FileCopyrightText: Blender Authors
|
2023-05-31 16:19:06 +02:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later */
|
2019-11-26 18:43:44 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* \ingroup bke
|
|
|
|
*/
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2019-11-26 18:43:44 +01:00
|
|
|
/* Regularized Kelvinlets: Sculpting Brushes based on Fundamental Solutions of Elasticity
|
|
|
|
* Pixar Technical Memo #17-03 */
|
|
|
|
|
|
|
|
#define KELVINLET_MAX_ITERATIONS 3
|
|
|
|
|
|
|
|
typedef struct KelvinletParams {
|
|
|
|
float a;
|
|
|
|
float b;
|
|
|
|
float c;
|
|
|
|
|
|
|
|
float f;
|
|
|
|
|
|
|
|
float radius_scaled[KELVINLET_MAX_ITERATIONS];
|
|
|
|
} KelvinletParams;
|
|
|
|
|
|
|
|
/* Initialize KelvinletParams to store the parameters that will affect the deformation produced by
|
|
|
|
* a Kelvinlet */
|
|
|
|
void BKE_kelvinlet_init_params(
|
|
|
|
KelvinletParams *params, float radius, float force, float shear_modulus, float poisson_ratio);
|
|
|
|
|
|
|
|
/* Regularized Kelvinlets */
|
|
|
|
/* All these functions output the displacement that should be applied to each element. */
|
|
|
|
/* The initial coordinates of that element should not be modified during the transformation */
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_kelvinlet_grab(float radius_elem_disp[3],
|
2019-11-26 18:43:44 +01:00
|
|
|
const KelvinletParams *params,
|
|
|
|
const float elem_orig_co[3],
|
|
|
|
const float brush_location[3],
|
|
|
|
const float brush_delta[3]);
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_kelvinlet_grab_biscale(float radius_elem_disp[3],
|
2019-11-26 18:43:44 +01:00
|
|
|
const KelvinletParams *params,
|
|
|
|
const float elem_orig_co[3],
|
|
|
|
const float brush_location[3],
|
|
|
|
const float brush_delta[3]);
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_kelvinlet_grab_triscale(float radius_elem_disp[3],
|
2019-11-26 18:43:44 +01:00
|
|
|
const KelvinletParams *params,
|
|
|
|
const float elem_orig_co[3],
|
|
|
|
const float brush_location[3],
|
|
|
|
const float brush_delta[3]);
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_kelvinlet_scale(float radius_elem_disp[3],
|
2019-11-26 18:43:44 +01:00
|
|
|
const KelvinletParams *params,
|
|
|
|
const float elem_orig_co[3],
|
|
|
|
const float brush_location[3],
|
|
|
|
const float surface_normal[3]);
|
2020-09-04 20:59:13 +02:00
|
|
|
void BKE_kelvinlet_twist(float radius_elem_disp[3],
|
2019-11-26 18:43:44 +01:00
|
|
|
const KelvinletParams *params,
|
|
|
|
const float elem_orig_co[3],
|
|
|
|
const float brush_location[3],
|
|
|
|
const float surface_normal[3]);
|
|
|
|
|
2020-03-02 15:07:49 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|