~mht/surcut

ref: 0dbc35cd48d7238ffa3ae1b1cd3effe59f237622 surcut/surcut.h -rw-r--r-- 1.7 KiB
0dbc35cd — Martin Hafskjold Thoresen Only optionally do the force cutoff thing 1 year, 8 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#pragma once

#include <Eigen/Core>
#include <Eigen/Sparse>

#include "arap-mold.h"
#include "mesh.h"

using Eigen::MatrixXd;
using Eigen::MatrixXi;
using Eigen::Vector3d;

// Various computed things about the mesh
// If a point is above the plane.
extern std::vector<bool> is_point_above;
// `Moldable` values for all faces
extern std::vector<arap::Moldable::Enum> moldable;
// `Orientation` values for all faces
extern std::vector<arap::Orientation::Enum> orientation;
// dot products with the removal direction for each face
extern std::vector<double> dots;
// Don't use the ARAP enforcing moldability.  (only makes sense to use wiht `stitching`).
extern bool regular_arap;
// Scale factor for all stitching forces
extern float force_scale;
// Multiply forces with the face area
extern bool area_force;
// Perform force distance cutoff
extern bool force_cutoff;
// Force distance cutoff
extern float force_dist_cutoff;
// The number of ARAP iterations performed
extern int iteration_count;
// Whether to stitch together unmoldable geometry
extern bool stitching;

// Endpoints for all forces calculated. If not `nullptr` then this is written to in
// `compute_things`.
extern MatrixXd *forces_endpoints_ptr;

extern arap::Data arap_data;
extern arap::Args arap_args;

extern Eigen::Vector3d plane_p;
extern Eigen::Vector3d plane_n;

struct Ray {
  Vector3d src;
  Vector3d dir;
};

namespace StepReturn {
enum Enum {
  NotDone,
  Converged,
  WouldNaN,
};
}

int ray_intersect(Ray, int, Mesh &);
int intersect3D_RayTriangle(Ray, Vector3d, int, MatrixXd &, MatrixXi &, Vector3d *);
StepReturn::Enum step_arap(Mesh &, double = 1.0);
void compute_things(Mesh &mesh, double = 1.0, bool only_plane = false);