three.js - Get 3D cube from an Obb3 -


given obb3 (center, halfvector , axis[3]),
how can create cube has same bounds obb3 ? i'll use cube display obb3 bounds.

i use vector_math , three.dart libraries
far, code :

matrix3 rot_mat = new matrix3(node.box.axis0[0], node.box.axis1[0], node.box.axis2[0],                                 node.box.axis0[1], node.box.axis1[1], node.box.axis2[1],                                 node.box.axis0[2], node.box.axis1[2], node.box.axis2[2]); vector3 diag = rot_mat.absoluterotate(node.box.halfextents.clone()); var geometry = new cubegeometry(diag[0] * 2.0, diag[1] * 2.0, diag[2] * 2.0); var material = new meshbasicmaterial(color: 0x00ff00,  wireframe: true,  blending: normalblending,  side: doubleside,  shading: flatshading);  var obj = new mesh(geometry, material); obj.position = node.box.center; obj.matrix.setrotation(rot_mat); obj.updatematrix(); scene.add(obj); 

thanks lot :]


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -