Comments (8)
but to be honest I don't understand why flipping the normals is not equivalent to setting invert flag.
It is really weird. After add minus sign, it works for invert=True/False
.
from vedo.
I have posted it in vtk forum: https://discourse.vtk.org/t/vtkclippolydata-incorrectly-work/13046
from vedo.
Yes: https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_box
from vedo.
Yes: https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_box
Thank you very much. I will try it.
from vedo.
Yes: https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_box
If [xmin,xmax, ymin,ymax, zmin,zmax]
is used to generate a cube, the direction is x=[1, 0, 0], y=[0, 1, 0], z=[0, 0, 1]
. How can I generate a cube with specific direction?
Is it possible to create the box with topPoint1, topPoint2, topPoint3, topPoint4, bottomPoint1, bottomPoint2, bottomPoint3, bottomPoint4
?
from vedo.
You may obtain the result by using 6 planes with
https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_planes
or
https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_plane
from vedo.
You may obtain the result by using 6 planes with https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_planes or https://vedo.embl.es/autodocs/content/vedo/vedo/pointcloud.html#Points.cut_with_plane
I have tried it, but the result is wrong. My code is:
import vedo
mesh1 = vedo.Mesh('before.obj').alpha(0.3).color('r')
a = mesh1.bounds()
print(a)
centers=[
[25.54791, 131.90236, 570.03764],
[46.95663, 83.99182, 511.02341],
[58.50379, 42.54272, 577.24325],
[37.09508, 90.45326, 636.25748]
]
normals = [
[0.34503, -0.93555, 0.07544],
[-0.07840, 0.05137, 0.99560],
[-0.34503, 0.93555, -0.07544],
[0.07840, -0.05137, -0.99560]
]
planes = []
for i in range(4):
p = vedo.Plane(pos=centers[i], normal=normals[i], s=[100, 100])
planes.append(p)
mesh2 = mesh1.clone().cut_with_planes(origins=centers, normals=normals).color('b').alpha(0.3)
vedo.show(mesh1, planes, mesh2)
The test data is:
The result of code is:
The four gray planes is used to cut the mesh. I hope the region included by the planes is cutted. But nothing is cutted.
Any suggestion is appreciated~~~
from vedo.
This seems to do the job:
import numpy as np
import vedo
mesh1 = vedo.Mesh("data/before.obj").color("r5", 0.3)
# print(mesh1)
centers = np.array([
[25.54791, 131.9023, 570.03764],
[46.95663, 83.99182, 511.02341],
[58.50379, 42.54272, 577.24325],
[37.09508, 90.45326, 636.25748],
])
normals = -np.array([ # NOTE THE MINUS SIGN
[0.34503, -0.93555, 0.07544],
[-0.07840, 0.05137, 0.99560],
[-0.34503, 0.93555, -0.07544],
[0.07840, -0.05137, -0.99560],
])
planes = []
for i in range(4):
p = vedo.Plane(centers[i], normals[i], s=[100, 100])
planes.append(p)
arrows = vedo.Arrows(centers, centers+normals*20, c="k")
mesh2 = mesh1.clone().cut_with_planes(centers, normals, invert=1)
mesh2.color("b5", 0.3)
vedo.show(planes, mesh2, arrows, axes=8)
but to be honest I don't understand why flipping the normals is not equivalent to setting invert
flag.
from vedo.
Related Issues (20)
- How to join two boundaries with different number of vertices
- Bug: Extra faces created in cut_with_plane with incorrect pointdata HOT 6
- Feature Request: Determine where genus are present in mesh HOT 2
- Bug: Thumbnail slices part of mesh HOT 1
- Bug: mesh.thumbnail hangs in docker container HOT 3
- Compute outward normals for pointdata HOT 2
- Exit without error reporting, when no NVIDIA driver is available HOT 3
- Return type annotations for vedo functions HOT 4
- jupyter notebook kernal keeps crashing after calling plt.show() HOT 1
- Window gives No Responde afte use of rotate() with big angle HOT 1
- typing.Self is not compatible with python3.10 HOT 1
- How to move object or rotate the object interactively ? HOT 14
- Reusing intersection points HOT 2
- Find intersection for parallel, flat Meshes HOT 7
- Exit viewer on control + c in terminal HOT 2
- Rounded Line generates warning, displays incorrectly HOT 2
- Suggestion: Returning intersection points too when return_cell_id is true HOT 4
- how to open multiple panels on one window ? HOT 5
- Feature: Determine visible cells from point HOT 3
- Slice rendering without smoothing HOT 4
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 vedo.