question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Intrude mesh boundary by a given distance

See original GitHub issue

Hi @marcomusy,

I am trying to intrude part of the given mesh by following your example here:

m1 = vd.Mesh("./frag_1_final.ply").c("gray")
# vd.show(m1, __doc__, axes=1, viewup='z').close()

bnd = m1.boundaries(nonManifoldEdges=False, featureAngle=180)
# this creates the blue "tube" which is then used to cut the mesh
modl = bnd.implicitModeller(distance=0.0005, res=(150, 50, 150), bounds=())
m1.cutWithMesh(modl)

vd.show(m1, bnd, modl, axes=1, viewup='z').close()

image

The boundaries that are extracted are the following: image

The modeller with the 0.0005 distance seems to be empty: image then I increased it to 1 and I’ve got the “tube” that you are mentioning but as you can see there are some discontinuity in between: image image

So I have the following questions, first I would like to keep only the biggest boundary and not the smaller ones, in the linked example I could see that there was an outer=True/False parameter which is not available anymore and I guess it was doing this job. Moreover, could you elaborate a bit on the parameters of the implicitModeller() and what each corresponds to. I guess distance= is the distance you want to cut from the boundary, but it is measured in? then for res=, bounds= and maxdist= is not clear what are about. Why there is this parts in the modeller where there are gaps?

frag_1_final.ply.zip

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
marcomusycommented, Dec 17, 2021

Consider the following example:

from vedo import *
import numpy as np

settings.useDepthPeeling = True

m1 = Mesh("data/frag_1_final.ply").c("k4")#.rotateY(-60)
cm = m1.centerOfMass()

elli = pcaEllipsoid(m1, pvalue=0.5).alpha(0.7)
m2 = m1.clone().shift(-cm)

a1 = Arrow(cm,elli.axis1, c='r')
a2 = Arrow(cm,elli.axis2, c='g')
a3 = Arrow(cm,elli.axis3, c='b')

ax1 = versor(elli.axis1-cm)
ax2 = versor(elli.axis2-cm)
ax3 = versor(elli.axis3-cm)

T = np.array([ax1,ax2,ax3])  # the transposed matrix is already the inverse
# print(T)
# print(T@ax1)

m2.applyTransform(T)
b1 = a1.clone().shift(-cm).applyTransform(T)
b2 = a2.clone().shift(-cm).applyTransform(T)
b3 = a3.clone().shift(-cm).applyTransform(T)

show([[m1, a1,a2,a3, elli],
      [m2, b1,b2,b3]], N=2, sharecam=False, axes=1)

Screenshot from 2021-12-17 18-38-11

1reaction
marcomusycommented, Dec 16, 2021

…it’s an exercise of linear algebra 😃 I guess you need to invert the matrix:

[axis1,
 axis2, 
 axis3]

remember to normalize axes and check for the determinant to be positive to avoid improper rotations (mirroring), in that case you need to reorder the matrix lines. Once you have the matrix you can do mymesh.applyTransform(M).

Read more comments on GitHub >

github_iconTop Results From Across the Web

EXTRUDE (Command) | AutoCAD 2020
Creates a 3D solid from an object that encloses an area, ... The taper angle is the distance between the two specified points....
Read more >
How to work with INSET FACES | Blender 2.82 | Tutorial
Timetable:00:00 Start0:15 - Intro + use case1:02 - Inset Faces: Boundary1:27 - Inset Faces: Offset Even2:19 - Inset Faces: Offset ...
Read more >
Repairing man-made meshes via visual ... - ACM Digital Library
We test the approach on large-scale 3D datasets, and obtain quality meshes that are more readily usable for further geometry processing tasks.
Read more >
Modelling saline intrusion using dynamic mesh optimization ...
Saline intrusion (SI) in coastal aquifers is a global problem with the ... L S , are defined as the distances along the...
Read more >
Property Perimeter Fence Sensors - Senstar
Fence-mounted sensors detect and locate intruders at the fence line, before they get inside a property. Senstar offers a range of fence sensors...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found