Archived

This topic is now archived and is closed to further replies.

serez

Cutting a model into two parts

Recommended Posts

Hi All, I want to cut a model into two parts. The first part contains all the faces above some plane parallel to XZ plane (a Y coordinate threshold), and the second part contains all the faces below the plane. So far so good, but there are faces that cut the plane. Firstly, When spliting a face into parts (usually 3 parts) How do I calculate the new texture coordinates of the two new vertices form the three old vertices? Secondly, My model is stored in Obj file that contains a vertex texture coordinates, but I have no texture image file. How does this settle? Does it mean that the coordinates are not relevant for the model? Thirdly, is there any software that splits the model automatically? It can save me some programming.... All the best, serez

Share this post


Link to post
Share on other sites
quote:
Original post by serez
Firstly, When spliting a face into parts (usually 3 parts) How do I calculate the new texture coordinates of the two new vertices form the three old vertices?


Simply by linear interpolation on the 3D triangle edges. That''s perfectly OK, since the coordinates will vary linearly along the triangle edges in world space.

So, for each triangle edge, you compute a factor (from 0 to 1), that denotes the splitting position along the edge line. For example: an edge going from A to B, you have a factor f that represents the position of the cut along the line. f = 0 would be at point A, f = 1 would be at point B. Mathematically, you could describe the cutting point on the line as:

P = A + f * (B - A)

OK, now the same thing applies to texture coordinates:

Puv = Auv + f * (Buv - Auv)

quote:

Secondly, My model is stored in Obj file that contains a vertex texture coordinates, but I have no texture image file.
How does this settle? Does it mean that the coordinates are not relevant for the model?


Depends on the texture image. Sometimes, texture coordinates are adjusted to a single specific image, and are meaningless without it. Often however, texture coordinates are generic and can be applied to a wide variety of texture images.

quote:

Thirdly, is there any software that splits the model automatically? It can save me some programming....


Every major 3D modelling package can do that.

Share this post


Link to post
Share on other sites
Thanks for the answer.

I have Deep Exploration of Right Hemisphere.
I know it is not a 3D modeling package, but rather a viewer. However, this is what I have, does Deep Exploration can do the cutting/splitting?
If so, how?

serez

Share this post


Link to post
Share on other sites
I don''t know, I never used that application. It would probably be easier to simply write the clipper yourself - it''s only a couple of hundred lines of code.

Share this post


Link to post
Share on other sites