For my project, I need to measure the distance between two STL files. I wrote a script that allows reading the files, positioning them in relation to each other in the desired position. Now, in the next step I need to check the distance from one object to the other. Is there a function or script available on a library that allows me to carry out this process? Because then I’m going to want to define metrics like interpenetration area, maximum negative distance etc etc so I need to check first the distance between those objects and see if there is like mesh intersection and mesure that distance. I put the url for the combination of the 2 objects that I want to mesure the distance:
Measure distance between meshes
2.8k Views Asked by Pedro At
2
There are 2 best solutions below
0
Fedor
On
To calculate the distance between two meshes, first one needs to check whether these meshes intersect. If not, then the resulting distance can be computed as the distance between two closest points, one from each mesh (as on the picture below).
If the meshes do intersect, then it is necessary to find the part of each mesh, which is inside the other mesh, then find two most distant points, one from each inner part. The distance between these points will be the maximum deepness of the meshes interpenetration. It can be returned with negative sign to distinguish it from the distance between separated meshes.
In Python, one can use MeshLib library and findSignedDistance function from it as follows:
import meshlib.mrmeshpy as mr
mesh1 = mr.loadMesh("Cube.stl")
mesh2 = mr.loadMesh("Torus.stl"))
z = mr.findSignedDistance(mesh1, mesh2)
print(z.signedDist) // 0.3624192774295807
Related Questions in PYTHON
- How to store a date/time in sqlite (or something similar to a date)
- Instagrapi recently showing HTTPError and UnknownError
- How to Retrieve Data from an MySQL Database and Display it in a GUI?
- How to create a regular expression to partition a string that terminates in either ": 45" or ",", without the ": "
- Python Geopandas unable to convert latitude longitude to points
- Influence of Unused FFN on Model Accuracy in PyTorch
- Seeking Python Libraries for Removing Extraneous Characters and Spaces in Text
- Writes to child subprocess.Popen.stdin don't work from within process group?
- Conda has two different python binarys (python and python3) with the same version for a single environment. Why?
- Problem with add new attribute in table with BOTO3 on python
- Can't install packages in python conda environment
- Setting diagonal of a matrix to zero
- List of numbers converted to list of strings to iterate over it. But receiving TypeError messages
- Basic Python Question: Shortening If Statements
- Python and regex, can't understand why some words are left out of the match
Related Questions in ASCII
- Dart: how to convert Hex String to Ascii string
- Reading character entity reference tag content in C++
- Convet byte[] in ASCII
- Visual C++ - how can I turn a unicode character into char or string?
- Saving a numpy array in ascii format
- Ascii doc syntaxes not provide consistent output & not working as expected
- Why does $'\141' convert to ASCII 'a' as expected, but constructing the same string doesn't convert?
- How would one render a QR code in the logs of a GitHub workflow?
- Is there a recommended way to plot data using ascii symbols?
- Converting ASCII to Unary
- Doesnt \n remain in the buffer?
- Are we able to specify the Answer's XML encoding? Or does Mturk control that?
- C ASCII to Hex (atoh) Function
- ASCII to decimal conversion
- Bcrypt Password Truncation issue solution or Hashing Long Passwords with Bcrypt in Java?
Related Questions in DISTANCE
- Algorithm to find neighbours of point by distance with no repeats
- distance matrix api gives incorrect data
- How to make this sensor keep taking readings once its when_in_range function has been activated?
- Threshold scaling along a straight line
- How to subtract large binary numbers?
- sf_distance within for within for each parallelisation
- How do I update the coordinates based on most recent datetime?
- Prediction Accuracy Zero (y_pred == y_test) & ValueError after Binary Projection, kNN Hamming, Xtrain/y_train appear accurate
- Mahalanobis distance between two multivariate Gaussian distribution
- problem with inputs for estimating earth mover distance with emd from python ot package
- Finding the most-similar color palette
- scipy.spatial.distance: cityblock between lat/long points: What is the unit of the results?
- How can i add measure tool in openlayers3?
- Is calculating the distance between two floating-point numbers symmetrical?
- Fast computation of squared norm and normalized vector with Eigen
Related Questions in INTERSECTION
- How do I find the line segments formed by the meeting of two sides of two polygons?
- How much exact are the operations in CGAL function "halfspace intersection with constructions"
- Custom equality comparator for set operation in Kotlin
- confuse about union and intersection type on typescript
- NetTopologySuite - how to detect when rectangle intersects circle?
- Find the Largest Area of Square Inside Two Rectangles(Intersection)
- Finding Intersections of Cones on a Sphere
- Intersecting two panda dataframe
- Shapely can't find intersection points that definitely exist
- create intersection points between lists of functions
- Lookahead assertion can work like a type of intersection of regular expressions, but why? (JavaScript)
- Union of intersected rotated boxes
- Ray-Triangle Intersection Issue in java
- How to merge two columns by the intersection of the elements in each col?
- Check intersection and draggable svg path (svgdotjs and kld-intersections)
Related Questions in STL-FORMAT
- How to extract vertices and faces from a STL file
- Converting a gpx file to an stl file : reactJS
- AttributeError: Calling operator "bpy.ops.import_scene.obj" error, could not be found
- Stl-Format File Search Engine Not Preforming Searches Correctly
- Three.js stl rendering code doesn't display anything
- How to view the slices of a 3d stl file separately in Python?
- How to view the slices of a 3d image separately in Open3d Python?
- How to display a 3d image of .stl file
- Buggy Artifacts at Slicing .stl Models
- Android Studio (java) OpenGL ES 3D Model in STL Format
- Disappearing side walls when merging extruded polygons in PyVista
- Python VTKPlotLib how to remove existing mesh
- Calculating the thickness of an stl file
- Python code to check whether a point is inside a given mesh
- Python Dash STL Rendering with VTK
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?

Pyvista offers a really easy way of calculating just that:
For more methods and examples, have a look at:
https://docs.pyvista.org/examples/01-filter/distance-between-surfaces.html#using-pyvista-filter