7 #include <Information.hpp>
14 #define CIMat cimg_library::CImg<float>
15 #define CIMatL cimg_library::CImgList<float>
27 virtual float measure(
float ev1,
float ev2) = 0;
28 virtual std::string get_type() = 0;
34 float measure(
float ev1,
float ev2) {
37 std::string get_type() {
47 float measure(
float ev1,
float ev2) {
48 return (ev1 * ev1) + (ev2 * ev2);
50 std::string get_type() {
60 float measure(
float ev1,
float ev2) {
61 return sqrt((ev1 * ev1) + (ev2 * ev2));
63 std::string get_type() {
64 return "rootsumsquare";
73 float measure(
float ev1,
float ev2) {
74 return (ev1 + ev2) / 2;
76 std::string get_type() {
86 float measure(
float ev1,
float ev2) {
87 return std::min(fabs(ev1), fabs(ev2));
89 std::string get_type() {
99 float measure(
float ev1,
float ev2) {
100 return std::max(fabs(ev1), fabs(ev2));
102 std::string get_type() {
112 float measure(
float ev1,
float ev2) {
115 std::string get_type() {
125 float measure(
float ev1,
float ev2) {
126 return (ev1 * ev2 < 0 ? -1.0f : 1.0f) * (fabs(ev1) + fabs(ev2)) / 2.0f;
128 std::string get_type() {
129 return "signedaverageabs";
155 else if(s ==
"average")
157 else if(s ==
"minimal")
159 else if(s ==
"maximal")
161 else if(s ==
"sumsquare")
163 else if(s ==
"rootsumsquare")
165 else if(s ==
"signedaverageabs")
167 else if(s ==
"anisotropy")
185 cM = copy.cM->copy();
194 void update(
const std::vector<Point3f>& pos,
const std::vector<Point3f>& nrml)
198 if(nrml.size() > 0 && nrml.size() == pos.size()) {
201 update_local_Basis(nrml[0]);
204 int cnt = pos.size();
205 CIMat X = CIMat(7, 3 * (cnt - 1));
206 CIMat b = CIMat(1, 3 * (cnt - 1));
210 for(
int i = 1; i < cnt; i++) {
223 X(0,
id) = 0.5 * w1 * w1;
225 X(2,
id) = 0.5 * w2 * w2;
226 X(3,
id) = w1 * w1 * w1;
227 X(4,
id) = w1 * w1 * w2;
228 X(5,
id) = w1 * w2 * w2;
229 X(6,
id) = w2 * w2 * w2;
236 X(3,
id) = 3 * w1 * w1;
237 X(4,
id) = 2 * w1 * w2;
248 X(5,
id) = 2 * w1 * w2;
249 X(6,
id) = 3 * w2 * w2;
253 CIMat Xt = X.get_transpose();
260 if(!isnan(det) && !(det == 0)) {
266 W(1, 0) = W(0, 1) = b[1];
270 CIMatL bL = W.get_symmetric_eigen();
273 ed1 = -bL(1)(0, 0) * b1 - bL(1)(0, 1) * b2;
274 ed2 = -bL(1)(1, 0) * b1 - bL(1)(1, 1) * b2;
275 if(fabs(ev1) < fabs(ev2)) {
285 Information::out <<
"Error calculating curvature" << endl;
298 void get_eigenValues(
float& eval1,
float& eval2)
306 float get_curvature() {
307 return cM->measure(ev1, ev2);
311 std::string get_type() {
312 return cM->get_type();
326 void update_local_Basis(
Point3f nrml)
328 nrml = nrml / nrml.
norm();
330 b1 =
Point3f(cimg_library::cimg::rand(), cimg_library::cimg::rand(), cimg_library::cimg::rand());
332 }
while(fabs(b1 * nrml) == 1);
333 b1 = b1 - (b1 * nrml) * nrml;
Definition: Curvature.hpp:84
CU_HOST_DEVICE Vector cross(const Vector &other) const
Compute the cross product as this x other.
Definition: Vector.hpp:641
Definition: Curvature.hpp:97
Definition: Curvature.hpp:45
CU_HOST_DEVICE T norm() const
Euclidean norm of the vector.
Definition: Vector.hpp:522
Definition: Curvature.hpp:32
Definition: Curvature.hpp:136
Common definitions and utilities for all geometry algorithms This file is shared by cuda...
Definition: Curvature.hpp:58
Definition: Curvature.hpp:110
Definition: Curvature.hpp:123
Definition: Curvature.hpp:23
Definition: Curvature.hpp:71