Comments (14)
We have related issue #1259 and function in c++, unfortunately it is not exposed to our python module yet, we will try to do it in next release
MeshLib/source/MRMesh/MROffset.h
Lines 57 to 61 in 5317704
from meshlib.
Voxel Offset is a very simple idea:
- First you fill voxels with (signed) distances to input mesh,
- Then you build some iso-surface from voxel representation into new mesh.
But there are tons of details here, e.g. how to store voxels efficiently, how to find distance signs in the presence of holes in mesh, or how to preserve sharp features in the mesh. For example, you can read https://www.graphics.rwth-aachen.de/media/papers/feature1.pdf
And as to thickening, it is our own implementation, which was not derived from any existing paper. So you can look at its code.
from meshlib.
Hello! Can you please show example of input and output that you want to get? I our tums offset is equidistant surface on given distance from original surface.
from meshlib.
Thanks for the quick response, I should've given an example:
Current Output | Desired Output |
---|---|
If not clear what I mean with the Blender example, I could make a video of what I mean
from meshlib.
Hi,
I'd like to reopen the issue, as I feel the issue it not fully solved yet 🤔
The current output of the thickenMesh does not seem correct.
Blend output
In blender the settings are:
thickness: which indicates how far the object should be extruded
Offset: the direction of the extrusion (1 -> outwards, -1 -> inwards)
Input | Output | Settings |
---|---|---|
Meshlib output:
What supprises me is that thickenMesh
and offsetMesh
produce the same output, even though I wouldn't expect that.
/ | Input | Output |
---|---|---|
web app | ||
(Code 1) [Offset] | ||
(Code 2) [thicken] |
Code 1:
p = createPlane(1, np.array([0, 0, 1]))
params.voxelSize = 0.1
params.signDetectionMode = mr.SignDetectionMode.OpenVDB # does not require closed mesh
mr_p = mr.offsetMesh(p.toMrMesh(), 0.5, params)
p.assignPointLabels(28)
p.view()
(Mesh(mr_p)+ p).view()
Code 2
p = createPlane(1, np.array([0, 0, 1]))
params.voxelSize = 0.1
params.signDetectionMode = mr.SignDetectionMode.OpenVDB # does not require closed mesh
mr_p = mr.thickenMesh(p.toMrMesh(), 0.5, params)
p.assignPointLabels(28)
p.view()
(Mesh(mr_p)+ p).view()
I have also tried all the possible SignDetectionModes
but that doesn't see to do much. Often breaks the algorithm.
Any ideas?
from meshlib.
Hi,
Signed offset always creates a closed mesh as a result, so it is not what you are looking for.
In contrast, Thickening can do the job.
If we start from not-closed plane mesh (a couple of triangles) of size 1:
The result will consist of two parts:
The first part is just the original mesh with flipped normals, and the second one is the mesh moved on 0.03 as requested in the settings. Is the second one what you expect to get?
from meshlib.
Yes, but I also expect (as seen in the blender example) that the boundary edges are connected to make it into a closed mesh without all the smoothing & rounding of edges being applied.
It would be simple extrusion of the mesh according to the vertex or face normals, but with the benefit that the resulting mesh is closed and does is cleaned. aka does not contain self intersecting vertices/triangles.
I'm working with quite compelx meshes, if needed I could show an example of the desired outcome in Blender.
from meshlib.
After Thickening, one can get a closed mesh by using Stitch Holes tool:
See more in the video:
https://www.youtube.com/watch?v=XXGoLIKy4Rg
One day we will combine Thickening and Stitch Holes.
And if one just moves vertices along their normals then there is high chance of self-intersections appearance, which are hard to resolve, so we do not use that way.
Please feel free to show your meshes and desired outcome, as it helps us to design new features in MeshInspector/MeshLib.
from meshlib.
Do you have some link to the technique or paper you use for the thickening/offset algorithm?
Thanks you :D
from meshlib.
@Fedr would it be possible to expose the StitchTwoHoles
to python as I don't find the function?
from meshlib.
Actually it is already exposed under the name buildCylinderBetweenTwoHoles
:
>>> import meshlib.mrmeshpy as mr
>>> help (mr.buildCylinderBetweenTwoHoles)
Help on built-in function buildCylinderBetweenTwoHoles in module meshlib.mrmeshpy:
buildCylinderBetweenTwoHoles(...) method of builtins.PyCapsule instance
buildCylinderBetweenTwoHoles(*args, **kwargs)
Overloaded function.
1. buildCylinderBetweenTwoHoles(mesh: meshlib.mrmeshpy.Mesh, a: meshlib.mrmeshpy.EdgeId, b: meshlib.mrmeshpy.EdgeId, params: meshlib.mrmeshpy.StitchHolesParams = <meshlib.mrmeshpy.StitchHolesParams object at 0x000001DD852EA7F0>) -> None
Build cylindrical patch to fill space between two holes represented by one of their edges each,
default metric: ComplexStitchMetric
mesh - mesh with hole
a - EdgeId which represents 1st hole
b - EdgeId which represents 2nd hole
params - parameters of holes stitching
2. buildCylinderBetweenTwoHoles(mesh: meshlib.mrmeshpy.Mesh, params: meshlib.mrmeshpy.StitchHolesParams = <meshlib.mrmeshpy.StitchHolesParams object at 0x000001DD852EA870>) -> bool
this version finds holes in the mesh by itself and returns false if they are not found
from meshlib.
Cool, the param meshlib.mrmeshpy.EdgeId
is this a list of vertex_idx that make up the edge of the mesh?
Or how do I pass this?
from meshlib.
EdgeId
is a unique identifier of an edge in mesh (an integer). One option to find it is by calling topology.findHoleRepresentiveEdges()
, Please see our test test_stitchTwoHoles.py
:
from helper import *
import pytest
def test_stitch_two_holes():
torus = mrmesh.makeOuterHalfTorus(2, 1, 10, 10, None)
torus2 = mrmesh.makeOuterHalfTorus(2, 1, 10, 10, None)
torusAutostitchTwo = torus
holes = torus.topology.findHoleRepresentiveEdges()
assert (len(holes) == 2)
params = mrmesh.StitchHolesParams()
params.metric = mrmesh.getEdgeLengthStitchMetric(torus)
mrmesh.buildCylinderBetweenTwoHoles(torus, holes[0], holes[1], params)
holes = torus.topology.findHoleRepresentiveEdges()
assert (len(holes) == 0)
mrmesh.buildCylinderBetweenTwoHoles(torus2, params)
holes = torus2.topology.findHoleRepresentiveEdges()
assert (len(holes) == 0)
from meshlib.
Thanks
from meshlib.
Related Issues (20)
- line self-intersection HOT 2
- Local setup HOT 5
- Error while showing numpad keys in F1 menu
- Negative offsetting in offsetMesh HOT 1
- Negative offset in thickenMesh results in incorrect filling of mesh HOT 3
- Readme installation steps are incorrect for Linux HOT 4
- Installation on Linux when sudo privileges are not available HOT 1
- Python Meshlib DistanceMap Interpolation Issue HOT 2
- meshlib.mrmeshpy.uniteCloseVertices does not exist in Python HOT 4
- Plane cut HOT 2
- Minkowski Sum in python HOT 2
- Problems in refine in cylinder mesh HOT 1
- add possibility to support rectangular planes
- setup z scale as ( ScaleX + ScaleY ) / 2 for plane feature HOT 1
- Creating grid meshes based on arbitrary shape input HOT 29
- Create a 3D Mesh from a list of vertices and faces. HOT 3
- Hole & Boundary edge length in Python HOT 5
- The Angle between two vectors is 0 to pi, why not 0-2pi HOT 4
- ImportError: libpython3.11.so.1.0: cannot open shared object file: No such file or directory HOT 1
- Are there any examples of emscripten for reference? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshlib.