geom3d
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations
Author: David Legland

Many thanks David!!!
Nam

08 Nov 2012

geom3d
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations
Author: David Legland

Dear David,

Thanks for your very useful toolbox!

I've used some of your functions and I've found some things :

+ My problem :
I have a 3D point set. I create a minimum convex hull of this point set, using convhulln, so I have a list of facets of the convex hull.

I'd like to clip this convex hull by a plane. And this leads me to your function.

+ There 2 ways to do this with your toolbox :

1/ Use the function clipConvexPolyhedronHP. It works for my problem!
However if we want to have a side of convex hull (below or above to the plane) to clip, we must have a right plane input!!!

For example:
chX = convhulln(Pts); %Pts : 3D point set

% This function createPlane gives me : plane=[0,0,0.7,0,1,0,1,0,0]
% Then the function clipConvexPolyhedronHP returns me a wrong polyhedron. So I permute the 2 direction vectors of the plane : plane=[0,0,0.7,1,0,0,0,1,0] and it returns me a polyhedron with the right side that I desire.

So do you have a tip to use the function createPlane to have a good result (so I dont have to permute the 2 direction vectors of the plane) ?

2/ Use the function polyhedronSlice. It doesn't work because it doesnt return only the intersection points of the plane and the polyhedron, but also some points that are wrong (see the image https://dl.dropbox.com/u/8702546/WEB/image_1.png).

However, if the function works, I can control the side of polyhedron that I want to clip by a simple command of Matlab!

So I feedback you this to correct the function polyhedronSlice!

I dont know if someone has already asked about these things...

@Abdulrahman,
sorry, I missed your comment... There is no direct function for testing if a point is inside a 3D circle. What you can do is 1) extract the plane containing the circle, 2) test if the point belong to the plane, and 3) if yes, compute coordinates of point in 2D plane, and test if the 2D point is within the 2D circle (you may need geom2d also).
hope this helps ?
regards

Comment only

13 Oct 2014

geom3d
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations

Hi Jin,
yes, there aer numerical precision issus with this function... I have submitted a new version, that is more tolerant for finding intersection at edges of faces. However sometimes too many intersections are obtained. You can remove them by using the 'mergeClosePoints' function from the geom2d toolbox.
regards,
David

Comment only

09 Oct 2014

geom3d
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations

Hi David,
Really great tool! It helped me with a lot of problems. Thank you for sharing it with us.
Recently I'm using intersectLineMesh3d quite often. Here is an example I feel not all the intersections are found.
V =
0.5036 0.3333 0.3063
0.4102 0.1667 0.2098
0.1742 0.3820 0.1983
0.3505 0.4296 0.1688
0.3183 0.3623 0.3165
0.4246 0.2660 0.1180
P =
2 3 6
2 3 5
3 4 6
3 4 5
1 2 6
1 2 5
1 4 5
1 4 6
LINE =
0.3538 0.3302 0.2503 -0.8359 0.1600 -0.5250
This command
[inters pos inds] = intersectLineMesh3d(LINE,V,P) only gives me one intersection, but it should have two instead. Could you help me with that? Did I misunderstand the meaning of input and output? Thank you so much.

5

16 Jun 2014

geom3d
Library to handle 3D geometric primitives: create, intersect, display, and make basic computations

@Johannes,
The new set of faces refer to indices of vertices actually used by the faces. So it is necessary to use the following syntax:
[V2 F2] = mergeCoplanarFaces(vertices, K);
drawMesh(V2, F2);
The demo file is somewhat outdated, I will update it, and fix the doc of the mergeCoplanarFaces function.
Concerning the tolerance value, it is used for comparing normalised normal vectors of planes containing faces. There can be some numerical issues, but using 1e-4 should be fine.
regards,
David

Comment only