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
- new thread blocks main thread
- Extracting viewCount & SubscriberCount from YouTube API V3 for a given channel, where channelID does not equal userID
- Display images on Django Template Site
- Difference between list() and dict() with generators
- How can I serialize a numpy array while preserving matrix dimensions?
- Protractor did not run properly when using browser.wait, msg: "Wait timed out after XXXms"
- Why is my program adding int as string (4+7 = 47)?
- store numpy array in mysql
- how to omit the less frequent words from a dictionary in python?
- Update a text file with ( new words+ \n ) after the words is appended into a list
- python how to write list of lists to file
- Removing URL features from tokens in NLTK
- Optimizing for Social Leaderboards
- Python : Get size of string in bytes
- What is the code of the sorted function?
Related Questions in ASCII
- Keep track of numbers entered in by a user in assembly
- javascript treating special characters as utf characters
- Determining ISO-8859-1 vs US-ASCII charset
- Why is backspace allowed in my jQuery whether I filter it out or not?
- Forming an inverted ascii triangle art using JS looping
- Isn't '\0' != 0 true?
- Python-like Byte Array String representation in C#
- Best way to Convert pairs of base 10 integers to ascii characters in python
- how do i convert a hex string to its unicode ascii equivalent in swift?
- █ character string indexed in python
- Match high ASCII characters (but not the letter i)
- What is a code point and code space?
- How to remove repeated letter from words in Java
- How to get the ascii code for "x"
- Traceback from a Python Script: invalid literal
Related Questions in DISTANCE
- List of coordinates to matrix of distances
- sort graph by distance to end nodes
- Scatter 2D coordinates from distance matrix
- array of minimum euclidian distances between all points in array
- Calculate distance between two GeoLocation
- Find Calulated Match on Existing Data Using Levensthein Method
- Calculating distances between unique Python array regions?
- How to find the nearest value in the database
- C# MongoDB driver 2.0 - Getting distance back from near query
- Find Mahalanobis distance between 2 image histograms
- Using a distance matrix *with errors* to find the coordinates of points
- Minimum distance between turtles
- Designing an algorithm to calculate the edit distance between two strings
- Calculate distance between each tag number in R
- Find longest distance from a certain point (java, 2d diagram)
Related Questions in INTERSECTION
- Math/Physics: Given angle and vector find point of intersection?
- Java 2D game random rectangles
- How can I find a common volume of three cones intersecting each other in MATLAB?
- creating polygons based on intersection
- Ray/Rectangle intersection in 3D space
- Intersecting many Points with many Polygons
- Program not outputting data correctly
- Getting Geometry of Intersection of Road SQL and Inserting Into Table
- Finding n numbers common over N lists
- Intersection of data in oracle
- How to split a self-intersection polygon to multipolygon
- Find the Intersection points of 2 rectangles
- how to check if two points are on the same line in postgis
- How to Check intersection between two images on a specific location?
- SVG intersection of elements with transforms
Related Questions in STL-FORMAT
- How to create a binary STL file containing more than one solid?
- SlimDX low performance with many vertices
- creat 3d file importer to three.js viewer
- CSG operation with STLLoader
- Saving a binary STL file in Java
- Android : .STL 3d model (Render, Edit & Save/Update)
- Import STL file in JavaFX
- Stl-Format File Search Engine Not Preforming Searches Correctly
- Alterative to merging geometries in Three.js
- Javascript - HowTo encode a floating point in binary with IEEE 754
- STLloader/THREE.js error: "Uncaught RangeError: offset is outside the bounds of the DataView"
- Converting .stl or .vtk file to JSON
- Importing 3D CAD files in python as dask array
- How to plot a .stl file with matplotlib
- How to save an OpenGL rendering to disk
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 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