View Full Version : Moving Polygons with COFFEE
Darter 02042006, 06:51 AM I'm trying to use COFFEE to move a selected polygon to a specified position. The equivalent expression works for points but not for polys. Is it necessary to move polys at the point level in COFFEE?
main(doc,op)
{
var selected = op>GetPolygonSelection();
if(!selected) return;
var polys = op>GetPolygons();
var polyCount = op>GetPolygonCount();
var i;
for(i = 0; i < polyCount; i++)
{
if(selected>IsSelected(i))
{
polys[i] = vector(100, 100, 100);
}
}
op>SetPolygons(polys);
op>Message(MSG_UPDATE);
}


PerAnders
02042006, 07:06 AM
polygons are just a data structure that contains indexes for the points that the polygon is made up of in polygon>a polyong>b polygon>c and possibly polygon>d (though c and d can be the same index if the polygon is just a tri, they're not translation objects in their own right. you will have to move each point individually (point[polygon>a].x+=100 etc)
Subcrocodile
02042006, 07:16 AM
hard to solve.
Darter
02042006, 09:08 AM
polygons are just a data structure that contains indexes for the points that the polygon is made up of in polygon>a polyong>b polygon>c and possibly polygon>d (though c and d can be the same index if the polygon is just a tri, they're not translation objects in their own right. you will have to move each point individually (point[polygon>a].x+=100 etc)
Thanks for confirming this and for the code, I'm out of the ditch and rolling again.
CGTalk Moderation
02042006, 09:08 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©20002014, Jelsoft Enterprises Ltd.