libigl v2.5.0
Loading...
Searching...
No Matches
kelvinlets.h
Go to the documentation of this file.
1#ifndef IGL_KELVINLETS_H
2#define IGL_KELVINLETS_H
3
4#include <Eigen/Core>
5#include <array>
6#include "igl_inline.h"
7
8namespace igl {
9
11enum class BrushType : int
12{
13 GRAB,
14 SCALE,
15 TWIST,
16 PINCH,
17};
18
20template<typename Scalar>
22{
23 const Scalar epsilon;
24 const int scale;
26 std::array<Scalar, 3> ep{}, w{};
27
28 KelvinletParams(const Scalar& epsilon,
29 const int falloff,
30 const BrushType& type)
32 , scale(falloff)
33 , brushType(type)
34 {
35 static constexpr std::array<Scalar, 3> brush_scaling_params{ 1.0f,
36 1.1f,
37 1.21f };
38 for (int i = 0; i < 3; i++) {
39 ep[i] = epsilon * brush_scaling_params[i];
40 }
41 w[0] = 1;
42 w[1] = -((ep[2] * ep[2] - ep[0] * ep[0]) / (ep[2] * ep[2] - ep[1] * ep[1]));
43 w[2] = (ep[1] * ep[1] - ep[0] * ep[0]) / (ep[2] * ep[2] - ep[1] * ep[1]);
44 }
45};
46
57template<typename DerivedV,
58 typename Derivedx0,
59 typename Derivedf,
60 typename DerivedF,
61 typename DerivedU>
63 const Eigen::MatrixBase<DerivedV>& V,
64 const Eigen::MatrixBase<Derivedx0>& x0,
65 const Eigen::MatrixBase<Derivedf>& f,
66 const Eigen::MatrixBase<DerivedF>& F,
68 Eigen::PlainObjectBase<DerivedU>& U);
69
70}
71
72#ifndef IGL_STATIC_LIBRARY
73#include "kelvinlets.cpp"
74#endif
75#endif
#define IGL_INLINE
Definition igl_inline.h:15
Definition AABB.h:17
void kelvinlets(const Eigen::MatrixBase< DerivedV > &V, const Eigen::MatrixBase< Derivedx0 > &x0, const Eigen::MatrixBase< Derivedf > &f, const Eigen::MatrixBase< DerivedF > &F, const KelvinletParams< typename DerivedV::Scalar > &params, Eigen::PlainObjectBase< DerivedU > &U)
Implements Pixar's Regularized Kelvinlets (Pixar Technical Memo #17-03): Sculpting Brushes based on F...
BrushType
Kelvinlets brush type.
Definition kelvinlets.h:12
Parameters for controling kelvinlets.
Definition kelvinlets.h:22
const int scale
Definition kelvinlets.h:24
std::array< Scalar, 3 > w
Definition kelvinlets.h:26
const Scalar epsilon
Definition kelvinlets.h:23
KelvinletParams(const Scalar &epsilon, const int falloff, const BrushType &type)
Definition kelvinlets.h:28
std::array< Scalar, 3 > ep
Definition kelvinlets.h:26
const BrushType brushType
Definition kelvinlets.h:25