Jump to content

Convert Packed Bounding Box to Polygon?


galagast

Recommended Posts

So far, this one worked :D

create_attributes (run over points)

matrix ident = ident();
addpointattrib(0, "transform", ident, "matrix");

 

get_intrinsic_attributes (run over points)

int pt = addpoint(0, {0,0,0});

// get bound size
float bounds[] = primintrinsic(0, "packedbounds", @ptnum);
float size_x = abs(bounds[0]-bounds[1]);
float size_y = abs(bounds[2]-bounds[3]);
float size_z = abs(bounds[4]-bounds[5]);
vector scale = set(size_x, size_y, size_z);

// set transform
matrix tm = primintrinsic(0, "packedfulltransform", @ptnum);
vector pos = primintrinsic(0, "pivot", @ptnum);
pretranslate(tm, pos);
prescale(tm, scale);
setpointattrib(0, "transform", pt, tm);

removeprim(0, @primnum, 1);

image.png.52ee6a1b15b0185d5343708391b2ba2b.png

  • Like 2
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...