Section of primitive

Software: Away3D 4.x

raja6, Newbie
Posted: 26 January 2013 09:54 PM   Total Posts: 3

Hi,

I am working on a sample of project where we need to cut a primitive by the intersection plane.. and remove the upper side of the cut object.. and on the below second half object we need to highlight the removed area..

To be precise : if a cylinder is intersected by a plane and the top or left portion of the cut surface of the cylinder have to be removed and the removed area on the other side of the cut plane of cylinder should be highlited on the parts where it was cut..

Can any one please help me how to achieve it .. ? with a sample please.. i am a new guy to this stuff..

Thanks & Regards,
Raja

   

raja6, Newbie
Posted: 27 January 2013 05:36 PM   Total Posts: 3   [ # 1 ]

Any help on this please ?

   

Avatar
Fabrice Closier, Administrator
Posted: 27 January 2013 07:51 PM   Total Posts: 1265   [ # 2 ]

this is an easy but tedious code:

define a plane3d, loop over crossed mesh faces.
for each face compare plane3d.Classification
if 3 vertices are above—> mesh part1
if 3 vertices bellow—> mesh part2
if on each side,
proceed line to plane intersection test with each side of triangle, to get the two points on plane. the side with one point, you connect to the two points, and store either on mesh part 1 or 2, depending on the classification of the point.
for the side with two points, you connect 1 first intersection point with the two vertices of original face, and the second plane intersection point with the first intersection vector and the second original vertice.

If the model is ment to be uv mapped, you need store the uvs as well, and interpolate the uv values at sides to get the value at intersection point on plane.

To highlight the intersection, simply keep track of the points on plane, and feed for instance a SegmentSet with LineSegments.

To ease constructs, build 2 vectors (or four if you keep uvs) and once loop is done, pass to MeshHelper to have your two meshes. At this point, you may decide to move them apart and hide/delete original mesh.

Hope it helps.

   

raja6, Newbie
Posted: 27 January 2013 08:43 PM   Total Posts: 3   [ # 3 ]

Hi,

thanks for your reply.. since i am new to this 3d works it could be very difficult for me to translate your message to scripts.. :(

Hope i have to hire some one or find some possible examples.. it would be great if you could drop a sample if you got any for this please ..

Thanks & Regards,
Raja

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X