lukas-toenne / geodoodle Goto Github PK
View Code? Open in Web Editor NEWBlender scripts for computing geodesic distance
Blender scripts for computing geodesic distance
Hi Lukas,
I created a boundary vertex groups (with a selection of boundary vertices) and hit 'Geodesic distance'
and get the following error.
Computing Geodesic Distance using scipy
Python: Traceback (most recent call last):
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\operator.py", line 184, in execute
heat_map_gen.generate(boundary_reader, obstacle_reader, heat_writer, distance_writer, self.heat_time_scale)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 304, in generate
M, S, G, D = self.compute_laplacian(vertex_stiffness)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 171, in compute_laplacian
A = np.fromiter(A_values(), dtype=float, count=numverts * numverts).reshape(numverts, numverts)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 170, in A_values
yield 2.0 * sum((np.dot(Cnext[j, k, :] - C[j, k, :], Cnext[i, k, :] - C[i, k, :]) for k in range(numverts)), start=0.0)
TypeError: sum() takes no keyword arguments
location: <unknown location>:-1
Error: Python: Traceback (most recent call last):
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\operator.py", line 184, in execute
heat_map_gen.generate(boundary_reader, obstacle_reader, heat_writer, distance_writer, self.heat_time_scale)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 304, in generate
M, S, G, D = self.compute_laplacian(vertex_stiffness)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 171, in compute_laplacian
A = np.fromiter(A_values(), dtype=float, count=numverts * numverts).reshape(numverts, numverts)
File "C:\Users\h\AppData\Roaming\Blender Foundation\Blender\2.92\scripts\addons\geodoodle-main\heat_map.py", line 170, in A_values
yield 2.0 * sum((np.dot(Cnext[j, k, :] - C[j, k, :], Cnext[i, k, :] - C[i, k, :]) for k in range(numverts)), start=0.0)
TypeError: sum() takes no keyword arguments
location: <unknown location>:-1
No Complains or bug fixing request here, just curios and wanted to play around.
Is this on my side?
Awesome utility, thank you!
I was a bit confused about distances originally, my test model is huge and vertex weights are capped at 1.0. I worked out what was happening by looking at the uvs after using the uv writer.
For my purposes I made the max length 1.0 by adding:
d /= np.max(d)
In compute distance here https://github.com/lukas-toenne/geodoodle/blob/main/geometry_math.py#L98
It would be amazing if that were an option exposed in the ui.
Thanks again!
It is all hanged for some seconds on my four cores (multithreading?)
And error:
location: <unknown location>:-1
Error: Python: Traceback (most recent call last):
File "/home/ololo/Downloads/INSTALL/blender-2.92.0-linux64/2.92/scripts/addons/geodoodle/operator.py", line 180, in execute
heat_map_gen.generate(boundary_reader, obstacle_reader, heat_writer, distance_writer, self.heat_time_scale)
File "/home/ololo/Downloads/INSTALL/blender-2.92.0-linux64/2.92/scripts/addons/geodoodle/heat_map.py", line 228, in generate
M, S, G, D = self.compute_laplacian(vertex_stiffness)
File "/home/ololo/Downloads/INSTALL/blender-2.92.0-linux64/2.92/scripts/addons/geodoodle/heat_map.py", line 123, in compute_laplacian
A = np.fromiter
(A_values(), dtype=float, count=numverts * numverts).reshape(numverts, numverts)
File "/home/ololo/Downloads/INSTALL/blender-2.92.0-linux64/2.92/scripts/addons/geodoodle/heat_map.py", line 122, in A_values
yield 2.0 * sum((np.dot(Cnext[j, k, :] - C[j, k, :], Cnext[i, k, :] - C[i, k, :]) for k in range(numverts)), start=0.0)
TypeError: sum() takes no keyword arguments
location: <unknown location>:-1
While numpy has all necessary solvers to compute the geodesic density, it only supports dense arrays. This quickly becomes a limiting factor for performance and especially memory requirements.
Switch to using scipy for matrices and solvers, which has support for sparse matrix construction.
Boundaries conditions currently reflect heat, which distorts the gradient and the geodesic distance field. Crane et al. suggest averaged boundary conditions to mimic a surface without boundaries.
https://raw.githubusercontent.com/lukas-toenne/geodoodle/main/images/Island.png
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.