tags:

views:

78

answers:

2

Let's say I have a Surface(S1), and I have another surface (S2) that cuts through it. How to find the polyhedron formed by the intersection of the two, as shown?

alt text

In the above example, there should be two polyhedrons returned, one above S2, another below S1.

But S1 and S2 are defined by 3D coordinates. Let's say the coordinates for S1 is (P1,P2, P3, P4) and S2 is P5,P6, P7, P8, and the intersected points are P9 and P10. I want a program that returns me two polyhedrons:

P1,P2,P9,P10,P5,P6

and

P3,P4,P10,P9,P7,P8

I am aware that it is possible to get the intersection point of the two surfaces and form polyhedrons, but it would be good if I have a builtin matlab function for this

+1  A: 

Find the intersection of the 2 surfaces (assuming they are planes this is a parallelism-test, a cross product, and solving the linear equation to check where they actually intersect). Then you have all the points you need to construct the two polyhedrons. You will probably want to check that you're marrying up the 'correct' ends and the normals make sense, but in the case above there are 6 points for each polyhedron and 2 of those points are common from the planar intersection.

p00ya
A: 

I'm not entirely sure how you intend to define your polyhedron. Do you want it to be defined by volume, vertices, edges, faces or simply by knowing whether a given point in space (x,y,z) belongs to which polyhedron?

If you want that last option, it shouldn't be too difficult to whip up a function that does this.

Given that your X and Y co-ordinates are common to both S1 and S2, a simple if statement should suffice in distinguishing between the two polyhedrons.

Consider the following example:

[x,y] = meshgrid(-10:0.1:10,-10:0.1:10); % Creates x & y meshgrids for [-10,10]
S1 =  4.*x + 3.*y;
S2 = 12.*x + 6.*y - 12;

Now we have S1 and S2, we can create a logical matrix that distinguishes between the two:

logical = S1 < S2;

Hereafter, I don't know how you want to proceed.

Zaid
I want it to be defined by vertices.
Ngu Soon Hui

related questions