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
Post a Comment