Posts: 766
Threads: 8
Joined: Sep 2009
Reputation:
58
3D lines are generated in such a way that for each line a rectangle (2 triangles) is generated so that the rectangle is facing the camera and that it has the specified line thickness on the screen. This means that on each camera change or change or the line positions, the line's MeshGeometry3D needs to be regenerated. Therefore you cannot do Boolean operations on the lines.
But instead of using LineVisual3D object (or any other Visual3D that is derived from BaseLineVisual3D) you can use TubeLineVisual3D - this object creates a tube MeshGeometry3D for each line. This MeshGeometry3D is fixed and therefore you can use Boolean operations on it. Also note, then for TubeLineVisual3D you do not specify the line thickness in screen coordinates but you specify the tube's Radius that is in world coordinates.
Anyway, I am curious why you need to use Boolean operations on 3D lines. Maybe you could split the line into multiple lines instead - using MultiLineVisual3D or multiple LineVisual3D objects to show parts of the line.
Andrej Benedik
Posts: 766
Threads: 8
Joined: Sep 2009
Reputation:
58
Thanks for the information.
So you probably also do Boolean operations on the solid model3D object. In this case you could also regenerate the lines for the wireframe.
One more tip: if have a lot of LineVisual3D objects and you want to improve the performance of your application, then you can use MultiLineVisual3D instead of multiple LineVisual3D objects. You are less flexible with a MultiLineVisual3D and also need to use a single color for all lines in MultiLineVisual3D, but the performance will be better.
Rendering many 3D lines with Ab3d.PowerToys and WPF 3D rendering can be slow because the geometry for all the lines need to be generated on the CPU. Consider using Ab3d.DXEngine as it can render millions of 3D lines because full hardware acceleration is used there. With Ab3d.DXEngine you can also set different colors for line positions - so you can render multiple lines with different colors with one object (draw call).
Andrej Benedik
Posts: 13
Threads: 3
Joined: Sep 2020
Reputation:
0
Hi, I've got a new question about MeshBooleanOperations.Subtract method.
If i've got a GeometryModel3D with transform edited and I subtract from it a MeshGeometry3D, the GeometryModel3D loss the transformation, why?
Thank's
Mattia
Posts: 766
Threads: 8
Joined: Sep 2009
Reputation:
58
Boolean operations work on meshes and in order to correctly position the mesh from the GeometryModel3D, the MeshBooleanOperations.Subtract method needs to transform the mesh before doing the subtract operation.
This is done by using MeshUtils.TransformMeshGeometry3D method.
To give you more control on transformations and which mesh is transformed, I recommend that you use Subtract methods that take two MeshGeometry3D objects and if needed transform the meshes by yourself by MeshUtils.TransformMeshGeometry3D method.
You may also use Ab3d.Meshes.BooleanMesh3D class. See the ModelingWithBooleanOperations.xaml.cs sample file on how to use that.
Andrej Benedik
Posts: 13
Threads: 3
Joined: Sep 2020
Reputation:
0
Thank you Abenedik, i will try.