32 lines
1.3 KiB
JavaScript
32 lines
1.3 KiB
JavaScript
![]() |
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const three_1 = require("three");
|
||
|
const _1 = require(".");
|
||
|
/**
|
||
|
* 绘制标注实体
|
||
|
*
|
||
|
* @export
|
||
|
* @param {Box3} box
|
||
|
* @returns 标注实体列表
|
||
|
*/
|
||
|
function DrawDimension(brList) {
|
||
|
let box = _1.GetBoxArr(brList);
|
||
|
let size = box.getSize(new three_1.Vector3());
|
||
|
let mat4 = new three_1.Matrix4();
|
||
|
mat4.makeBasis(new three_1.Vector3(-1, 0, 0), new three_1.Vector3(0, -1, 0), new three_1.Vector3(0, 0, 1));
|
||
|
mat4.setPosition(box.min.clone().add(new three_1.Vector3(size.x, -30)));
|
||
|
let textHeight = 45;
|
||
|
let dimx = new _1.Dimension(size.x, textHeight, true);
|
||
|
dimx.applyMatrix(mat4);
|
||
|
let dimz = new _1.Dimension(size.z, textHeight);
|
||
|
mat4.makeBasis(new three_1.Vector3(0, 0, -1), new three_1.Vector3(1, 0, 0), new three_1.Vector3(0, -1, 0));
|
||
|
mat4.setPosition(box.max.clone().add(new three_1.Vector3(30, -size.y)));
|
||
|
dimz.applyMatrix(mat4);
|
||
|
let dimy = new _1.Dimension(size.y, textHeight, true, true);
|
||
|
mat4.makeBasis(new three_1.Vector3(0, 1, 0), new three_1.Vector3(-1, 0, 0), new three_1.Vector3(0, 0, 1));
|
||
|
mat4.setPosition(box.max.clone().add(new three_1.Vector3(30, -size.y)));
|
||
|
dimy.applyMatrix(mat4);
|
||
|
return [dimx, dimy, dimz];
|
||
|
}
|
||
|
exports.DrawDimension = DrawDimension;
|
||
|
//# sourceMappingURL=DrawDimension.js.map
|