Skip to content

Commit

Permalink
Improve documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
CorentinDumery committed Feb 28, 2022
1 parent e1b6a3f commit 616c462
Show file tree
Hide file tree
Showing 19 changed files with 254 additions and 483 deletions.
26 changes: 0 additions & 26 deletions app/woven_viz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,11 @@
#include <igl/jet.h>

#include "metrics.h"
#include <param/auto_select.h>
#include <param/bary_optimizer.h>
#include <param/self_intersect.h>
#include "param/cloth_param.h"
#include "draw_colormap.h"


void printMatStats(std::string name, const Eigen::VectorXd& mat){
std::cout << name << ": " << mat.minCoeff() << " -> " << mat.maxCoeff() << " (avg " << mat.mean() << ")" << std::endl;
}

Eigen::MatrixXd fromVectorToColors(const Eigen::VectorXd& vector){
Eigen::VectorXd adjusted = vector;
adjusted = adjusted.array() - adjusted.minCoeff();
double mean = adjusted.mean();
//adjusted = adjusted.array() / (2 * mean); // center mean at 0.5

adjusted = adjusted.array() * 100.0;
//printMatStats("vector", vector);

adjusted = adjusted.cwiseMin(1.0);
adjusted = adjusted.cwiseMax(0.0);
//printMatStats("adjusted", adjusted);

Eigen::MatrixXd colors = Eigen::MatrixXd::Constant(vector.rows(), 3, 1);
colors.col(1) = 1.0 - adjusted.array();
colors.col(2) = 1.0 - adjusted.array();

return colors;
}

int main(int argc, char *argv[]){
Eigen::MatrixXd V_3d, V_2d, V_2di;
Eigen::MatrixXi F;
Expand Down
1 change: 1 addition & 0 deletions include/cut_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#pragma once
#include <Eigen/Core>
#include <vector>
#include <iostream>

// Example usage:
/*
Expand Down
6 changes: 6 additions & 0 deletions include/draw_colormap.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#pragma once
/**
* @file draw_colormap.h
* @author Corentin Dumery
* @brief Draws colormap visualization in an ImGui menu
* @date 2022-02-28
*/

#include <igl/colormap.h>
#include <imgui.h>
Expand Down
8 changes: 7 additions & 1 deletion include/mccartney.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@

#pragma once
/**
* @file mccartney.h
* @author Corentin Dumery
* @brief Measurements of McCartney's energies for anisotropic materials
* @date 2022-02-28
*/
#include <Eigen/Core>
#include <igl/barycentric_coordinates.h>
#include "param/param_utils.h"
Expand Down
5 changes: 0 additions & 5 deletions include/param/auto_select.h

This file was deleted.

4 changes: 1 addition & 3 deletions include/param/bary_optimizer.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @author Corentin Dumery
* @brief Receives a mesh as input and computes its parameterization.
* This class is meant to define and solve a weighted sparse linear system
* from the input mesh, but does *not* store the mesh.
* from the input mesh, but does *not* store the mesh (see cloth_param.h for that).
* Memory pre-allocated upon initialization for performance.
* @date 2022-02-04
*
Expand Down Expand Up @@ -89,8 +89,6 @@ class BaryOptimizer {
void setSelectedVertices(std::vector<int> selected_vs) {selected_vs_ = selected_vs;};
std::vector<int> getSelectedVertices() const {return selected_vs_;}

void setDarts(std::vector<SimpleDart> simple_darts);
void setDarts(std::vector<std::vector<int>> ordered_cuts);
void setUnorderedDarts(const std::vector<std::vector<std::pair<int, int>>>& dart_duplicates,
const std::vector<int>& dart_tips);

Expand Down
5 changes: 1 addition & 4 deletions include/param/cloth_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include "param/bary_optimizer.h"
#include "param/param_utils.h"
#include "param/auto_select.h"

enum CLOTH_INIT_TYPE {CLOTH_INIT_ARAP, CLOTH_INIT_LSCM, CLOTH_INIT_SCAF};

Expand Down Expand Up @@ -76,8 +75,6 @@ class ClothParam {
&& stretch_v_.maxCoeff() < max_stretch_;
};

bool topology_ok = true;

void disableIntersectionCheck(){enable_intersection_check_ = false;};
void enableIntersectionCheck(){enable_intersection_check_ = true;};

Expand Down Expand Up @@ -128,7 +125,7 @@ class ClothParam {
// first indexing: dart id
// second indexing: pair id in dart
// pair: two vertex ids, which should be symmetrical w.r.t. dart
// note: needs to be called before memory allocation!
// NOTE: needs to be called before memory allocation!
void setDartPairs(const std::vector<std::vector<std::pair<int, int>>>& dart_duplicates,
const std::vector<int>& dart_tips);
};
Loading

0 comments on commit 616c462

Please sign in to comment.