Skip to content

Commit

Permalink
Improved analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
iveevi committed Aug 24, 2023
1 parent e35d45d commit 4e40b43
Show file tree
Hide file tree
Showing 8 changed files with 331 additions and 62 deletions.
2 changes: 2 additions & 0 deletions casdf/casdf.cu
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ void sample_kernel(sample_result result, cumesh mesh, float time)
result.points[i] = bary.x * v0 + bary.y * v1 + bary.z * v2;
result.barys[i] = bary;
result.triangles[i] = tri;
result.indices[i] = tindex;
}
}

Expand Down Expand Up @@ -295,6 +296,7 @@ sample_result sample_result_alloc(uint32_t point_count)
cudaMalloc(&result.points, sizeof(glm::vec3) * point_count);
cudaMalloc(&result.barys, sizeof(glm::vec3) * point_count);
cudaMalloc(&result.triangles, sizeof(glm::uvec3) * point_count);
cudaMalloc(&result.indices, sizeof(uint32_t) * point_count);

return result;
}
Expand Down
2 changes: 2 additions & 0 deletions casdf/casdf.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ struct sample_result {
glm::vec3 *points;
glm::vec3 *barys;
glm::uvec3 *triangles;
uint32_t *indices;
uint32_t *dup;
uint32_t point_count;
};

Expand Down
7 changes: 4 additions & 3 deletions decimate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ Mesh translate_mesh(const Eigen::MatrixXd &V, const Eigen::MatrixXi &F)
int main(int argc, char *argv[])
{
// Load arguments
if (argc != 2) {
printf("Usage: %s <filename>\n", argv[0]);
if (argc != 3) {
printf("Usage: %s <filename> <proportion>\n", argv[0]);
return 1;
}

std::filesystem::path path = std::filesystem::weakly_canonical(argv[1]);
float proportion = std::stof(argv[2]);

// Load mesh
Mesh mesh = deduplicate(load_mesh(path)).first;
Expand All @@ -87,7 +88,7 @@ int main(int argc, char *argv[])
Eigen::VectorXi a0;
Eigen::VectorXi a1;

size_t count = 0.01 * mesh.triangles.size();
size_t count = proportion * mesh.triangles.size();
if (!igl::decimate(Vertices, Faces, count, V, F, a0, a1)) {
printf("Decimation failed\n");
return 1;
Expand Down
4 changes: 2 additions & 2 deletions models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import torch.nn as nn
import torch.nn.functional as F

POINT_ENCODING_SIZE = 10
POINT_ENCODING_SIZE = 25

# SRNM subdivision complex indices
# TODO: refactor the project to SRCM?
Expand Down Expand Up @@ -46,11 +46,11 @@ def __init__(self) -> None:
c0 = torch.pow(torch.tensor(1), 1.0/len(self.encoding_linears))
c0 = torch.log(torch.exp(c0) - LipschitzNormalization.one)
self.regularizers = [
LipschitzNormalization(c0),
LipschitzNormalization(c0),
# LipschitzNormalization(c0),
# LipschitzNormalization(c0),
LipschitzNormalization(c0),
LipschitzNormalization(c0),
]

self.encoding_linears = nn.ModuleList(self.encoding_linears)
Expand Down
10 changes: 9 additions & 1 deletion nsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from models import *

if len(sys.argv) < 3:
print('Usage: python3 srnm.py <sdv_complexes_file> <output_dir>')
print('Usage: python3 nsc.py <sdv_complexes_file> <output_dir>')
sys.exit(1)

sdv_complexes_file = sys.argv[1]
Expand Down Expand Up @@ -110,6 +110,14 @@

ps.init()

# for i, tg in enumerate(targets):
# tg = tg.reshape(-1, 3)
# tg = tg.cpu().detach().numpy()
# ps.register_surface_mesh("target-{}".format(i), tg, indices(resolution))

# ps.show()
# ps.remove_all_structures()

for i, vs in enumerate(vertices):
vs = vs.reshape(-1, 3)
vs = vs.cpu().detach().numpy()
Expand Down
Loading

0 comments on commit 4e40b43

Please sign in to comment.