Compare commits
	
		
			21 Commits
		
	
	
		
			1.2.0
			...
			add_custom
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					f60054ca19 | ||
| 
						 | 
					a55986761e | ||
| 
						 | 
					e5b944539e | ||
| 
						 | 
					27dd548309 | ||
| 
						 | 
					965ae43070 | ||
| 
						 | 
					36541f1617 | ||
| 
						 | 
					fba276362c | ||
| 
						 | 
					66dbe5869e | ||
| 
						 | 
					e70354267b | ||
| 
						 | 
					eb736bce84 | ||
| 
						 | 
					40258eeaf4 | ||
| 
						 | 
					623fa9ac9a | ||
| 
						 | 
					c586096fe0 | ||
| 
						 | 
					0aa70fdb14 | ||
| 
						 | 
					93ac737777 | ||
| 
						 | 
					01110a8858 | ||
| 
						 | 
					77f997b849 | ||
| 
						 | 
					23fa547a3a | ||
| 
						 | 
					e712b7b4e2 | ||
| 
						 | 
					d266b5ac2d | ||
| 
						 | 
					85db279fab | 
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,2 +1,3 @@
 | 
			
		||||
/node_modules
 | 
			
		||||
/dist
 | 
			
		||||
/package-lock.json
 | 
			
		||||
.history
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										31
									
								
								.vscode/settings.json
									
									
									
									
										vendored
									
									
								
							@@ -3,8 +3,10 @@
 | 
			
		||||
    "typescript.tsdk": "node_modules\\typescript\\lib",
 | 
			
		||||
    //格式化设置
 | 
			
		||||
    "editor.tabSize": 4,
 | 
			
		||||
    "editor.formatOnPaste": true,
 | 
			
		||||
    "editor.formatOnPaste": false,
 | 
			
		||||
    "editor.formatOnSave": true,
 | 
			
		||||
    "editor.insertSpaces": true,
 | 
			
		||||
    "editor.detectIndentation": false,
 | 
			
		||||
    //格式设置
 | 
			
		||||
    "typescript.format.placeOpenBraceOnNewLineForFunctions": true,
 | 
			
		||||
    "typescript.format.placeOpenBraceOnNewLineForControlBlocks": true,
 | 
			
		||||
@@ -12,5 +14,30 @@
 | 
			
		||||
    "javascript.format.placeOpenBraceOnNewLineForFunctions": true,
 | 
			
		||||
    "javascript.format.enable": true,
 | 
			
		||||
    "files.insertFinalNewline": true,
 | 
			
		||||
    "editor.detectIndentation": true,
 | 
			
		||||
    "typescript.format.semicolons": "insert",
 | 
			
		||||
    "files.trimFinalNewlines": true,
 | 
			
		||||
    "files.trimTrailingWhitespace": true,
 | 
			
		||||
    //保存时
 | 
			
		||||
    "editor.codeActionsOnSave": {
 | 
			
		||||
        "source.organizeImports": true,
 | 
			
		||||
    },
 | 
			
		||||
    "gitlens.remotes": [
 | 
			
		||||
        {
 | 
			
		||||
            "domain": "gitee.com",
 | 
			
		||||
            "type": "Custom",
 | 
			
		||||
            "name": "码云",
 | 
			
		||||
            "protocol": "https",
 | 
			
		||||
            "urls": {
 | 
			
		||||
                "repository": "https://gitee.com/cf-fz/${repoPath}",
 | 
			
		||||
                "branches": "https://gitee.com/cf-fz/${repoPath}/branches",
 | 
			
		||||
                "branch": "https://gitee.com/cf-fz/${repoPath}/commits/${branch}",
 | 
			
		||||
                "commit": "https://gitee.com/cf-fz/${repoPath}/commit/${id}",
 | 
			
		||||
                "file": "https://gitee.com/cf-fz/${repoPath}?path=${file}${line}",
 | 
			
		||||
                "fileInBranch": "https://gitee.com/cf-fz/${repoPath}/blob/${branch}/${file}${line}",
 | 
			
		||||
                "fileInCommit": "https://gitee.com/cf-fz/${repoPath}/blob/${id}/${file}${line}",
 | 
			
		||||
                "fileLine": "#L${line}",
 | 
			
		||||
                "fileRange": "#L${start}-L${end}"
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    ],
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,6 @@
 | 
			
		||||
# 显示板件的控件
 | 
			
		||||
 | 
			
		||||
使用例子请参照项目:[CADViewSample](http://git.cf/cx/CADViewSample)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
删除"@types/webpack-merge" 下的 node_modules/webpack 定义 坑爹导致项目跑不起来
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,15 @@
 | 
			
		||||
import * as HardSourceWebpackPlugin from 'hard-source-webpack-plugin';
 | 
			
		||||
import * as webpack from 'webpack';
 | 
			
		||||
import ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
 | 
			
		||||
 | 
			
		||||
const TS_LOADER = [
 | 
			
		||||
    { loader: 'cache-loader', options: { cacheDirectory: "node_modules/.cache_loader" } },
 | 
			
		||||
    {
 | 
			
		||||
        loader: 'ts-loader',
 | 
			
		||||
        options: {
 | 
			
		||||
            transpileOnly: true,
 | 
			
		||||
            experimentalWatchApi: true,
 | 
			
		||||
        },
 | 
			
		||||
    }
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
const config: webpack.Configuration = {
 | 
			
		||||
    devtool: "source-map",
 | 
			
		||||
@@ -8,30 +17,77 @@ const config: webpack.Configuration = {
 | 
			
		||||
    resolve: {
 | 
			
		||||
        extensions: [".ts", ".tsx", ".js", "json"]
 | 
			
		||||
    },
 | 
			
		||||
    externals: {
 | 
			
		||||
        'three': "THREE"
 | 
			
		||||
    },
 | 
			
		||||
    //模块加载器设置
 | 
			
		||||
    module: {
 | 
			
		||||
        rules: [
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.worker\.ts$/,
 | 
			
		||||
                exclude: /node_modules/,
 | 
			
		||||
                use: [
 | 
			
		||||
                    { loader: 'worker-loader', },
 | 
			
		||||
                    ...TS_LOADER
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.tsx?$/,
 | 
			
		||||
                exclude: /node_modules/,
 | 
			
		||||
                loader: 'ts-loader',
 | 
			
		||||
                options: {
 | 
			
		||||
                    transpileOnly: true,
 | 
			
		||||
                    experimentalWatchApi: true,
 | 
			
		||||
                },
 | 
			
		||||
                use: TS_LOADER,
 | 
			
		||||
            },
 | 
			
		||||
            { test: /\.css$/, loader: ['style-loader', 'css-loader'] },
 | 
			
		||||
            { test: /\.[(jpg)|(png)|(obj)|(json)]$/, loader: "url-loader" },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.[(png)|(obj)|(json)]$/,
 | 
			
		||||
                loader: "file-loader"
 | 
			
		||||
            },
 | 
			
		||||
            //样式加载 css
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.css$/,
 | 
			
		||||
                use: ['style-loader', 'css-loader']
 | 
			
		||||
            },
 | 
			
		||||
            //样式加载 less
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.less$/,
 | 
			
		||||
                use: [
 | 
			
		||||
                    { loader: "style-loader" },
 | 
			
		||||
                    { loader: 'css-loader', options: { sourceMap: false } },
 | 
			
		||||
                    {
 | 
			
		||||
                        loader: "less-loader",
 | 
			
		||||
                        options: {
 | 
			
		||||
                            lessOptions: {
 | 
			
		||||
                                strictMath: true,
 | 
			
		||||
                                noIeCompat: true
 | 
			
		||||
                            }
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            },
 | 
			
		||||
            //字体加载 blueprint
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(ttf|eot|svg|FBX)$/,
 | 
			
		||||
                use: {
 | 
			
		||||
                    loader: 'file-loader',
 | 
			
		||||
                    options: { name: 'fonts/[contenthash].[ext]' }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            //字体加载 blueprint
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(woff|woff2|jpg|png)$/,
 | 
			
		||||
                use: {
 | 
			
		||||
                    loader: 'url-loader',
 | 
			
		||||
                    options: {
 | 
			
		||||
                        name: 'fonts/[contenthash].[ext]',
 | 
			
		||||
                        limit: 5000,
 | 
			
		||||
                        mimetype: 'application/font-woff'
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                test: /\.(glsl|vs|fs)$/,
 | 
			
		||||
                loader: 'shader-loader'
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    plugins: [
 | 
			
		||||
        new HardSourceWebpackPlugin(),
 | 
			
		||||
        new ForkTsCheckerWebpackPlugin({ checkSyntacticErrors: true }),
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
export default config;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,16 @@
 | 
			
		||||
import path from 'path';
 | 
			
		||||
import * as webpack from 'webpack';
 | 
			
		||||
import * as merge from 'webpack-merge';
 | 
			
		||||
import merge from 'webpack-merge';
 | 
			
		||||
import common from './webpack.common';
 | 
			
		||||
import * as path from 'path';
 | 
			
		||||
 | 
			
		||||
const config: webpack.Configuration = merge(
 | 
			
		||||
    common,
 | 
			
		||||
    {
 | 
			
		||||
        mode: "production",
 | 
			
		||||
        entry: "./src/index.ts",
 | 
			
		||||
        externals: {
 | 
			
		||||
            'three': "THREE"
 | 
			
		||||
        },
 | 
			
		||||
        //输出设置
 | 
			
		||||
        output: {
 | 
			
		||||
            filename: "cad.js",
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
import HtmlWebPackPlugin from "html-webpack-plugin";
 | 
			
		||||
import * as webpack from 'webpack';
 | 
			
		||||
import * as merge from 'webpack-merge';
 | 
			
		||||
import merge from 'webpack-merge';
 | 
			
		||||
import common from './webpack.common';
 | 
			
		||||
import * as HtmlWebPackPlugin from "html-webpack-plugin";
 | 
			
		||||
 | 
			
		||||
const config: webpack.Configuration = merge(
 | 
			
		||||
    common,
 | 
			
		||||
@@ -9,14 +9,16 @@ const config: webpack.Configuration = merge(
 | 
			
		||||
        mode: "development",
 | 
			
		||||
        entry: "./src/ViewSrc/index.ts",
 | 
			
		||||
        output: { pathinfo: false },
 | 
			
		||||
        devtool: "cheap-module-eval-source-map",
 | 
			
		||||
        devtool: "eval-source-map",
 | 
			
		||||
        devServer: {
 | 
			
		||||
            contentBase: "./dist/",
 | 
			
		||||
            // contentBase: "./dist/",
 | 
			
		||||
            static: false,
 | 
			
		||||
            port: 7776,
 | 
			
		||||
            host: "0.0.0.0",
 | 
			
		||||
            hot: true,
 | 
			
		||||
        },
 | 
			
		||||
        plugins: [
 | 
			
		||||
            new webpack.NamedModulesPlugin(),//Hot
 | 
			
		||||
            // new webpack.NamedModulesPlugin(),//Hot
 | 
			
		||||
            new webpack.HotModuleReplacementPlugin(),//Hot
 | 
			
		||||
            new HtmlWebPackPlugin({
 | 
			
		||||
                title: "webCAD",
 | 
			
		||||
@@ -26,6 +28,4 @@ const config: webpack.Configuration = merge(
 | 
			
		||||
    }
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
config.externals = {};
 | 
			
		||||
 | 
			
		||||
export default config;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										46
									
								
								dist/CameraControls.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										46
									
								
								dist/CameraControls.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,46 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { KeyBoard, MouseKey } from './KeyEnum';
 | 
			
		||||
import { Viewer } from './Viewer';
 | 
			
		||||
export declare enum CameraControlState {
 | 
			
		||||
    Null = 0,
 | 
			
		||||
    Pan = 1,
 | 
			
		||||
    Rotate = 2,
 | 
			
		||||
    Scale = 3
 | 
			
		||||
}
 | 
			
		||||
export declare class CameraControls {
 | 
			
		||||
    m_TouthTypeList: CameraControlState[];
 | 
			
		||||
    m_domElement: HTMLElement;
 | 
			
		||||
    m_StartClickPoint: THREE.Vector3;
 | 
			
		||||
    m_EndClickPoint: THREE.Vector3;
 | 
			
		||||
    m_DollyStart: THREE.Vector2;
 | 
			
		||||
    m_DollyEnd: THREE.Vector2;
 | 
			
		||||
    m_KeyDown: Map<KeyBoard, boolean>;
 | 
			
		||||
    m_MouseDown: Map<MouseKey, boolean>;
 | 
			
		||||
    m_State: CameraControlState;
 | 
			
		||||
    m_Viewer: Viewer;
 | 
			
		||||
    m_LeftUseRotate: boolean;
 | 
			
		||||
    constructor(viewer: Viewer);
 | 
			
		||||
    RegisterEvent(): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * 窗体失去焦点时.
 | 
			
		||||
     *
 | 
			
		||||
     * @memberof CameraControls
 | 
			
		||||
     */
 | 
			
		||||
    onBlur: () => void;
 | 
			
		||||
    onTouchStart: (event: TouchEvent) => void;
 | 
			
		||||
    onTouchEnd: (event: TouchEvent) => void;
 | 
			
		||||
    onTouchMove: (event: TouchEvent) => void;
 | 
			
		||||
    beginRotate(): void;
 | 
			
		||||
    lastMiddleClickTime: number;
 | 
			
		||||
    onMouseDown: (event: MouseEvent) => void;
 | 
			
		||||
    onMouseUp: (event: MouseEvent) => void;
 | 
			
		||||
    onMouseMove: (event: MouseEvent) => void;
 | 
			
		||||
    /**
 | 
			
		||||
     * 鼠标滚轮事件
 | 
			
		||||
     *
 | 
			
		||||
     * @memberof CameraControls
 | 
			
		||||
     */
 | 
			
		||||
    onMouseWheel: (event: WheelEvent) => void;
 | 
			
		||||
    onKeyDown: (event: KeyboardEvent) => void;
 | 
			
		||||
    onKeyUp: (event: KeyboardEvent) => void;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										209
									
								
								dist/CameraControls.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										209
									
								
								dist/CameraControls.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,209 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var THREE = require("three");
 | 
			
		||||
var KeyEnum_1 = require("./KeyEnum");
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
//相机控制状态
 | 
			
		||||
var CameraControlState;
 | 
			
		||||
(function (CameraControlState) {
 | 
			
		||||
    CameraControlState[CameraControlState["Null"] = 0] = "Null";
 | 
			
		||||
    CameraControlState[CameraControlState["Pan"] = 1] = "Pan";
 | 
			
		||||
    CameraControlState[CameraControlState["Rotate"] = 2] = "Rotate";
 | 
			
		||||
    CameraControlState[CameraControlState["Scale"] = 3] = "Scale";
 | 
			
		||||
})(CameraControlState = exports.CameraControlState || (exports.CameraControlState = {}));
 | 
			
		||||
var CameraControls = /** @class */ (function () {
 | 
			
		||||
    function CameraControls(viewer) {
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        this.m_TouthTypeList = [CameraControlState.Rotate, CameraControlState.Scale, CameraControlState.Pan];
 | 
			
		||||
        //起始点击
 | 
			
		||||
        this.m_StartClickPoint = new THREE.Vector3();
 | 
			
		||||
        this.m_EndClickPoint = new THREE.Vector3();
 | 
			
		||||
        this.m_DollyStart = new THREE.Vector2();
 | 
			
		||||
        this.m_DollyEnd = new THREE.Vector2();
 | 
			
		||||
        this.m_KeyDown = new Map();
 | 
			
		||||
        this.m_MouseDown = new Map();
 | 
			
		||||
        //状态
 | 
			
		||||
        this.m_State = CameraControlState.Null;
 | 
			
		||||
        //左键使用旋转
 | 
			
		||||
        this.m_LeftUseRotate = true;
 | 
			
		||||
        /**
 | 
			
		||||
         * 窗体失去焦点时.
 | 
			
		||||
         *
 | 
			
		||||
         * @memberof CameraControls
 | 
			
		||||
         */
 | 
			
		||||
        this.onBlur = function () {
 | 
			
		||||
            _this.m_KeyDown.clear();
 | 
			
		||||
            _this.m_MouseDown.clear();
 | 
			
		||||
        };
 | 
			
		||||
        //触屏开始事件
 | 
			
		||||
        this.onTouchStart = function (event) {
 | 
			
		||||
            _this.m_Viewer.UpdateLockTarget();
 | 
			
		||||
            _this.m_StartClickPoint.set(event.touches[0].pageX, event.touches[0].pageY, 0);
 | 
			
		||||
            if (event.touches.length < 4) {
 | 
			
		||||
                if (event.touches.length == 2) {
 | 
			
		||||
                    var dx = event.touches[0].pageX - event.touches[1].pageX;
 | 
			
		||||
                    var dy = event.touches[0].pageY - event.touches[1].pageY;
 | 
			
		||||
                    var distance = Math.sqrt(dx * dx + dy * dy);
 | 
			
		||||
                    _this.m_DollyStart.set(0, distance);
 | 
			
		||||
                }
 | 
			
		||||
                _this.m_State = _this.m_TouthTypeList[event.touches.length - 1];
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        this.onTouchEnd = function (event) {
 | 
			
		||||
            _this.m_State = CameraControlState.Null;
 | 
			
		||||
        };
 | 
			
		||||
        this.onTouchMove = function (event) {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            event.stopPropagation();
 | 
			
		||||
            _this.m_EndClickPoint.set(event.touches[0].pageX, event.touches[0].pageY, 0);
 | 
			
		||||
            var vec = _this.m_EndClickPoint.clone().sub(_this.m_StartClickPoint);
 | 
			
		||||
            switch (_this.m_State) {
 | 
			
		||||
                case CameraControlState.Pan:
 | 
			
		||||
                    {
 | 
			
		||||
                        _this.m_Viewer.Pan(vec);
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case CameraControlState.Scale:
 | 
			
		||||
                    {
 | 
			
		||||
                        var dx = event.touches[0].pageX - event.touches[1].pageX;
 | 
			
		||||
                        var dy = event.touches[0].pageY - event.touches[1].pageY;
 | 
			
		||||
                        var distance = Math.sqrt(dx * dx + dy * dy);
 | 
			
		||||
                        _this.m_DollyEnd.set(0, distance);
 | 
			
		||||
                        if (distance > _this.m_DollyStart.y) {
 | 
			
		||||
                            _this.m_Viewer.Zoom(0.95);
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            _this.m_Viewer.Zoom(1.05);
 | 
			
		||||
                        }
 | 
			
		||||
                        _this.m_DollyStart.copy(_this.m_DollyEnd);
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case CameraControlState.Rotate:
 | 
			
		||||
                    {
 | 
			
		||||
                        _this.m_Viewer.Rotate(vec.multiplyScalar(2));
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
            }
 | 
			
		||||
            _this.m_StartClickPoint.copy(_this.m_EndClickPoint);
 | 
			
		||||
            _this.m_Viewer.m_bNeedUpdate = true;
 | 
			
		||||
        };
 | 
			
		||||
        //最后一次按中键的时间
 | 
			
		||||
        this.lastMiddleClickTime = 0;
 | 
			
		||||
        //鼠标    
 | 
			
		||||
        this.onMouseDown = function (event) {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            var key = event.button;
 | 
			
		||||
            _this.m_MouseDown.set(key, true);
 | 
			
		||||
            _this.m_StartClickPoint.set(event.offsetX, event.offsetY, 0);
 | 
			
		||||
            switch (key) {
 | 
			
		||||
                case KeyEnum_1.MouseKey.Left:
 | 
			
		||||
                    {
 | 
			
		||||
                        if (_this.m_LeftUseRotate) {
 | 
			
		||||
                            _this.beginRotate();
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case KeyEnum_1.MouseKey.Middle:
 | 
			
		||||
                    {
 | 
			
		||||
                        var curTime = Date.now();
 | 
			
		||||
                        var t = curTime - _this.lastMiddleClickTime;
 | 
			
		||||
                        _this.lastMiddleClickTime = curTime;
 | 
			
		||||
                        if (t < 350) {
 | 
			
		||||
                            _this.m_Viewer.ZoomAll();
 | 
			
		||||
                            return;
 | 
			
		||||
                        }
 | 
			
		||||
                        if (_this.m_KeyDown.get(KeyEnum_1.KeyBoard.Control)) {
 | 
			
		||||
                            _this.beginRotate();
 | 
			
		||||
                        }
 | 
			
		||||
                        else {
 | 
			
		||||
                            _this.m_State = CameraControlState.Pan;
 | 
			
		||||
                        }
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case KeyEnum_1.MouseKey.Right:
 | 
			
		||||
                    {
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        this.onMouseUp = function (event) {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            _this.m_State = CameraControlState.Null;
 | 
			
		||||
            _this.m_MouseDown.set(event.button, false);
 | 
			
		||||
        };
 | 
			
		||||
        this.onMouseMove = function (event) {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            _this.m_EndClickPoint.set(event.offsetX, event.offsetY, 0);
 | 
			
		||||
            var changeVec = _this.m_EndClickPoint.clone().sub(_this.m_StartClickPoint);
 | 
			
		||||
            _this.m_StartClickPoint.copy(_this.m_EndClickPoint);
 | 
			
		||||
            if ((_this.m_LeftUseRotate ||
 | 
			
		||||
                (_this.m_KeyDown.get(KeyEnum_1.KeyBoard.Control)))
 | 
			
		||||
                && _this.m_State == CameraControlState.Rotate) {
 | 
			
		||||
                _this.m_Viewer.Rotate(changeVec);
 | 
			
		||||
            }
 | 
			
		||||
            switch (_this.m_State) {
 | 
			
		||||
                case CameraControlState.Pan:
 | 
			
		||||
                    {
 | 
			
		||||
                        _this.m_Viewer.Pan(changeVec);
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case CameraControlState.Rotate:
 | 
			
		||||
                    {
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
                case CameraControlState.Scale:
 | 
			
		||||
                    {
 | 
			
		||||
                        break;
 | 
			
		||||
                    }
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        /**
 | 
			
		||||
         * 鼠标滚轮事件
 | 
			
		||||
         *
 | 
			
		||||
         * @memberof CameraControls
 | 
			
		||||
         */
 | 
			
		||||
        this.onMouseWheel = function (event) {
 | 
			
		||||
            event.preventDefault();
 | 
			
		||||
            event.stopPropagation();
 | 
			
		||||
            var pt = new THREE.Vector3(event.offsetX, event.offsetY, 0);
 | 
			
		||||
            _this.m_Viewer.ScreenToWorld(pt, new three_1.Vector3().setFromMatrixColumn(_this.m_Viewer.m_Camera.Camera.matrixWorld, 2));
 | 
			
		||||
            if (event.deltaY < 0) {
 | 
			
		||||
                _this.m_Viewer.Zoom(0.6, pt);
 | 
			
		||||
            }
 | 
			
		||||
            else if (event.deltaY > 0) {
 | 
			
		||||
                _this.m_Viewer.Zoom(1.4, pt);
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        //按键
 | 
			
		||||
        this.onKeyDown = function (event) {
 | 
			
		||||
            _this.m_KeyDown.set(event.keyCode, true);
 | 
			
		||||
        };
 | 
			
		||||
        this.onKeyUp = function (event) {
 | 
			
		||||
            _this.m_KeyDown.set(event.keyCode, false);
 | 
			
		||||
        };
 | 
			
		||||
        this.m_Viewer = viewer;
 | 
			
		||||
        this.m_domElement = viewer.m_Render.domElement.parentElement;
 | 
			
		||||
        this.RegisterEvent();
 | 
			
		||||
    }
 | 
			
		||||
    CameraControls.prototype.RegisterEvent = function () {
 | 
			
		||||
        if (this.m_domElement) {
 | 
			
		||||
            this.m_domElement.addEventListener("mousedown", this.onMouseDown, false);
 | 
			
		||||
            this.m_domElement.addEventListener("mousemove", this.onMouseMove, false);
 | 
			
		||||
            this.m_domElement.addEventListener("mouseup", this.onMouseUp, false);
 | 
			
		||||
            window.addEventListener("keydown", this.onKeyDown, false);
 | 
			
		||||
            window.addEventListener("keyup", this.onKeyUp, false);
 | 
			
		||||
            this.m_domElement.addEventListener('wheel', this.onMouseWheel, false);
 | 
			
		||||
            this.m_domElement.addEventListener('touchstart', this.onTouchStart, false);
 | 
			
		||||
            this.m_domElement.addEventListener('touchend', this.onTouchEnd, false);
 | 
			
		||||
            this.m_domElement.addEventListener('touchmove', this.onTouchMove, false);
 | 
			
		||||
            window.addEventListener("blur", this.onBlur, false);
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    CameraControls.prototype.beginRotate = function () {
 | 
			
		||||
        this.m_State = CameraControlState.Rotate;
 | 
			
		||||
        this.m_Viewer.UpdateLockTarget();
 | 
			
		||||
    };
 | 
			
		||||
    return CameraControls;
 | 
			
		||||
}());
 | 
			
		||||
exports.CameraControls = CameraControls;
 | 
			
		||||
//# sourceMappingURL=CameraControls.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/CameraControls.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/CameraControls.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										49
									
								
								dist/CameraUpdate.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								dist/CameraUpdate.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,49 @@
 | 
			
		||||
import { Box3, Camera, Vector3 } from 'three';
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * 相机的控制.
 | 
			
		||||
 * ->切换相机
 | 
			
		||||
 * ->设置视口大小
 | 
			
		||||
 * ->旋转和移动相机.
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class ViewCameraManage
 | 
			
		||||
 */
 | 
			
		||||
export declare class CameraUpdate {
 | 
			
		||||
    private m_CurCamera;
 | 
			
		||||
    private m_CameraArray;
 | 
			
		||||
    private m_Width;
 | 
			
		||||
    private m_Height;
 | 
			
		||||
    private m_ViewHeight;
 | 
			
		||||
    private m_Target;
 | 
			
		||||
    private m_Direction;
 | 
			
		||||
    private m_Orbit;
 | 
			
		||||
    m_MinViewHeight: number;
 | 
			
		||||
    m_MaxViewHeight: number;
 | 
			
		||||
    constructor();
 | 
			
		||||
    get Aspect(): number;
 | 
			
		||||
    get Camera(): Camera;
 | 
			
		||||
    get ViewHeight(): number;
 | 
			
		||||
    set ViewHeight(height: number);
 | 
			
		||||
    SetSize(width: number, height: number): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * 平移相机.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} mouseMove
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    Pan(mouseMove: Vector3): void;
 | 
			
		||||
    Rotate(mouseMove: Vector3, target: Vector3): void;
 | 
			
		||||
    Zoom(scale: number, scaleCenter?: Vector3): void;
 | 
			
		||||
    ZoomExtensBox3(box3: Box3): void;
 | 
			
		||||
    LookAt(dir: Vector3): void;
 | 
			
		||||
    UpdateUp(): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据视口大小,设置相机视口范围.
 | 
			
		||||
     *
 | 
			
		||||
     * @returns
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    Update(): void;
 | 
			
		||||
    SwitchCamera(): void;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										186
									
								
								dist/CameraUpdate.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										186
									
								
								dist/CameraUpdate.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,186 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var Orbit_1 = require("./Orbit");
 | 
			
		||||
/**
 | 
			
		||||
 *
 | 
			
		||||
 * 相机的控制.
 | 
			
		||||
 * ->切换相机
 | 
			
		||||
 * ->设置视口大小
 | 
			
		||||
 * ->旋转和移动相机.
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class ViewCameraManage
 | 
			
		||||
 */
 | 
			
		||||
var CameraUpdate = /** @class */ (function () {
 | 
			
		||||
    function CameraUpdate() {
 | 
			
		||||
        this.m_CameraArray = new Map();
 | 
			
		||||
        //视口显示的高度
 | 
			
		||||
        this.m_ViewHeight = 10;
 | 
			
		||||
        //观察的位置
 | 
			
		||||
        this.m_Target = new three_1.Vector3();
 | 
			
		||||
        //观察向量
 | 
			
		||||
        this.m_Direction = new three_1.Vector3(0, 0, -1);
 | 
			
		||||
        //观察的轨道.
 | 
			
		||||
        this.m_Orbit = new Orbit_1.Orbit();
 | 
			
		||||
        this.m_MinViewHeight = 10;
 | 
			
		||||
        this.m_MaxViewHeight = 3e4;
 | 
			
		||||
        this.m_CameraArray.set(three_1.OrthographicCamera, new three_1.OrthographicCamera(-2, 2, 2, -2, -1e6, 1e6));
 | 
			
		||||
        this.m_CameraArray.set(three_1.PerspectiveCamera, new three_1.PerspectiveCamera(50, 1, 0.01, 10000));
 | 
			
		||||
        this.m_CurCamera = this.m_CameraArray.get(three_1.OrthographicCamera);
 | 
			
		||||
        this.m_Orbit.UpdateRoValue(this.m_Direction);
 | 
			
		||||
        this.UpdateUp();
 | 
			
		||||
        this.Update();
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(CameraUpdate.prototype, "Aspect", {
 | 
			
		||||
        get: function () {
 | 
			
		||||
            return this.m_Width / this.m_Height;
 | 
			
		||||
        },
 | 
			
		||||
        enumerable: true,
 | 
			
		||||
        configurable: true
 | 
			
		||||
    });
 | 
			
		||||
    Object.defineProperty(CameraUpdate.prototype, "Camera", {
 | 
			
		||||
        get: function () {
 | 
			
		||||
            return this.m_CurCamera;
 | 
			
		||||
        },
 | 
			
		||||
        enumerable: true,
 | 
			
		||||
        configurable: true
 | 
			
		||||
    });
 | 
			
		||||
    Object.defineProperty(CameraUpdate.prototype, "ViewHeight", {
 | 
			
		||||
        get: function () {
 | 
			
		||||
            return this.m_ViewHeight;
 | 
			
		||||
        },
 | 
			
		||||
        set: function (height) {
 | 
			
		||||
            this.m_ViewHeight = three_1.MathUtils.clamp(height, this.m_MinViewHeight, this.m_MaxViewHeight);
 | 
			
		||||
        },
 | 
			
		||||
        enumerable: true,
 | 
			
		||||
        configurable: true
 | 
			
		||||
    });
 | 
			
		||||
    CameraUpdate.prototype.SetSize = function (width, height) {
 | 
			
		||||
        this.m_Width = width;
 | 
			
		||||
        this.m_Height = height;
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     * 平移相机.
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} mouseMove
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    CameraUpdate.prototype.Pan = function (mouseMove) {
 | 
			
		||||
        mouseMove.y *= -1;
 | 
			
		||||
        mouseMove.multiplyScalar(-this.m_ViewHeight / this.m_Height);
 | 
			
		||||
        mouseMove.applyQuaternion(this.Camera.quaternion);
 | 
			
		||||
        this.m_Target.add(mouseMove);
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.Rotate = function (mouseMove, target) {
 | 
			
		||||
        this.m_Orbit.RoX -= mouseMove.y * 0.003;
 | 
			
		||||
        this.m_Orbit.RoZ -= mouseMove.x * 0.003;
 | 
			
		||||
        //缓存观察点
 | 
			
		||||
        var oldTargetFormCameraSpace = target.clone().applyMatrix4(this.Camera.matrixWorldInverse);
 | 
			
		||||
        this.m_Orbit.UpdateDirection(this.m_Direction);
 | 
			
		||||
        this.UpdateUp();
 | 
			
		||||
        this.Update();
 | 
			
		||||
        //-----还原观察点
 | 
			
		||||
        //得到新的观察点相对于相机的位置
 | 
			
		||||
        var newTargetFormCameraSpace = target.clone().applyMatrix4(this.Camera.matrixWorldInverse);
 | 
			
		||||
        //减去原先的位置. 得到观测点在相机内移动的向量
 | 
			
		||||
        newTargetFormCameraSpace.sub(oldTargetFormCameraSpace);
 | 
			
		||||
        //乘以相机的矩阵. 得到向量在世界坐标系的位置
 | 
			
		||||
        newTargetFormCameraSpace.applyMatrix4(this.Camera.matrix);
 | 
			
		||||
        //因为使用的是点变换,所以减去基点,得到向量
 | 
			
		||||
        newTargetFormCameraSpace.sub(this.Camera.position);
 | 
			
		||||
        //加上移动的向量. 使得观察点时钟在相机的某个位置
 | 
			
		||||
        this.m_Target.add(newTargetFormCameraSpace);
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.Zoom = function (scale, scaleCenter) {
 | 
			
		||||
        if (this.Camera instanceof three_1.OrthographicCamera) {
 | 
			
		||||
            this.ViewHeight *= scale;
 | 
			
		||||
            if (scaleCenter && this.m_ViewHeight < this.m_MaxViewHeight) {
 | 
			
		||||
                this.m_Target.sub(scaleCenter);
 | 
			
		||||
                this.m_Target.multiplyScalar(scale);
 | 
			
		||||
                this.m_Target.add(scaleCenter);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (this.Camera instanceof three_1.PerspectiveCamera) {
 | 
			
		||||
            var add = scale > 1 ? 1 : -1;
 | 
			
		||||
            add *= this.Camera.position.distanceTo(this.m_Target) / 10;
 | 
			
		||||
            this.m_Target.add(this.m_Direction.clone().multiplyScalar(-add));
 | 
			
		||||
        }
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.ZoomExtensBox3 = function (box3) {
 | 
			
		||||
        if (!box3 || box3.isEmpty())
 | 
			
		||||
            return;
 | 
			
		||||
        this.Camera.updateMatrixWorld(false);
 | 
			
		||||
        //变换到相机坐标系
 | 
			
		||||
        box3.applyMatrix4(this.Camera.matrixWorldInverse);
 | 
			
		||||
        //
 | 
			
		||||
        box3.getCenter(this.m_Target);
 | 
			
		||||
        //世界坐标系
 | 
			
		||||
        this.m_Target.applyMatrix4(this.Camera.matrix);
 | 
			
		||||
        //size
 | 
			
		||||
        var size = box3.getSize(new three_1.Vector3());
 | 
			
		||||
        //宽高比
 | 
			
		||||
        var aspectRatio = size.x / size.y;
 | 
			
		||||
        var viewAspectRatio = this.Aspect;
 | 
			
		||||
        //
 | 
			
		||||
        if (aspectRatio > viewAspectRatio) {
 | 
			
		||||
            this.m_ViewHeight = size.x / viewAspectRatio;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this.m_ViewHeight = size.y;
 | 
			
		||||
        }
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.LookAt = function (dir) {
 | 
			
		||||
        this.m_Orbit.UpdateRoValue(dir);
 | 
			
		||||
        this.m_Direction.copy(dir);
 | 
			
		||||
        this.UpdateUp();
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.UpdateUp = function () {
 | 
			
		||||
        Orbit_1.Orbit.ComputUpDirection(this.m_Direction, this.Camera.up);
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据视口大小,设置相机视口范围.
 | 
			
		||||
     *
 | 
			
		||||
     * @returns
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    CameraUpdate.prototype.Update = function () {
 | 
			
		||||
        this.Camera.position.copy(this.m_Target);
 | 
			
		||||
        if (this.Camera instanceof three_1.OrthographicCamera) {
 | 
			
		||||
            this.Camera.left = this.Aspect * this.m_ViewHeight / -2;
 | 
			
		||||
            this.Camera.right = this.Aspect * this.m_ViewHeight / 2;
 | 
			
		||||
            this.Camera.bottom = this.m_ViewHeight / -2;
 | 
			
		||||
            this.Camera.top = this.m_ViewHeight / 2;
 | 
			
		||||
            this.Camera.position.sub(this.m_Direction);
 | 
			
		||||
        }
 | 
			
		||||
        else if (this.Camera instanceof three_1.PerspectiveCamera) {
 | 
			
		||||
            this.Camera.aspect = this.Aspect;
 | 
			
		||||
            var distens = (this.m_ViewHeight / 2) / (Math.tan(three_1.MathUtils.degToRad(this.Camera.fov) / 2));
 | 
			
		||||
            this.Camera.position.sub(this.m_Direction.clone().multiplyScalar(distens));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
        this.Camera.lookAt(this.m_Target);
 | 
			
		||||
        this.Camera.updateProjectionMatrix();
 | 
			
		||||
        this.Camera.updateMatrixWorld(false);
 | 
			
		||||
    };
 | 
			
		||||
    CameraUpdate.prototype.SwitchCamera = function () {
 | 
			
		||||
        if (this.Camera instanceof three_1.OrthographicCamera) {
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(three_1.PerspectiveCamera);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(three_1.OrthographicCamera);
 | 
			
		||||
        }
 | 
			
		||||
        this.UpdateUp();
 | 
			
		||||
        this.Update();
 | 
			
		||||
    };
 | 
			
		||||
    return CameraUpdate;
 | 
			
		||||
}());
 | 
			
		||||
exports.CameraUpdate = CameraUpdate;
 | 
			
		||||
//# sourceMappingURL=CameraUpdate.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/CameraUpdate.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/CameraUpdate.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										10
									
								
								dist/ColorPalette.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								dist/ColorPalette.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { LineBasicMaterial, MeshBasicMaterial } from 'three';
 | 
			
		||||
export declare class ColorMaterial {
 | 
			
		||||
    private constructor();
 | 
			
		||||
    private static m_LineMaterialMap;
 | 
			
		||||
    static GetLineMaterial(index: any): LineBasicMaterial;
 | 
			
		||||
    private static m_BasicMaterialMap;
 | 
			
		||||
    static GetBasicMaterial(index: number): MeshBasicMaterial;
 | 
			
		||||
    static GetColor(index: number): THREE.Color;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								dist/ColorPalette.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								dist/ColorPalette.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var ColorPalette = [
 | 
			
		||||
    [255, 0, 0, 255],
 | 
			
		||||
    //[255, 255, 255, 255],//----- 0 - ByBlock - White
 | 
			
		||||
    [255, 0, 0, 255],
 | 
			
		||||
    // [255, 0, 0, 255],    //----- 1 - Red
 | 
			
		||||
    [255, 255, 0, 255],
 | 
			
		||||
    [0, 255, 0, 255],
 | 
			
		||||
    [0, 255, 255, 255],
 | 
			
		||||
    [0, 0, 255, 255],
 | 
			
		||||
    [255, 0, 255, 255],
 | 
			
		||||
];
 | 
			
		||||
//颜色材质,对于二维图像来说可能有用,应该不对三维对象使用该材质
 | 
			
		||||
var ColorMaterial = /** @class */ (function () {
 | 
			
		||||
    function ColorMaterial() {
 | 
			
		||||
    }
 | 
			
		||||
    ColorMaterial.GetLineMaterial = function (index) {
 | 
			
		||||
        if (this.m_LineMaterialMap.has(index))
 | 
			
		||||
            return this.m_LineMaterialMap.get(index);
 | 
			
		||||
        var mat = new three_1.LineBasicMaterial({ color: this.GetColor(index) });
 | 
			
		||||
        this.m_LineMaterialMap.set(index, mat);
 | 
			
		||||
        return mat;
 | 
			
		||||
    };
 | 
			
		||||
    ColorMaterial.GetBasicMaterial = function (index) {
 | 
			
		||||
        if (this.m_BasicMaterialMap.has(index))
 | 
			
		||||
            return this.m_BasicMaterialMap.get(index);
 | 
			
		||||
        var mat = new three_1.MeshBasicMaterial({ color: this.GetColor(index) });
 | 
			
		||||
        this.m_BasicMaterialMap.set(index, mat);
 | 
			
		||||
        return mat;
 | 
			
		||||
    };
 | 
			
		||||
    ColorMaterial.GetColor = function (index) {
 | 
			
		||||
        var rgb = ColorPalette[index];
 | 
			
		||||
        if (rgb)
 | 
			
		||||
            return new three_1.Color(rgb[0] / 255, rgb[1] / 255, rgb[2] / 255);
 | 
			
		||||
    };
 | 
			
		||||
    ColorMaterial.m_LineMaterialMap = new Map();
 | 
			
		||||
    ColorMaterial.m_BasicMaterialMap = new Map();
 | 
			
		||||
    return ColorMaterial;
 | 
			
		||||
}());
 | 
			
		||||
exports.ColorMaterial = ColorMaterial;
 | 
			
		||||
//# sourceMappingURL=ColorPalette.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/ColorPalette.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/ColorPalette.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"ColorPalette.js","sourceRoot":"","sources":["../src/ColorPalette.ts"],"names":[],"mappings":";;AACA,+BAAoE;AACpE,IAAM,YAAY,GAAG;IACjB,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IAChB,kDAAkD;IAClD,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC;IAChB,uCAAuC;IACvC,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC;IAChB,CAAC,CAAC,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAClB,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC;IAChB,CAAC,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC;CA8PrB,CAAC;AAGF,iCAAiC;AACjC;IAEI;IAAwB,CAAC;IAElB,6BAAe,GAAtB,UAAuB,KAAK;QAExB,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC;YACjC,OAAO,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,GAAG,GAAG,IAAI,yBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACvC,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,8BAAgB,GAAvB,UAAwB,KAAa;QAEjC,IAAI,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC;YAClC,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC9C,IAAI,GAAG,GAAG,IAAI,yBAAiB,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACjE,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACxC,OAAO,GAAG,CAAC;IACf,CAAC;IAEM,sBAAQ,GAAf,UAAgB,KAAa;QAEzB,IAAI,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QAC9B,IAAI,GAAG;YACH,OAAO,IAAI,aAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;IACnE,CAAC;IAxBc,+BAAiB,GAAG,IAAI,GAAG,EAAmC,CAAC;IAS/D,gCAAkB,GAAG,IAAI,GAAG,EAA6B,CAAC;IAgB7E,oBAAC;CAAA,AA5BD,IA4BC;AA5BY,sCAAa"}
 | 
			
		||||
							
								
								
									
										10
									
								
								dist/Dimension.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								dist/Dimension.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
import { Group } from "three";
 | 
			
		||||
/**
 | 
			
		||||
 * 标注实体
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class Dimension
 | 
			
		||||
 * @extends {Group}
 | 
			
		||||
 */
 | 
			
		||||
export declare class Dimension extends Group {
 | 
			
		||||
    constructor(length: number, textHeight?: number, mirror?: boolean, mirrorFoot?: boolean);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								dist/Dimension.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								dist/Dimension.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __extends = (this && this.__extends) || (function () {
 | 
			
		||||
    var extendStatics = function (d, b) {
 | 
			
		||||
        extendStatics = Object.setPrototypeOf ||
 | 
			
		||||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
 | 
			
		||||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
 | 
			
		||||
        return extendStatics(d, b);
 | 
			
		||||
    };
 | 
			
		||||
    return function (d, b) {
 | 
			
		||||
        extendStatics(d, b);
 | 
			
		||||
        function __() { this.constructor = d; }
 | 
			
		||||
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var ColorPalette_1 = require("./ColorPalette");
 | 
			
		||||
var Text_1 = require("./Text");
 | 
			
		||||
var GeUtils_1 = require("./GeUtils");
 | 
			
		||||
/**
 | 
			
		||||
 * 标注实体
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class Dimension
 | 
			
		||||
 * @extends {Group}
 | 
			
		||||
 */
 | 
			
		||||
var Dimension = /** @class */ (function (_super) {
 | 
			
		||||
    __extends(Dimension, _super);
 | 
			
		||||
    function Dimension(length, textHeight, mirror, mirrorFoot) {
 | 
			
		||||
        if (textHeight === void 0) { textHeight = 25; }
 | 
			
		||||
        if (mirror === void 0) { mirror = false; }
 | 
			
		||||
        if (mirrorFoot === void 0) { mirrorFoot = false; }
 | 
			
		||||
        var _this = _super.call(this) || this;
 | 
			
		||||
        var footLength = 60;
 | 
			
		||||
        if (mirrorFoot) {
 | 
			
		||||
            footLength = -footLength;
 | 
			
		||||
        }
 | 
			
		||||
        //针脚几何体
 | 
			
		||||
        var lineGeo = new three_1.Geometry();
 | 
			
		||||
        lineGeo.vertices.push(new three_1.Vector3(), new three_1.Vector3(0, footLength, 0));
 | 
			
		||||
        //托盘几何体
 | 
			
		||||
        var lineGeo2 = new three_1.Geometry();
 | 
			
		||||
        lineGeo2.vertices.push(new three_1.Vector3(0, footLength), new three_1.Vector3(length, footLength, 0));
 | 
			
		||||
        var material = ColorPalette_1.ColorMaterial.GetLineMaterial(5);
 | 
			
		||||
        var line1 = new three_1.Line(lineGeo, material);
 | 
			
		||||
        var line2 = new three_1.Line(lineGeo, material);
 | 
			
		||||
        line2.position.x = length;
 | 
			
		||||
        var line3 = new three_1.Line(lineGeo2, material);
 | 
			
		||||
        var text = new Text_1.DbText(parseFloat(length.toFixed(2)).toString(), textHeight);
 | 
			
		||||
        if (mirror) {
 | 
			
		||||
            var roMat = new three_1.Matrix4().makeRotationZ(Math.PI);
 | 
			
		||||
            text.applyMatrix4(roMat);
 | 
			
		||||
            text.applyMatrix4(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength - textHeight * 0.1)));
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            text.applyMatrix4(GeUtils_1.MoveMatrix(new three_1.Vector3(length * 0.5, footLength * 1.1)));
 | 
			
		||||
        }
 | 
			
		||||
        _this.add(text);
 | 
			
		||||
        _this.add(line1, line2, line3);
 | 
			
		||||
        return _this;
 | 
			
		||||
    }
 | 
			
		||||
    return Dimension;
 | 
			
		||||
}(three_1.Group));
 | 
			
		||||
exports.Dimension = Dimension;
 | 
			
		||||
//# sourceMappingURL=Dimension.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Dimension.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Dimension.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Dimension.js","sourceRoot":"","sources":["../src/Dimension.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAAgE;AAChE,+CAA+C;AAC/C,+BAAgC;AAChC,qCAAuC;AAEvC;;;;;GAKG;AACH;IAA+B,6BAAK;IAGhC,mBAAY,MAAc,EAAE,UAAuB,EAAE,MAAuB,EAAE,UAA2B;QAA7E,2BAAA,EAAA,eAAuB;QAAE,uBAAA,EAAA,cAAuB;QAAE,2BAAA,EAAA,kBAA2B;QAAzG,YAEI,iBAAO,SAuCV;QAtCG,IAAI,UAAU,GAAG,EAAE,CAAC;QACpB,IAAI,UAAU,EACd;YACI,UAAU,GAAG,CAAC,UAAU,CAAC;SAC5B;QAED,OAAO;QACP,IAAI,OAAO,GAAG,IAAI,gBAAQ,EAAE,CAAC;QAC7B,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,eAAO,EAAE,EAAE,IAAI,eAAO,CAAC,CAAC,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QAEpE,OAAO;QACP,IAAI,QAAQ,GAAG,IAAI,gBAAQ,EAAE,CAAC;QAC9B,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,eAAO,CAAC,CAAC,EAAE,UAAU,CAAC,EAAE,IAAI,eAAO,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;QAEvF,IAAI,QAAQ,GAAG,4BAAa,CAAC,eAAe,CAAC,CAAC,CAAC,CAAA;QAE/C,IAAI,KAAK,GAAG,IAAI,YAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,IAAI,KAAK,GAAG,IAAI,YAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACxC,KAAK,CAAC,QAAQ,CAAC,CAAC,GAAG,MAAM,CAAC;QAE1B,IAAI,KAAK,GAAG,IAAI,YAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAEzC,IAAI,IAAI,GAAG,IAAI,aAAM,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,EAAE,UAAU,CAAC,CAAC;QAC5E,IAAI,MAAM,EACV;YACI,IAAI,KAAK,GAAG,IAAI,eAAO,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACjD,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;YACzB,IAAI,CAAC,YAAY,CAAC,oBAAU,CAAC,IAAI,eAAO,CAAC,MAAM,GAAG,GAAG,EAAE,UAAU,GAAG,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;SAC3F;aAED;YACI,IAAI,CAAC,YAAY,CAAC,oBAAU,CAAC,IAAI,eAAO,CAAC,MAAM,GAAG,GAAG,EAAE,UAAU,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;SAC9E;QAGD,KAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEf,KAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;;IAClC,CAAC;IACL,gBAAC;AAAD,CAAC,AA7CD,CAA+B,aAAK,GA6CnC;AA7CY,8BAAS"}
 | 
			
		||||
							
								
								
									
										10
									
								
								dist/DrawDimension.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								dist/DrawDimension.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,10 @@
 | 
			
		||||
import { Mesh } from "three";
 | 
			
		||||
import { Dimension } from ".";
 | 
			
		||||
/**
 | 
			
		||||
 * 绘制标注实体
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Box3} box
 | 
			
		||||
 * @returns 标注实体列表
 | 
			
		||||
 */
 | 
			
		||||
export declare function DrawDimension(brList: Mesh[]): Dimension[];
 | 
			
		||||
							
								
								
									
										32
									
								
								dist/DrawDimension.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										32
									
								
								dist/DrawDimension.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,32 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var _1 = require(".");
 | 
			
		||||
/**
 | 
			
		||||
 * 绘制标注实体
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Box3} box
 | 
			
		||||
 * @returns 标注实体列表
 | 
			
		||||
 */
 | 
			
		||||
function DrawDimension(brList) {
 | 
			
		||||
    var box = _1.GetBoxArr(brList);
 | 
			
		||||
    var size = box.getSize(new three_1.Vector3());
 | 
			
		||||
    var 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)));
 | 
			
		||||
    var textHeight = 45;
 | 
			
		||||
    var dimx = new _1.Dimension(size.x, textHeight, true);
 | 
			
		||||
    dimx.applyMatrix4(mat4);
 | 
			
		||||
    var 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.applyMatrix4(mat4);
 | 
			
		||||
    var 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.applyMatrix4(mat4);
 | 
			
		||||
    return [dimx, dimy, dimz];
 | 
			
		||||
}
 | 
			
		||||
exports.DrawDimension = DrawDimension;
 | 
			
		||||
//# sourceMappingURL=DrawDimension.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/DrawDimension.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/DrawDimension.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"DrawDimension.js","sourceRoot":"","sources":["../src/DrawDimension.ts"],"names":[],"mappings":";;AAAA,+BAAqD;AACrD,sBAAyC;AAGzC;;;;;;GAMG;AACH,SAAgB,aAAa,CAAC,MAAc;IAExC,IAAI,GAAG,GAAG,YAAS,CAAC,MAAM,CAAC,CAAC;IAC5B,IAAI,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,eAAO,EAAE,CAAC,CAAC;IAEtC,IAAI,IAAI,GAAG,IAAI,eAAO,EAAE,CAAC;IACzB,IAAI,CAAC,SAAS,CACV,IAAI,eAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACrB,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,EACrB,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACvB,CAAA;IACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,eAAO,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAEhE,IAAI,UAAU,GAAG,EAAE,CAAC;IACpB,IAAI,IAAI,GAAG,IAAI,YAAS,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;IACnD,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAExB,IAAI,IAAI,GAAG,IAAI,YAAS,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC;IAC7C,IAAI,CAAC,SAAS,CACV,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EACrB,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CACxB,CAAA;IACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,eAAO,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAExB,IAAI,IAAI,GAAG,IAAI,YAAS,CAAC,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACzD,IAAI,CAAC,SAAS,CACV,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACpB,IAAI,eAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACrB,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CACvB,CAAA;IACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,IAAI,eAAO,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChE,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAGxB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAC9B,CAAC;AArCD,sCAqCC"}
 | 
			
		||||
							
								
								
									
										72
									
								
								dist/GeUtils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										72
									
								
								dist/GeUtils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,72 @@
 | 
			
		||||
import { Geometry, Vector, Vector2, Vector3, Box3, Matrix4, Object3D, Line, Mesh } from 'three';
 | 
			
		||||
export declare const cZeroVec: Vector3;
 | 
			
		||||
export declare const cXAxis: Vector3;
 | 
			
		||||
export declare const cYAxis: Vector3;
 | 
			
		||||
export declare const cZAxis: Vector3;
 | 
			
		||||
/**
 | 
			
		||||
 * 旋转一个点,旋转中心在原点
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Vector3} pt 点
 | 
			
		||||
 * @param {number} ang 角度.
 | 
			
		||||
 * @returns {Vector3} 返回pt不拷贝.
 | 
			
		||||
 */
 | 
			
		||||
export declare function rotatePoint(pt: Vector3, ang: number): Vector3;
 | 
			
		||||
export declare function equaln(v1: number, v2: number, fuzz?: number): boolean;
 | 
			
		||||
export declare function equalv3(v1: Vector3, v2: Vector3, fuzz?: number): boolean;
 | 
			
		||||
export declare function equal<T extends Vector>(v1: T, v2: T): boolean;
 | 
			
		||||
export declare function fixAngle(an: number, fixAngle: number, fuzz?: number): number;
 | 
			
		||||
/**
 | 
			
		||||
 * 按照极坐标的方式移动一个点
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @template
 | 
			
		||||
 * @param {T} v 向量(2d,3d)
 | 
			
		||||
 * @param {number} an 角度
 | 
			
		||||
 * @param {number} dis 距离
 | 
			
		||||
 * @returns {T}
 | 
			
		||||
 */
 | 
			
		||||
export declare function polar<T extends Vector2 | Vector3>(v: T, an: number, dis: number): T;
 | 
			
		||||
export declare function angle(v: Vector3 | Vector2): number;
 | 
			
		||||
/**
 | 
			
		||||
 * 求两个向量的夹角,顺时针为负,逆时针为正
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Vector3} v1
 | 
			
		||||
 * @param {Vector3} v2
 | 
			
		||||
 * @param {Vector3} [ref] 参考向量,如果为世界坐标系则为0,0,1
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export declare function angleTo(v1: Vector3, v2: Vector3, ref?: Vector3): number;
 | 
			
		||||
export declare function getLoocAtUpVec(dir: Vector3): Vector3;
 | 
			
		||||
export declare function createLookAtMat4(dir: Vector3): Matrix4;
 | 
			
		||||
export declare function isParallelTo(v1: Vector3, v2: Vector3): boolean;
 | 
			
		||||
export declare function ptToString(v: Vector3, fractionDigits?: number): string;
 | 
			
		||||
export declare function midPoint(v1: Vector3, v2: Vector3): Vector3;
 | 
			
		||||
export declare function midPoint2(v1: Vector2, v2: Vector2): Vector2;
 | 
			
		||||
export declare function midPtCir(v1: Vector3, v2: Vector3): Vector3;
 | 
			
		||||
/**
 | 
			
		||||
 * 获得Three对象的包围盒.
 | 
			
		||||
 * @param obj
 | 
			
		||||
 * @param [updateMatrix] 是否应该更新对象矩阵
 | 
			
		||||
 * @returns box
 | 
			
		||||
 */
 | 
			
		||||
export declare function GetBox(obj: Object3D, updateMatrix?: boolean): Box3;
 | 
			
		||||
export declare function GetBoxArr(arr: Array<Object3D>): Box3;
 | 
			
		||||
export declare function MoveMatrix(v: Vector3): Matrix4;
 | 
			
		||||
export declare function getProjectDist(v1: Vector3, v2: Vector3): {
 | 
			
		||||
    h: number;
 | 
			
		||||
    v: number;
 | 
			
		||||
};
 | 
			
		||||
export declare function getPtPostion(sp: Vector3, ep: Vector3, c: Vector3, inPt: Vector3): {
 | 
			
		||||
    sp: Vector3;
 | 
			
		||||
    ep: Vector3;
 | 
			
		||||
};
 | 
			
		||||
export declare function angleAndX(v: Vector3 | Vector2): number;
 | 
			
		||||
/**
 | 
			
		||||
 * 将角度调整为0-2pi之间
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {number} an
 | 
			
		||||
 */
 | 
			
		||||
export declare function angleTo2Pi(an: number): number;
 | 
			
		||||
export declare function updateGeometry(l: Line | Mesh, geometry: Geometry): void;
 | 
			
		||||
							
								
								
									
										266
									
								
								dist/GeUtils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										266
									
								
								dist/GeUtils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,266 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var Matrix2_1 = require("./Matrix2");
 | 
			
		||||
exports.cZeroVec = new three_1.Vector3();
 | 
			
		||||
exports.cXAxis = new three_1.Vector3(1, 0, 0);
 | 
			
		||||
exports.cYAxis = new three_1.Vector3(0, 1, 0);
 | 
			
		||||
exports.cZAxis = new three_1.Vector3(0, 0, 1);
 | 
			
		||||
/**
 | 
			
		||||
 * 旋转一个点,旋转中心在原点
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Vector3} pt 点
 | 
			
		||||
 * @param {number} ang 角度.
 | 
			
		||||
 * @returns {Vector3} 返回pt不拷贝.
 | 
			
		||||
 */
 | 
			
		||||
function rotatePoint(pt, ang) {
 | 
			
		||||
    new Matrix2_1.Matrix2().setRotate(ang).applyVector(pt);
 | 
			
		||||
    return pt;
 | 
			
		||||
}
 | 
			
		||||
exports.rotatePoint = rotatePoint;
 | 
			
		||||
function equaln(v1, v2, fuzz) {
 | 
			
		||||
    if (fuzz === void 0) { fuzz = 1e-3; }
 | 
			
		||||
    return Math.abs(v1 - v2) < fuzz;
 | 
			
		||||
}
 | 
			
		||||
exports.equaln = equaln;
 | 
			
		||||
function equalv3(v1, v2, fuzz) {
 | 
			
		||||
    if (fuzz === void 0) { fuzz = 1e-8; }
 | 
			
		||||
    return equaln(v1.x, v2.x, fuzz) && equaln(v1.y, v2.y, fuzz) && equaln(v1.z, v2.z, fuzz);
 | 
			
		||||
}
 | 
			
		||||
exports.equalv3 = equalv3;
 | 
			
		||||
function equal(v1, v2) {
 | 
			
		||||
    return v1.distanceToSquared(v2) < 1e-8;
 | 
			
		||||
}
 | 
			
		||||
exports.equal = equal;
 | 
			
		||||
function fixAngle(an, fixAngle, fuzz) {
 | 
			
		||||
    if (fuzz === void 0) { fuzz = 0.1; }
 | 
			
		||||
    if (an < 0)
 | 
			
		||||
        an += Math.PI * 2;
 | 
			
		||||
    an += fuzz;
 | 
			
		||||
    var rem = an % fixAngle;
 | 
			
		||||
    if (rem < fuzz * 2) {
 | 
			
		||||
        an -= rem;
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        an -= fuzz;
 | 
			
		||||
    }
 | 
			
		||||
    return an;
 | 
			
		||||
}
 | 
			
		||||
exports.fixAngle = fixAngle;
 | 
			
		||||
/**
 | 
			
		||||
 * 按照极坐标的方式移动一个点
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @template
 | 
			
		||||
 * @param {T} v 向量(2d,3d)
 | 
			
		||||
 * @param {number} an 角度
 | 
			
		||||
 * @param {number} dis 距离
 | 
			
		||||
 * @returns {T}
 | 
			
		||||
 */
 | 
			
		||||
function polar(v, an, dis) {
 | 
			
		||||
    v.x += Math.cos(an) * dis;
 | 
			
		||||
    v.y += Math.sin(an) * dis;
 | 
			
		||||
    return v;
 | 
			
		||||
}
 | 
			
		||||
exports.polar = polar;
 | 
			
		||||
function angle(v) {
 | 
			
		||||
    if (equaln(v.y, 0) && v.x > 0)
 | 
			
		||||
        return 0;
 | 
			
		||||
    var angle = Math.atan2(v.y, v.x);
 | 
			
		||||
    if (angle < 0)
 | 
			
		||||
        angle += Math.PI * 2;
 | 
			
		||||
    return angle;
 | 
			
		||||
}
 | 
			
		||||
exports.angle = angle;
 | 
			
		||||
/**
 | 
			
		||||
 * 求两个向量的夹角,顺时针为负,逆时针为正
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Vector3} v1
 | 
			
		||||
 * @param {Vector3} v2
 | 
			
		||||
 * @param {Vector3} [ref] 参考向量,如果为世界坐标系则为0,0,1
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
function angleTo(v1, v2, ref) {
 | 
			
		||||
    if (ref === void 0) { ref = new three_1.Vector3(0, 0, 1); }
 | 
			
		||||
    if (!ref.equals(new three_1.Vector3(0, 0, 1))) {
 | 
			
		||||
        //任意轴坐标系. 使用相机的构造矩阵.
 | 
			
		||||
        ref.multiplyScalar(-1);
 | 
			
		||||
        var up = getLoocAtUpVec(ref);
 | 
			
		||||
        var refOcs = new three_1.Matrix4();
 | 
			
		||||
        refOcs.lookAt(exports.cZeroVec, ref, up);
 | 
			
		||||
        var refOcsInv = new three_1.Matrix4().getInverse(refOcs);
 | 
			
		||||
        v1.applyMatrix4(refOcsInv);
 | 
			
		||||
        v2.applyMatrix4(refOcsInv);
 | 
			
		||||
        v1.z = 0;
 | 
			
		||||
        v2.z = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (v1.equals(exports.cZeroVec) || v2.equals(exports.cZeroVec))
 | 
			
		||||
        return 0;
 | 
			
		||||
    var cv = new three_1.Vector3().crossVectors(v1, v2).normalize();
 | 
			
		||||
    return cv.z === 0 ? v1.angleTo(v2) : v1.angleTo(v2) * cv.z;
 | 
			
		||||
}
 | 
			
		||||
exports.angleTo = angleTo;
 | 
			
		||||
function getLoocAtUpVec(dir) {
 | 
			
		||||
    if (dir.equals(exports.cZeroVec)) {
 | 
			
		||||
        throw ("zero vector");
 | 
			
		||||
    }
 | 
			
		||||
    var norm = dir.clone().normalize();
 | 
			
		||||
    if (norm.equals(exports.cZAxis)) {
 | 
			
		||||
        return new three_1.Vector3(0, 1, 0);
 | 
			
		||||
    }
 | 
			
		||||
    else if (norm.equals(exports.cZAxis.clone().negate())) {
 | 
			
		||||
        return new three_1.Vector3(0, -1, 0);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        var xv = new three_1.Vector3();
 | 
			
		||||
        xv.crossVectors(exports.cZAxis, norm);
 | 
			
		||||
        var up = new three_1.Vector3();
 | 
			
		||||
        up.crossVectors(norm, xv);
 | 
			
		||||
        return up;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.getLoocAtUpVec = getLoocAtUpVec;
 | 
			
		||||
function createLookAtMat4(dir) {
 | 
			
		||||
    var up = getLoocAtUpVec(dir);
 | 
			
		||||
    var mat = new three_1.Matrix4();
 | 
			
		||||
    mat.lookAt(exports.cZeroVec, dir, up);
 | 
			
		||||
    return mat;
 | 
			
		||||
}
 | 
			
		||||
exports.createLookAtMat4 = createLookAtMat4;
 | 
			
		||||
function isParallelTo(v1, v2) {
 | 
			
		||||
    return v1.clone().cross(v2).lengthSq() < 1e-9;
 | 
			
		||||
}
 | 
			
		||||
exports.isParallelTo = isParallelTo;
 | 
			
		||||
function ptToString(v, fractionDigits) {
 | 
			
		||||
    if (fractionDigits === void 0) { fractionDigits = 3; }
 | 
			
		||||
    return v.toArray().map(function (o) {
 | 
			
		||||
        return o.toFixed(fractionDigits);
 | 
			
		||||
    }).join(",");
 | 
			
		||||
}
 | 
			
		||||
exports.ptToString = ptToString;
 | 
			
		||||
function midPoint(v1, v2) {
 | 
			
		||||
    return v1.clone().add(v2).multiplyScalar(0.5);
 | 
			
		||||
}
 | 
			
		||||
exports.midPoint = midPoint;
 | 
			
		||||
function midPoint2(v1, v2) {
 | 
			
		||||
    return v1.clone().add(v2).multiplyScalar(0.5);
 | 
			
		||||
}
 | 
			
		||||
exports.midPoint2 = midPoint2;
 | 
			
		||||
function midPtCir(v1, v2) {
 | 
			
		||||
    var baseline = new three_1.Vector3(1, 0, 0);
 | 
			
		||||
    var outLine = v2.clone().sub(v1);
 | 
			
		||||
    var ang = angleTo(baseline, outLine) / 2;
 | 
			
		||||
    var midLine = rotatePoint(outLine, -ang);
 | 
			
		||||
    return v1.clone().add(midLine);
 | 
			
		||||
}
 | 
			
		||||
exports.midPtCir = midPtCir;
 | 
			
		||||
/**
 | 
			
		||||
 * 获得Three对象的包围盒.
 | 
			
		||||
 * @param obj
 | 
			
		||||
 * @param [updateMatrix] 是否应该更新对象矩阵
 | 
			
		||||
 * @returns box
 | 
			
		||||
 */
 | 
			
		||||
function GetBox(obj, updateMatrix) {
 | 
			
		||||
    var box = new three_1.Box3();
 | 
			
		||||
    if (updateMatrix)
 | 
			
		||||
        obj.updateMatrixWorld(false);
 | 
			
		||||
    if (!obj.visible)
 | 
			
		||||
        return box;
 | 
			
		||||
    obj.traverse(function (o) {
 | 
			
		||||
        //因为实体Erase时,实体仍然保存在Scene中.
 | 
			
		||||
        if (o.visible === false)
 | 
			
		||||
            return;
 | 
			
		||||
        //@ts-ignore
 | 
			
		||||
        var geo = o.geometry;
 | 
			
		||||
        if (geo) {
 | 
			
		||||
            if (!geo.boundingBox)
 | 
			
		||||
                geo.computeBoundingBox();
 | 
			
		||||
            box.union(geo.boundingBox.clone().applyMatrix4(o.matrixWorld));
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    return box;
 | 
			
		||||
}
 | 
			
		||||
exports.GetBox = GetBox;
 | 
			
		||||
function GetBoxArr(arr) {
 | 
			
		||||
    var box = new three_1.Box3();
 | 
			
		||||
    for (var _i = 0, arr_1 = arr; _i < arr_1.length; _i++) {
 | 
			
		||||
        var o = arr_1[_i];
 | 
			
		||||
        var b = GetBox(o);
 | 
			
		||||
        if (!b.isEmpty())
 | 
			
		||||
            box.union(b);
 | 
			
		||||
    }
 | 
			
		||||
    return box;
 | 
			
		||||
}
 | 
			
		||||
exports.GetBoxArr = GetBoxArr;
 | 
			
		||||
function MoveMatrix(v) {
 | 
			
		||||
    var mat = new three_1.Matrix4();
 | 
			
		||||
    mat.makeTranslation(v.x, v.y, v.z);
 | 
			
		||||
    return mat;
 | 
			
		||||
}
 | 
			
		||||
exports.MoveMatrix = MoveMatrix;
 | 
			
		||||
function getProjectDist(v1, v2) {
 | 
			
		||||
    var ang = v1.angleTo(v2);
 | 
			
		||||
    var dist = v1.length();
 | 
			
		||||
    return {
 | 
			
		||||
        h: dist * Math.cos(ang),
 | 
			
		||||
        v: dist * Math.sin(ang)
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
exports.getProjectDist = getProjectDist;
 | 
			
		||||
//获得输入点在2线组成的4个区间的位置
 | 
			
		||||
function getPtPostion(sp, ep, c, inPt) {
 | 
			
		||||
    var l1 = sp.clone().sub(c);
 | 
			
		||||
    var l2 = ep.clone().sub(c);
 | 
			
		||||
    var l3 = l1.clone().negate();
 | 
			
		||||
    var l4 = l2.clone().negate();
 | 
			
		||||
    var inputLine = inPt.clone().sub(c);
 | 
			
		||||
    var ang1 = angleTo(l1, l2);
 | 
			
		||||
    var ang2 = Math.PI;
 | 
			
		||||
    var ang3 = ang2 + Math.abs(ang1);
 | 
			
		||||
    var inputAng = angleTo(l1, inputLine);
 | 
			
		||||
    if (ang1 * inputAng < 0) {
 | 
			
		||||
        inputAng = (Math.PI * 2 - Math.abs(inputAng));
 | 
			
		||||
    }
 | 
			
		||||
    ang1 = Math.abs(ang1);
 | 
			
		||||
    inputAng = Math.abs(inputAng);
 | 
			
		||||
    if (inputAng <= ang1) {
 | 
			
		||||
        return { sp: sp, ep: ep };
 | 
			
		||||
    }
 | 
			
		||||
    else if (inputAng > ang1 && inputAng <= ang2) {
 | 
			
		||||
        return { sp: c.clone().add(l3), ep: ep };
 | 
			
		||||
    }
 | 
			
		||||
    else if (inputAng > ang2 && inputAng <= ang3) {
 | 
			
		||||
        return { sp: c.clone().add(l3), ep: c.clone().add(l4) };
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
        return { sp: sp, ep: c.clone().add(l4) };
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
exports.getPtPostion = getPtPostion;
 | 
			
		||||
function angleAndX(v) {
 | 
			
		||||
    return v.x ? Math.atan(v.y / v.x) : Math.PI / 2;
 | 
			
		||||
}
 | 
			
		||||
exports.angleAndX = angleAndX;
 | 
			
		||||
/**
 | 
			
		||||
 * 将角度调整为0-2pi之间
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {number} an
 | 
			
		||||
 */
 | 
			
		||||
function angleTo2Pi(an) {
 | 
			
		||||
    an = an % (Math.PI * 2);
 | 
			
		||||
    if (an < 0)
 | 
			
		||||
        an += Math.PI * 2;
 | 
			
		||||
    return an;
 | 
			
		||||
}
 | 
			
		||||
exports.angleTo2Pi = angleTo2Pi;
 | 
			
		||||
function updateGeometry(l, geometry) {
 | 
			
		||||
    var geo = l.geometry;
 | 
			
		||||
    geo.dispose();
 | 
			
		||||
    l.geometry = geometry;
 | 
			
		||||
    geometry.verticesNeedUpdate = true;
 | 
			
		||||
    geometry.computeBoundingSphere();
 | 
			
		||||
}
 | 
			
		||||
exports.updateGeometry = updateGeometry;
 | 
			
		||||
//# sourceMappingURL=GeUtils.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/GeUtils.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/GeUtils.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										149
									
								
								dist/KeyEnum.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										149
									
								
								dist/KeyEnum.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,149 @@
 | 
			
		||||
export declare enum MouseKey {
 | 
			
		||||
    Left = 0,
 | 
			
		||||
    Middle = 1,
 | 
			
		||||
    Right = 2
 | 
			
		||||
}
 | 
			
		||||
export declare enum KeyBoard {
 | 
			
		||||
    Digit1 = 49,
 | 
			
		||||
    Digit2 = 50,
 | 
			
		||||
    Digit3 = 51,
 | 
			
		||||
    Digit4 = 52,
 | 
			
		||||
    Digit5 = 53,
 | 
			
		||||
    Digit6 = 54,
 | 
			
		||||
    Digit7 = 55,
 | 
			
		||||
    Digit8 = 56,
 | 
			
		||||
    Digit9 = 57,
 | 
			
		||||
    Digit0 = 58,
 | 
			
		||||
    KeyA = 65,
 | 
			
		||||
    KeyB = 66,
 | 
			
		||||
    KeyC = 67,
 | 
			
		||||
    KeyD = 68,
 | 
			
		||||
    KeyE = 69,
 | 
			
		||||
    KeyF = 70,
 | 
			
		||||
    KeyG = 71,
 | 
			
		||||
    KeyH = 72,
 | 
			
		||||
    KeyI = 73,
 | 
			
		||||
    KeyJ = 74,
 | 
			
		||||
    KeyK = 75,
 | 
			
		||||
    KeyL = 76,
 | 
			
		||||
    KeyM = 77,
 | 
			
		||||
    KeyN = 78,
 | 
			
		||||
    KeyO = 79,
 | 
			
		||||
    KeyP = 80,
 | 
			
		||||
    KeyQ = 81,
 | 
			
		||||
    KeyR = 82,
 | 
			
		||||
    KeyS = 83,
 | 
			
		||||
    KeyT = 84,
 | 
			
		||||
    KeyU = 85,
 | 
			
		||||
    KeyV = 86,
 | 
			
		||||
    KeyW = 87,
 | 
			
		||||
    KeyX = 88,
 | 
			
		||||
    KeyY = 89,
 | 
			
		||||
    KeyZ = 90,
 | 
			
		||||
    /**
 | 
			
		||||
     * 逗号
 | 
			
		||||
     */
 | 
			
		||||
    Comma = 188,
 | 
			
		||||
    CommaChrome = 229,
 | 
			
		||||
    /**
 | 
			
		||||
     * 句号
 | 
			
		||||
     */
 | 
			
		||||
    Period = 190,
 | 
			
		||||
    /**
 | 
			
		||||
     * 分号
 | 
			
		||||
     */
 | 
			
		||||
    Semicolon = 186,
 | 
			
		||||
    /**
 | 
			
		||||
     * 引号
 | 
			
		||||
     */
 | 
			
		||||
    Quote = 222,
 | 
			
		||||
    /**
 | 
			
		||||
     * 左括号
 | 
			
		||||
     */
 | 
			
		||||
    BracketLeft = 219,
 | 
			
		||||
    /**
 | 
			
		||||
     * 右括号
 | 
			
		||||
     */
 | 
			
		||||
    BracketRight = 220,
 | 
			
		||||
    /**
 | 
			
		||||
     * 反引号
 | 
			
		||||
     */
 | 
			
		||||
    Backquote = 192,
 | 
			
		||||
    /**
 | 
			
		||||
     * 反斜杠
 | 
			
		||||
     */
 | 
			
		||||
    Backslash = 220,
 | 
			
		||||
    /**
 | 
			
		||||
     * 减号
 | 
			
		||||
     */
 | 
			
		||||
    Minus = 189,
 | 
			
		||||
    /**
 | 
			
		||||
     * 等号
 | 
			
		||||
     */
 | 
			
		||||
    Equal = 187,
 | 
			
		||||
    IntlRo = 193,
 | 
			
		||||
    IntlYen = 255,
 | 
			
		||||
    Alt = 18,
 | 
			
		||||
    /**
 | 
			
		||||
     * 大写锁定
 | 
			
		||||
     */
 | 
			
		||||
    CapsLock = 20,
 | 
			
		||||
    Control = 17,
 | 
			
		||||
    /**
 | 
			
		||||
     * win左键
 | 
			
		||||
     */
 | 
			
		||||
    OSLeft = 91,
 | 
			
		||||
    /**
 | 
			
		||||
     * win右键
 | 
			
		||||
     */
 | 
			
		||||
    OSRight = 92,
 | 
			
		||||
    Shift = 16,
 | 
			
		||||
    ContextMenu = 93,
 | 
			
		||||
    Enter = 13,
 | 
			
		||||
    Space = 32,
 | 
			
		||||
    Backspace = 8,
 | 
			
		||||
    Tab = 9,
 | 
			
		||||
    Delete = 46,
 | 
			
		||||
    End = 35,
 | 
			
		||||
    Home = 36,
 | 
			
		||||
    Insert = 45,
 | 
			
		||||
    PageDown = 34,
 | 
			
		||||
    PageUp = 33,
 | 
			
		||||
    ArrowDown = 40,
 | 
			
		||||
    ArrowLeft = 37,
 | 
			
		||||
    ArrowRight = 39,
 | 
			
		||||
    ArrowUp = 38,
 | 
			
		||||
    Escape = 27,
 | 
			
		||||
    PrintScreen = 44,
 | 
			
		||||
    ScrollLock = 145,
 | 
			
		||||
    Pause = 19,
 | 
			
		||||
    F1 = 112,
 | 
			
		||||
    F2 = 113,
 | 
			
		||||
    F3 = 114,
 | 
			
		||||
    F5 = 116,
 | 
			
		||||
    F6 = 117,
 | 
			
		||||
    F7 = 118,
 | 
			
		||||
    F8 = 119,
 | 
			
		||||
    F9 = 120,
 | 
			
		||||
    F10 = 121,
 | 
			
		||||
    F11 = 122,
 | 
			
		||||
    F12 = 123,
 | 
			
		||||
    NumLock = 114,
 | 
			
		||||
    Numpad0 = 96,
 | 
			
		||||
    Numpad1 = 97,
 | 
			
		||||
    Numpad2 = 98,
 | 
			
		||||
    Numpad3 = 99,
 | 
			
		||||
    Numpad4 = 100,
 | 
			
		||||
    Numpad5 = 101,
 | 
			
		||||
    Numpad6 = 102,
 | 
			
		||||
    Numpad7 = 103,
 | 
			
		||||
    Numpad8 = 104,
 | 
			
		||||
    Numpad9 = 105,
 | 
			
		||||
    NumpadAdd = 107,
 | 
			
		||||
    NumpadDivide = 111,
 | 
			
		||||
    NumpadEqual = 12,
 | 
			
		||||
    NumpadMultiply = 106,
 | 
			
		||||
    NumpadSubtract = 109,
 | 
			
		||||
    NumpadDot = 110,
 | 
			
		||||
    NumpadDot1 = 190
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										161
									
								
								dist/KeyEnum.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										161
									
								
								dist/KeyEnum.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,161 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
//鼠标类型
 | 
			
		||||
var MouseKey;
 | 
			
		||||
(function (MouseKey) {
 | 
			
		||||
    MouseKey[MouseKey["Left"] = 0] = "Left";
 | 
			
		||||
    MouseKey[MouseKey["Middle"] = 1] = "Middle";
 | 
			
		||||
    MouseKey[MouseKey["Right"] = 2] = "Right";
 | 
			
		||||
})(MouseKey = exports.MouseKey || (exports.MouseKey = {}));
 | 
			
		||||
var KeyBoard;
 | 
			
		||||
(function (KeyBoard) {
 | 
			
		||||
    // 数字
 | 
			
		||||
    KeyBoard[KeyBoard["Digit1"] = 49] = "Digit1";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit2"] = 50] = "Digit2";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit3"] = 51] = "Digit3";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit4"] = 52] = "Digit4";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit5"] = 53] = "Digit5";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit6"] = 54] = "Digit6";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit7"] = 55] = "Digit7";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit8"] = 56] = "Digit8";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit9"] = 57] = "Digit9";
 | 
			
		||||
    KeyBoard[KeyBoard["Digit0"] = 58] = "Digit0";
 | 
			
		||||
    // 字母
 | 
			
		||||
    KeyBoard[KeyBoard["KeyA"] = 65] = "KeyA";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyB"] = 66] = "KeyB";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyC"] = 67] = "KeyC";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyD"] = 68] = "KeyD";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyE"] = 69] = "KeyE";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyF"] = 70] = "KeyF";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyG"] = 71] = "KeyG";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyH"] = 72] = "KeyH";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyI"] = 73] = "KeyI";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyJ"] = 74] = "KeyJ";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyK"] = 75] = "KeyK";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyL"] = 76] = "KeyL";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyM"] = 77] = "KeyM";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyN"] = 78] = "KeyN";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyO"] = 79] = "KeyO";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyP"] = 80] = "KeyP";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyQ"] = 81] = "KeyQ";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyR"] = 82] = "KeyR";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyS"] = 83] = "KeyS";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyT"] = 84] = "KeyT";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyU"] = 85] = "KeyU";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyV"] = 86] = "KeyV";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyW"] = 87] = "KeyW";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyX"] = 88] = "KeyX";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyY"] = 89] = "KeyY";
 | 
			
		||||
    KeyBoard[KeyBoard["KeyZ"] = 90] = "KeyZ";
 | 
			
		||||
    // 符号
 | 
			
		||||
    /**
 | 
			
		||||
     * 逗号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Comma"] = 188] = "Comma";
 | 
			
		||||
    KeyBoard[KeyBoard["CommaChrome"] = 229] = "CommaChrome";
 | 
			
		||||
    /**
 | 
			
		||||
     * 句号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Period"] = 190] = "Period";
 | 
			
		||||
    /**
 | 
			
		||||
     * 分号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Semicolon"] = 186] = "Semicolon";
 | 
			
		||||
    /**
 | 
			
		||||
     * 引号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Quote"] = 222] = "Quote";
 | 
			
		||||
    /**
 | 
			
		||||
     * 左括号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["BracketLeft"] = 219] = "BracketLeft";
 | 
			
		||||
    /**
 | 
			
		||||
     * 右括号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["BracketRight"] = 220] = "BracketRight";
 | 
			
		||||
    /**
 | 
			
		||||
     * 反引号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Backquote"] = 192] = "Backquote";
 | 
			
		||||
    /**
 | 
			
		||||
     * 反斜杠
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Backslash"] = 220] = "Backslash";
 | 
			
		||||
    /**
 | 
			
		||||
     * 减号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Minus"] = 189] = "Minus";
 | 
			
		||||
    /**
 | 
			
		||||
     * 等号
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["Equal"] = 187] = "Equal";
 | 
			
		||||
    KeyBoard[KeyBoard["IntlRo"] = 193] = "IntlRo";
 | 
			
		||||
    KeyBoard[KeyBoard["IntlYen"] = 255] = "IntlYen";
 | 
			
		||||
    // 功能键
 | 
			
		||||
    KeyBoard[KeyBoard["Alt"] = 18] = "Alt";
 | 
			
		||||
    /**
 | 
			
		||||
     * 大写锁定
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["CapsLock"] = 20] = "CapsLock";
 | 
			
		||||
    KeyBoard[KeyBoard["Control"] = 17] = "Control";
 | 
			
		||||
    /**
 | 
			
		||||
     * win左键
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["OSLeft"] = 91] = "OSLeft";
 | 
			
		||||
    /**
 | 
			
		||||
     * win右键
 | 
			
		||||
     */
 | 
			
		||||
    KeyBoard[KeyBoard["OSRight"] = 92] = "OSRight";
 | 
			
		||||
    KeyBoard[KeyBoard["Shift"] = 16] = "Shift";
 | 
			
		||||
    KeyBoard[KeyBoard["ContextMenu"] = 93] = "ContextMenu";
 | 
			
		||||
    KeyBoard[KeyBoard["Enter"] = 13] = "Enter";
 | 
			
		||||
    KeyBoard[KeyBoard["Space"] = 32] = "Space";
 | 
			
		||||
    KeyBoard[KeyBoard["Backspace"] = 8] = "Backspace";
 | 
			
		||||
    KeyBoard[KeyBoard["Tab"] = 9] = "Tab";
 | 
			
		||||
    KeyBoard[KeyBoard["Delete"] = 46] = "Delete";
 | 
			
		||||
    KeyBoard[KeyBoard["End"] = 35] = "End";
 | 
			
		||||
    KeyBoard[KeyBoard["Home"] = 36] = "Home";
 | 
			
		||||
    KeyBoard[KeyBoard["Insert"] = 45] = "Insert";
 | 
			
		||||
    KeyBoard[KeyBoard["PageDown"] = 34] = "PageDown";
 | 
			
		||||
    KeyBoard[KeyBoard["PageUp"] = 33] = "PageUp";
 | 
			
		||||
    KeyBoard[KeyBoard["ArrowDown"] = 40] = "ArrowDown";
 | 
			
		||||
    KeyBoard[KeyBoard["ArrowLeft"] = 37] = "ArrowLeft";
 | 
			
		||||
    KeyBoard[KeyBoard["ArrowRight"] = 39] = "ArrowRight";
 | 
			
		||||
    KeyBoard[KeyBoard["ArrowUp"] = 38] = "ArrowUp";
 | 
			
		||||
    KeyBoard[KeyBoard["Escape"] = 27] = "Escape";
 | 
			
		||||
    KeyBoard[KeyBoard["PrintScreen"] = 44] = "PrintScreen";
 | 
			
		||||
    KeyBoard[KeyBoard["ScrollLock"] = 145] = "ScrollLock";
 | 
			
		||||
    KeyBoard[KeyBoard["Pause"] = 19] = "Pause";
 | 
			
		||||
    // F数字
 | 
			
		||||
    KeyBoard[KeyBoard["F1"] = 112] = "F1";
 | 
			
		||||
    KeyBoard[KeyBoard["F2"] = 113] = "F2";
 | 
			
		||||
    KeyBoard[KeyBoard["F3"] = 114] = "F3";
 | 
			
		||||
    KeyBoard[KeyBoard["F5"] = 116] = "F5";
 | 
			
		||||
    KeyBoard[KeyBoard["F6"] = 117] = "F6";
 | 
			
		||||
    KeyBoard[KeyBoard["F7"] = 118] = "F7";
 | 
			
		||||
    KeyBoard[KeyBoard["F8"] = 119] = "F8";
 | 
			
		||||
    KeyBoard[KeyBoard["F9"] = 120] = "F9";
 | 
			
		||||
    KeyBoard[KeyBoard["F10"] = 121] = "F10";
 | 
			
		||||
    KeyBoard[KeyBoard["F11"] = 122] = "F11";
 | 
			
		||||
    KeyBoard[KeyBoard["F12"] = 123] = "F12";
 | 
			
		||||
    //数字键盘
 | 
			
		||||
    KeyBoard[KeyBoard["NumLock"] = 114] = "NumLock";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad0"] = 96] = "Numpad0";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad1"] = 97] = "Numpad1";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad2"] = 98] = "Numpad2";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad3"] = 99] = "Numpad3";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad4"] = 100] = "Numpad4";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad5"] = 101] = "Numpad5";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad6"] = 102] = "Numpad6";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad7"] = 103] = "Numpad7";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad8"] = 104] = "Numpad8";
 | 
			
		||||
    KeyBoard[KeyBoard["Numpad9"] = 105] = "Numpad9";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadAdd"] = 107] = "NumpadAdd";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadDivide"] = 111] = "NumpadDivide";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadEqual"] = 12] = "NumpadEqual";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadMultiply"] = 106] = "NumpadMultiply";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadSubtract"] = 109] = "NumpadSubtract";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadDot"] = 110] = "NumpadDot";
 | 
			
		||||
    KeyBoard[KeyBoard["NumpadDot1"] = 190] = "NumpadDot1";
 | 
			
		||||
})(KeyBoard = exports.KeyBoard || (exports.KeyBoard = {}));
 | 
			
		||||
//# sourceMappingURL=KeyEnum.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/KeyEnum.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/KeyEnum.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"KeyEnum.js","sourceRoot":"","sources":["../src/KeyEnum.ts"],"names":[],"mappings":";;AAAA,MAAM;AACN,IAAY,QAKX;AALD,WAAY,QAAQ;IAEhB,uCAAQ,CAAA;IACR,2CAAU,CAAA;IACV,yCAAS,CAAA;AACb,CAAC,EALW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAKnB;AAED,IAAY,QA2JX;AA3JD,WAAY,QAAQ;IAEhB,KAAK;IACL,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,4CAAW,CAAA;IACX,KAAK;IACL,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IACT,wCAAS,CAAA;IAET,KAAK;IACL;;OAEG;IACH,2CAAW,CAAA;IACX,uDAAiB,CAAA;IACjB;;OAEG;IACH,6CAAY,CAAA;IACZ;;OAEG;IACH,mDAAe,CAAA;IACf;;OAEG;IACH,2CAAW,CAAA;IACX;;OAEG;IACH,uDAAiB,CAAA;IACjB;;OAEG;IACH,yDAAkB,CAAA;IAClB;;OAEG;IACH,mDAAe,CAAA;IACf;;OAEG;IACH,mDAAe,CAAA;IACf;;OAEG;IACH,2CAAW,CAAA;IACX;;OAEG;IACH,2CAAW,CAAA;IACX,6CAAY,CAAA;IACZ,+CAAa,CAAA;IACb,MAAM;IACN,sCAAQ,CAAA;IACR;;OAEG;IACH,gDAAa,CAAA;IACb,8CAAY,CAAA;IACZ;;OAEG;IACH,4CAAW,CAAA;IACX;;OAEG;IACH,8CAAY,CAAA;IACZ,0CAAU,CAAA;IAEV,sDAAgB,CAAA;IAChB,0CAAU,CAAA;IACV,0CAAU,CAAA;IACV,iDAAa,CAAA;IACb,qCAAO,CAAA;IACP,4CAAW,CAAA;IACX,sCAAQ,CAAA;IACR,wCAAS,CAAA;IACT,4CAAW,CAAA;IACX,gDAAa,CAAA;IACb,4CAAW,CAAA;IACX,kDAAc,CAAA;IACd,kDAAc,CAAA;IACd,oDAAe,CAAA;IACf,8CAAY,CAAA;IACZ,4CAAW,CAAA;IACX,sDAAgB,CAAA;IAChB,qDAAgB,CAAA;IAChB,0CAAU,CAAA;IAEV,MAAM;IACN,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,qCAAQ,CAAA;IACR,uCAAS,CAAA;IACT,uCAAS,CAAA;IACT,uCAAS,CAAA;IAET,MAAM;IACN,+CAAa,CAAA;IACb,8CAAY,CAAA;IACZ,8CAAY,CAAA;IACZ,8CAAY,CAAA;IACZ,8CAAY,CAAA;IACZ,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,+CAAa,CAAA;IACb,mDAAe,CAAA;IACf,yDAAkB,CAAA;IAClB,sDAAgB,CAAA;IAChB,6DAAoB,CAAA;IACpB,6DAAoB,CAAA;IACpB,mDAAe,CAAA;IACf,qDAAgB,CAAA;AAEpB,CAAC,EA3JW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QA2JnB"}
 | 
			
		||||
							
								
								
									
										4
									
								
								dist/Material.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								dist/Material.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,4 @@
 | 
			
		||||
import { MeshBasicMaterial, LineBasicMaterial } from "three";
 | 
			
		||||
export declare let boardMaterial: MeshBasicMaterial;
 | 
			
		||||
export declare let selectMaterial: MeshBasicMaterial;
 | 
			
		||||
export declare let edgeMaterial: LineBasicMaterial;
 | 
			
		||||
							
								
								
									
										19
									
								
								dist/Material.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										19
									
								
								dist/Material.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,19 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
//板件的材质,使用这个材质避免板件将线覆盖.
 | 
			
		||||
exports.boardMaterial = new three_1.MeshBasicMaterial({
 | 
			
		||||
    color: new three_1.Color(0.8, 0.8, 0.8),
 | 
			
		||||
    polygonOffset: true,
 | 
			
		||||
    polygonOffsetFactor: 1,
 | 
			
		||||
    polygonOffsetUnits: 1
 | 
			
		||||
});
 | 
			
		||||
exports.selectMaterial = new three_1.MeshBasicMaterial({
 | 
			
		||||
    color: new three_1.Color(0.1, 0.5, 0.5),
 | 
			
		||||
    polygonOffset: true,
 | 
			
		||||
    polygonOffsetFactor: 1,
 | 
			
		||||
    polygonOffsetUnits: 1
 | 
			
		||||
});
 | 
			
		||||
//线框的材质
 | 
			
		||||
exports.edgeMaterial = new three_1.LineBasicMaterial({ linewidth: 2, color: new three_1.Color(0, 0, 0) });
 | 
			
		||||
//# sourceMappingURL=Material.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Material.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Material.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Material.js","sourceRoot":"","sources":["../src/Material.ts"],"names":[],"mappings":";;AAAA,+BAAoE;AAEpE,uBAAuB;AACZ,QAAA,aAAa,GAAG,IAAI,yBAAiB,CAAC;IAC7C,KAAK,EAAE,IAAI,aAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/B,aAAa,EAAE,IAAI;IACnB,mBAAmB,EAAE,CAAC;IACtB,kBAAkB,EAAE,CAAC;CACxB,CAAC,CAAC;AAEQ,QAAA,cAAc,GAAG,IAAI,yBAAiB,CAAC;IAC9C,KAAK,EAAE,IAAI,aAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IAC/B,aAAa,EAAE,IAAI;IACnB,mBAAmB,EAAE,CAAC;IACtB,kBAAkB,EAAE,CAAC;CACxB,CAAC,CAAC;AAEH,OAAO;AACI,QAAA,YAAY,GAAG,IAAI,yBAAiB,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,aAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC"}
 | 
			
		||||
							
								
								
									
										7
									
								
								dist/Matrix2.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								dist/Matrix2.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
import { Vector2, Vector3 } from "three";
 | 
			
		||||
export declare class Matrix2 {
 | 
			
		||||
    private el;
 | 
			
		||||
    set(n11: number, n12: number, n21: number, n22: number): this;
 | 
			
		||||
    applyVector(vec: Vector2 | Vector3): this;
 | 
			
		||||
    setRotate(theta: number): Matrix2;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										31
									
								
								dist/Matrix2.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								dist/Matrix2.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var Matrix2 = /** @class */ (function () {
 | 
			
		||||
    function Matrix2() {
 | 
			
		||||
        this.el = [1, 0, 0, 1];
 | 
			
		||||
    }
 | 
			
		||||
    Matrix2.prototype.set = function (n11, n12, n21, n22) {
 | 
			
		||||
        var te = this.el;
 | 
			
		||||
        te[0] = n11;
 | 
			
		||||
        te[1] = n21;
 | 
			
		||||
        te[2] = n12;
 | 
			
		||||
        te[3] = n22;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Matrix2.prototype.applyVector = function (vec) {
 | 
			
		||||
        var x = vec.x, y = vec.y;
 | 
			
		||||
        var e = this.el;
 | 
			
		||||
        vec.x = e[0] * x + e[2] * y;
 | 
			
		||||
        vec.y = e[1] * x + e[3] * y;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Matrix2.prototype.setRotate = function (theta) {
 | 
			
		||||
        var el = this.el;
 | 
			
		||||
        var c = Math.cos(theta), s = Math.sin(theta);
 | 
			
		||||
        this.set(c, -s, s, c);
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    return Matrix2;
 | 
			
		||||
}());
 | 
			
		||||
exports.Matrix2 = Matrix2;
 | 
			
		||||
//# sourceMappingURL=Matrix2.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Matrix2.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Matrix2.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Matrix2.js","sourceRoot":"","sources":["../src/Matrix2.ts"],"names":[],"mappings":";;AAEA;IAAA;QAEY,OAAE,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IA4B9B,CAAC;IA3BG,qBAAG,GAAH,UAAI,GAAW,EAAE,GAAW,EAAE,GAAW,EAAE,GAAW;QAElD,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QAEjB,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACzB,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QAAC,EAAE,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,6BAAW,GAAX,UAAY,GAAsB;QAE9B,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACzB,IAAI,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;QAChB,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAC5B,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QAE5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,2BAAS,GAAT,UAAU,KAAa;QAEnB,IAAI,EAAE,GAAG,IAAI,CAAC,EAAE,CAAC;QACjB,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAE7C,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACV,CAAC,EAAE,CAAC,CAAC,CAAC;QACV,OAAO,IAAI,CAAC;IAChB,CAAC;IACL,cAAC;AAAD,CAAC,AA9BD,IA8BC;AA9BY,0BAAO"}
 | 
			
		||||
							
								
								
									
										39
									
								
								dist/Orbit.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								dist/Orbit.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
import { Vector3 } from "three";
 | 
			
		||||
/**
 | 
			
		||||
 * 轨道控制的数学类,观察向量和角度的互相转换
 | 
			
		||||
 * 当x当抬头或者低头到90度时,触发万向锁.
 | 
			
		||||
 *
 | 
			
		||||
 * @class Orbit
 | 
			
		||||
 */
 | 
			
		||||
export declare class Orbit {
 | 
			
		||||
    private m_RoX;
 | 
			
		||||
    RoZ: number;
 | 
			
		||||
    get RoX(): number;
 | 
			
		||||
    set RoX(v: number);
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用旋转角度 计算观察向量
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} [dir] 引用传入,如果传入,那么就不构造新的向量
 | 
			
		||||
     * @returns {Vector3} 返回观察向量
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    UpdateDirection(dir?: Vector3): Vector3;
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用观察向量,计算旋转角度
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    UpdateRoValue(dir: Vector3): void;
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * 根据观察向量 求头部的向量.
 | 
			
		||||
     *
 | 
			
		||||
     * @static
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @param {Vector3} [up]
 | 
			
		||||
     * @returns {Vector3}
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    static ComputUpDirection(dir: Vector3, up?: Vector3): Vector3;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										86
									
								
								dist/Orbit.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										86
									
								
								dist/Orbit.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,86 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
/**
 | 
			
		||||
 * 轨道控制的数学类,观察向量和角度的互相转换
 | 
			
		||||
 * 当x当抬头或者低头到90度时,触发万向锁.
 | 
			
		||||
 *
 | 
			
		||||
 * @class Orbit
 | 
			
		||||
 */
 | 
			
		||||
var Orbit = /** @class */ (function () {
 | 
			
		||||
    function Orbit() {
 | 
			
		||||
        //抬头低头 正数抬头 负数低头
 | 
			
		||||
        this.m_RoX = 0;
 | 
			
		||||
        //身体旋转 0为正右边 逆时针旋转
 | 
			
		||||
        this.RoZ = 0;
 | 
			
		||||
    }
 | 
			
		||||
    Object.defineProperty(Orbit.prototype, "RoX", {
 | 
			
		||||
        get: function () {
 | 
			
		||||
            return this.m_RoX;
 | 
			
		||||
        },
 | 
			
		||||
        set: function (v) {
 | 
			
		||||
            this.m_RoX = three_1.MathUtils.clamp(v, Math.PI * -0.5, Math.PI * 0.5);
 | 
			
		||||
        },
 | 
			
		||||
        enumerable: true,
 | 
			
		||||
        configurable: true
 | 
			
		||||
    });
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用旋转角度 计算观察向量
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} [dir] 引用传入,如果传入,那么就不构造新的向量
 | 
			
		||||
     * @returns {Vector3} 返回观察向量
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    Orbit.prototype.UpdateDirection = function (dir) {
 | 
			
		||||
        var rtDir = dir ? dir : new three_1.Vector3();
 | 
			
		||||
        rtDir.z = Math.sin(this.m_RoX);
 | 
			
		||||
        //归一化专用.
 | 
			
		||||
        var d = Math.abs(Math.cos(this.m_RoX));
 | 
			
		||||
        rtDir.x = Math.cos(this.RoZ) * d;
 | 
			
		||||
        rtDir.y = Math.sin(this.RoZ) * d;
 | 
			
		||||
        return rtDir;
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用观察向量,计算旋转角度
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    Orbit.prototype.UpdateRoValue = function (dir) {
 | 
			
		||||
        dir.normalize();
 | 
			
		||||
        this.m_RoX = Math.asin(dir.z);
 | 
			
		||||
        if (dir.x < 1e-4 && dir.y < 1e-4)
 | 
			
		||||
            this.RoZ = Math.PI * 0.5;
 | 
			
		||||
        else
 | 
			
		||||
            this.RoZ = Math.atan2(dir.y, dir.x);
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * 根据观察向量 求头部的向量.
 | 
			
		||||
     *
 | 
			
		||||
     * @static
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @param {Vector3} [up]
 | 
			
		||||
     * @returns {Vector3}
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    Orbit.ComputUpDirection = function (dir, up) {
 | 
			
		||||
        var upRes = up ? up : new three_1.Vector3();
 | 
			
		||||
        if (dir.equals(new three_1.Vector3(0, 0, -1))) {
 | 
			
		||||
            upRes.set(0, 1, 0);
 | 
			
		||||
        }
 | 
			
		||||
        else if (dir.equals(new three_1.Vector3(0, 0, 1))) {
 | 
			
		||||
            upRes.set(0, -1, 0);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            var xv = new three_1.Vector3();
 | 
			
		||||
            xv.crossVectors(new three_1.Vector3(0, 0, 1), dir);
 | 
			
		||||
            upRes.crossVectors(dir, xv);
 | 
			
		||||
            upRes.normalize();
 | 
			
		||||
        }
 | 
			
		||||
        return upRes;
 | 
			
		||||
    };
 | 
			
		||||
    return Orbit;
 | 
			
		||||
}());
 | 
			
		||||
exports.Orbit = Orbit;
 | 
			
		||||
//# sourceMappingURL=Orbit.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Orbit.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Orbit.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Orbit.js","sourceRoot":"","sources":["../src/Orbit.ts"],"names":[],"mappings":";;AAAA,+BAA2C;AAE3C;;;;;GAKG;AACH;IAAA;QAEI,gBAAgB;QACR,UAAK,GAAW,CAAC,CAAC;QAE1B,kBAAkB;QAClB,QAAG,GAAW,CAAC,CAAC;IA+EpB,CAAC;IA7EG,sBAAI,sBAAG;aAAP;YAEI,OAAO,IAAI,CAAC,KAAK,CAAC;QACtB,CAAC;aACD,UAAQ,CAAC;YAEL,IAAI,CAAC,KAAK,GAAG,iBAAS,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC,CAAC;QACnE,CAAC;;;OAJA;IAMD;;;;;;OAMG;IACH,+BAAe,GAAf,UAAgB,GAAa;QAEzB,IAAI,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,eAAO,EAAE,CAAC;QAEtC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QAE/B,QAAQ;QACR,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QAEvC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACjC,KAAK,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAEjC,OAAO,KAAK,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,6BAAa,GAAb,UAAc,GAAY;QAEtB,GAAG,CAAC,SAAS,EAAE,CAAC;QAChB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI;YAC5B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,EAAE,GAAG,GAAG,CAAC;;YAEzB,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC;IAC5C,CAAC;IAED;;;;;;;;;OASG;IACI,uBAAiB,GAAxB,UAAyB,GAAY,EAAE,EAAY;QAE/C,IAAI,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,eAAO,EAAE,CAAC;QACpC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EACrC;YACI,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;SACtB;aACI,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EACzC;YACI,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;SACvB;aAED;YACI,IAAI,EAAE,GAAG,IAAI,eAAO,EAAE,CAAC;YACvB,EAAE,CAAC,YAAY,CAAC,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;YAC3C,KAAK,CAAC,YAAY,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YAC5B,KAAK,CAAC,SAAS,EAAE,CAAC;SACrB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IACL,YAAC;AAAD,CAAC,AArFD,IAqFC;AArFY,sBAAK"}
 | 
			
		||||
							
								
								
									
										7
									
								
								dist/PlaneExt.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								dist/PlaneExt.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { Vector3, Line3, Plane } from "three";
 | 
			
		||||
export declare class PlaneExt extends Plane {
 | 
			
		||||
    constructor(normal?: Vector3, constant?: number);
 | 
			
		||||
    intersectLine(line: Line3, optionalTarget?: Vector3, extendLine?: boolean): Vector3;
 | 
			
		||||
    intersectRay(ray: THREE.Ray, optionalTarget?: Vector3, extendLine?: boolean): Vector3;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										51
									
								
								dist/PlaneExt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										51
									
								
								dist/PlaneExt.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,51 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __extends = (this && this.__extends) || (function () {
 | 
			
		||||
    var extendStatics = function (d, b) {
 | 
			
		||||
        extendStatics = Object.setPrototypeOf ||
 | 
			
		||||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
 | 
			
		||||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
 | 
			
		||||
        return extendStatics(d, b);
 | 
			
		||||
    };
 | 
			
		||||
    return function (d, b) {
 | 
			
		||||
        extendStatics(d, b);
 | 
			
		||||
        function __() { this.constructor = d; }
 | 
			
		||||
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var THREE = require("three");
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var PlaneExt = /** @class */ (function (_super) {
 | 
			
		||||
    __extends(PlaneExt, _super);
 | 
			
		||||
    function PlaneExt(normal, constant) {
 | 
			
		||||
        return _super.call(this, normal, constant) || this;
 | 
			
		||||
    }
 | 
			
		||||
    PlaneExt.prototype.intersectLine = function (line, optionalTarget, extendLine) {
 | 
			
		||||
        var v1 = new three_1.Vector3();
 | 
			
		||||
        var result = optionalTarget || new three_1.Vector3();
 | 
			
		||||
        var direction = line.delta(v1);
 | 
			
		||||
        var denominator = this.normal.dot(direction);
 | 
			
		||||
        if (denominator === 0) {
 | 
			
		||||
            // line is coplanar, return origin
 | 
			
		||||
            if (this.distanceToPoint(line.start) === 0) {
 | 
			
		||||
                return result.copy(line.start);
 | 
			
		||||
            }
 | 
			
		||||
            // Unsure if this is the correct method to handle this case.
 | 
			
		||||
            return undefined;
 | 
			
		||||
        }
 | 
			
		||||
        var t = -(line.start.dot(this.normal) + this.constant) / denominator;
 | 
			
		||||
        //If you not extendLine,check intersect point in Line
 | 
			
		||||
        if (!extendLine && (t < 0 || t > 1)) {
 | 
			
		||||
            return undefined;
 | 
			
		||||
        }
 | 
			
		||||
        return result.copy(direction).multiplyScalar(t).add(line.start);
 | 
			
		||||
    };
 | 
			
		||||
    PlaneExt.prototype.intersectRay = function (ray, optionalTarget, extendLine) {
 | 
			
		||||
        // 从射线初始位置
 | 
			
		||||
        var line = new THREE.Line3(ray.origin.clone(), ray.origin.clone().add(ray.direction));
 | 
			
		||||
        return this.intersectLine(line, optionalTarget, extendLine);
 | 
			
		||||
    };
 | 
			
		||||
    return PlaneExt;
 | 
			
		||||
}(three_1.Plane));
 | 
			
		||||
exports.PlaneExt = PlaneExt;
 | 
			
		||||
//# sourceMappingURL=PlaneExt.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/PlaneExt.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/PlaneExt.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"PlaneExt.js","sourceRoot":"","sources":["../src/PlaneExt.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6BAA+B;AAC/B,+BAA8C;AAE9C;IAA8B,4BAAK;IAE/B,kBAAY,MAAgB,EAAE,QAAiB;eAE3C,kBAAM,MAAM,EAAE,QAAQ,CAAC;IAC3B,CAAC;IACD,gCAAa,GAAb,UAAc,IAAW,EAAE,cAAwB,EAAE,UAAoB;QAErE,IAAI,EAAE,GAAG,IAAI,eAAO,EAAE,CAAC;QAEvB,IAAI,MAAM,GAAG,cAAc,IAAI,IAAI,eAAO,EAAE,CAAC;QAE7C,IAAI,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAE/B,IAAI,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAE7C,IAAI,WAAW,KAAK,CAAC,EACrB;YACI,kCAAkC;YAClC,IAAI,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAC1C;gBACI,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aAClC;YACD,4DAA4D;YAC5D,OAAO,SAAS,CAAC;SACpB;QAED,IAAI,CAAC,GAAG,CAAE,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,WAAW,CAAC;QACtE,qDAAqD;QACrD,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EACnC;YACI,OAAO,SAAS,CAAC;SACpB;QAED,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC;IACD,+BAAY,GAAZ,UAAa,GAAc,EAAE,cAAwB,EAAE,UAAoB;QAEvE,UAAU;QACV,IAAI,IAAI,GAAG,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC;QACtF,OAAO,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IAChE,CAAC;IACL,eAAC;AAAD,CAAC,AA1CD,CAA8B,aAAK,GA0ClC;AA1CY,4BAAQ"}
 | 
			
		||||
							
								
								
									
										12
									
								
								dist/PointPick.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								dist/PointPick.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
import { Mesh } from "three";
 | 
			
		||||
import { Viewer } from ".";
 | 
			
		||||
/**
 | 
			
		||||
 * 点选
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Viewer} view
 | 
			
		||||
 * @param {number} ptx
 | 
			
		||||
 * @param {number} pty
 | 
			
		||||
 * @returns {(Mesh | undefined)}
 | 
			
		||||
 */
 | 
			
		||||
export declare function PointPick(view: Viewer, ptx: number, pty: number): Mesh | undefined;
 | 
			
		||||
							
								
								
									
										39
									
								
								dist/PointPick.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								dist/PointPick.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,39 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
/**
 | 
			
		||||
 * 点选
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Viewer} view
 | 
			
		||||
 * @param {number} ptx
 | 
			
		||||
 * @param {number} pty
 | 
			
		||||
 * @returns {(Mesh | undefined)}
 | 
			
		||||
 */
 | 
			
		||||
function PointPick(view, ptx, pty) {
 | 
			
		||||
    var raycaster = new three_1.Raycaster();
 | 
			
		||||
    raycaster.setFromCamera({
 | 
			
		||||
        x: (ptx / view._Width) * 2 - 1,
 | 
			
		||||
        y: -(pty / view._Height) * 2 + 1 //y轴相反
 | 
			
		||||
    }, view.m_Camera.Camera);
 | 
			
		||||
    //https://github.com/mrdoob/three.js/issues/14128
 | 
			
		||||
    raycaster.ray.origin.set((ptx / view._Width) * 2 - 1, -(pty / view._Height) * 2 + 1, -1).unproject(view.m_Camera.Camera);
 | 
			
		||||
    var minDis = Infinity;
 | 
			
		||||
    var minObj = undefined;
 | 
			
		||||
    view.m_Scene.children.forEach(function (obj) {
 | 
			
		||||
        if (obj instanceof three_1.Mesh) {
 | 
			
		||||
            var intersects = [];
 | 
			
		||||
            obj.raycast(raycaster, intersects);
 | 
			
		||||
            for (var _i = 0, intersects_1 = intersects; _i < intersects_1.length; _i++) {
 | 
			
		||||
                var i = intersects_1[_i];
 | 
			
		||||
                if (i.distance < minDis) {
 | 
			
		||||
                    minObj = obj;
 | 
			
		||||
                    minDis = i.distance;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    return minObj;
 | 
			
		||||
}
 | 
			
		||||
exports.PointPick = PointPick;
 | 
			
		||||
//# sourceMappingURL=PointPick.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/PointPick.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/PointPick.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"PointPick.js","sourceRoot":"","sources":["../src/PointPick.ts"],"names":[],"mappings":";;AAAA,+BAA2E;AAc3E;;;;;;;;GAQG;AACH,SAAgB,SAAS,CAAC,IAAY,EAAE,GAAW,EAAE,GAAW;IAE5D,IAAI,SAAS,GAAG,IAAI,iBAAS,EAAE,CAAC;IAChC,SAAS,CAAC,aAAa,CAAC;QACpB,CAAC,EAAE,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;QAC9B,CAAC,EAAE,CAAE,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM;KAC3C,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAEzB,iDAAiD;IACjD,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAE,CAAC,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAG1H,IAAI,MAAM,GAAG,QAAQ,CAAC;IACtB,IAAI,MAAM,GAAG,SAAS,CAAC;IAEvB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,GAAG;QAE7B,IAAI,GAAG,YAAY,YAAI,EACvB;YACI,IAAI,UAAU,GAAgB,EAAE,CAAC;YACjC,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;YAEnC,KAAc,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EACxB;gBADK,IAAI,CAAC,mBAAA;gBAEN,IAAI,CAAC,CAAC,QAAQ,GAAG,MAAM,EACvB;oBACI,MAAM,GAAG,GAAG,CAAC;oBACb,MAAM,GAAG,CAAC,CAAC,QAAQ,CAAC;iBACvB;aACJ;SACJ;IACL,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAClB,CAAC;AAlCD,8BAkCC"}
 | 
			
		||||
							
								
								
									
										2
									
								
								dist/RotateUV.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								dist/RotateUV.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
import { Geometry } from 'three';
 | 
			
		||||
export declare function RotateUVs(geo: Geometry): void;
 | 
			
		||||
							
								
								
									
										23
									
								
								dist/RotateUV.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								dist/RotateUV.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var Matrix2_1 = require("./Matrix2");
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
function RotateUVs(geo) {
 | 
			
		||||
    var roMat = new Matrix2_1.Matrix2();
 | 
			
		||||
    roMat.set(0, -1, 1, 0);
 | 
			
		||||
    var addV = new three_1.Vector2(1, 0);
 | 
			
		||||
    for (var _i = 0, _a = geo.faceVertexUvs; _i < _a.length; _i++) {
 | 
			
		||||
        var uvs = _a[_i];
 | 
			
		||||
        for (var _b = 0, uvs_1 = uvs; _b < uvs_1.length; _b++) {
 | 
			
		||||
            var uv = uvs_1[_b];
 | 
			
		||||
            for (var _c = 0, uv_1 = uv; _c < uv_1.length; _c++) {
 | 
			
		||||
                var v = uv_1[_c];
 | 
			
		||||
                roMat.applyVector(v);
 | 
			
		||||
                v.add(addV);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    geo.uvsNeedUpdate = true;
 | 
			
		||||
}
 | 
			
		||||
exports.RotateUVs = RotateUVs;
 | 
			
		||||
//# sourceMappingURL=RotateUV.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/RotateUV.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/RotateUV.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"RotateUV.js","sourceRoot":"","sources":["../src/RotateUV.ts"],"names":[],"mappings":";;AAAA,qCAAoC;AACpC,+BAA0C;AAG1C,SAAgB,SAAS,CAAC,GAAa;IAEnC,IAAI,KAAK,GAAG,IAAI,iBAAO,EAAE,CAAC;IAC1B,KAAK,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EACX,CAAC,EAAE,CAAC,CAAC,CAAC;IAEV,IAAI,IAAI,GAAG,IAAI,eAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IAE7B,KAAgB,UAAiB,EAAjB,KAAA,GAAG,CAAC,aAAa,EAAjB,cAAiB,EAAjB,IAAiB,EACjC;QADK,IAAI,GAAG,SAAA;QAER,KAAe,UAAG,EAAH,WAAG,EAAH,iBAAG,EAAH,IAAG,EAClB;YADK,IAAI,EAAE,YAAA;YAEP,KAAc,UAAE,EAAF,SAAE,EAAF,gBAAE,EAAF,IAAE,EAChB;gBADK,IAAI,CAAC,WAAA;gBAEN,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;gBACrB,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;aACf;SACJ;KACJ;IACD,GAAG,CAAC,aAAa,GAAG,IAAI,CAAC;AAC7B,CAAC;AApBD,8BAoBC"}
 | 
			
		||||
							
								
								
									
										11
									
								
								dist/Text.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								dist/Text.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,11 @@
 | 
			
		||||
import { Mesh } from "three";
 | 
			
		||||
export declare class DbText extends Mesh {
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * 构造一个文本对象,8位点(中心点下面)在0点
 | 
			
		||||
     * @param {string} str 数字字符串
 | 
			
		||||
     * @param {number} height 文本高度
 | 
			
		||||
     * @memberof DbText
 | 
			
		||||
     */
 | 
			
		||||
    constructor(str: string, height?: number);
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										56
									
								
								dist/Text.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								dist/Text.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,56 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
var __extends = (this && this.__extends) || (function () {
 | 
			
		||||
    var extendStatics = function (d, b) {
 | 
			
		||||
        extendStatics = Object.setPrototypeOf ||
 | 
			
		||||
            ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
 | 
			
		||||
            function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
 | 
			
		||||
        return extendStatics(d, b);
 | 
			
		||||
    };
 | 
			
		||||
    return function (d, b) {
 | 
			
		||||
        extendStatics(d, b);
 | 
			
		||||
        function __() { this.constructor = d; }
 | 
			
		||||
        d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
 | 
			
		||||
    };
 | 
			
		||||
})();
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var ColorPalette_1 = require("./ColorPalette");
 | 
			
		||||
var GeUtils_1 = require("./GeUtils");
 | 
			
		||||
var FontLoaderUtil = /** @class */ (function () {
 | 
			
		||||
    function FontLoaderUtil() {
 | 
			
		||||
    }
 | 
			
		||||
    FontLoaderUtil.Load = function () {
 | 
			
		||||
        if (!this.defFont) {
 | 
			
		||||
            var f = require("../resources/fonts/helvetiker_regular.typeface.json");
 | 
			
		||||
            var loader = new three_1.FontLoader();
 | 
			
		||||
            this.defFont = loader.parse(f);
 | 
			
		||||
        }
 | 
			
		||||
        return this.defFont;
 | 
			
		||||
    };
 | 
			
		||||
    return FontLoaderUtil;
 | 
			
		||||
}());
 | 
			
		||||
var DbText = /** @class */ (function (_super) {
 | 
			
		||||
    __extends(DbText, _super);
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * 构造一个文本对象,8位点(中心点下面)在0点
 | 
			
		||||
     * @param {string} str 数字字符串
 | 
			
		||||
     * @param {number} height 文本高度
 | 
			
		||||
     * @memberof DbText
 | 
			
		||||
     */
 | 
			
		||||
    function DbText(str, height) {
 | 
			
		||||
        if (height === void 0) { height = 5; }
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        var font = FontLoaderUtil.Load();
 | 
			
		||||
        var shapes = font.generateShapes(str, height);
 | 
			
		||||
        var geometry = new three_1.ShapeGeometry(shapes);
 | 
			
		||||
        geometry.computeBoundingBox();
 | 
			
		||||
        _this = _super.call(this, geometry, ColorPalette_1.ColorMaterial.GetBasicMaterial(5)) || this;
 | 
			
		||||
        var center = geometry.boundingBox.getCenter(new three_1.Vector3());
 | 
			
		||||
        _this.applyMatrix4(GeUtils_1.MoveMatrix(new three_1.Vector3(-center.x, 0, 0)));
 | 
			
		||||
        return _this;
 | 
			
		||||
    }
 | 
			
		||||
    return DbText;
 | 
			
		||||
}(three_1.Mesh));
 | 
			
		||||
exports.DbText = DbText;
 | 
			
		||||
//# sourceMappingURL=Text.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Text.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Text.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Text.js","sourceRoot":"","sources":["../src/Text.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+BAA8E;AAC9E,+CAA+C;AAC/C,qCAAuC;AAEvC;IAAA;IAaA,CAAC;IAVQ,mBAAI,GAAX;QAEE,IAAI,CAAC,IAAI,CAAC,OAAO,EACjB;YACE,IAAM,CAAC,GAAG,OAAO,CAAC,qDAAqD,CAAC,CAAC;YACzE,IAAI,MAAM,GAAG,IAAI,kBAAU,EAAE,CAAC;YAC9B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;SAChC;QACD,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IACH,qBAAC;AAAD,CAAC,AAbD,IAaC;AAED;IAA4B,0BAAI;IAE9B;;;;;;OAMG;IACH,gBAAY,GAAW,EAAE,MAAkB;QAAlB,uBAAA,EAAA,UAAkB;QAA3C,iBAaC;QAXC,IAAI,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,CAAC;QAEjC,IAAI,MAAM,GAAkB,IAAI,CAAC,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAC7D,IAAI,QAAQ,GAAG,IAAI,qBAAa,CAAC,MAAM,CAAC,CAAC;QAEzC,QAAQ,CAAC,kBAAkB,EAAE,CAAC;QAE9B,QAAA,kBAAM,QAAQ,EAAE,4BAAa,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,SAAC;QAEnD,IAAI,MAAM,GAAG,QAAQ,CAAC,WAAW,CAAC,SAAS,CAAC,IAAI,eAAO,EAAE,CAAC,CAAC;QAC3D,KAAI,CAAC,YAAY,CAAC,oBAAU,CAAC,IAAI,eAAO,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;;IAC9D,CAAC;IACH,aAAC;AAAD,CAAC,AAvBD,CAA4B,YAAI,GAuB/B;AAvBY,wBAAM"}
 | 
			
		||||
							
								
								
									
										58
									
								
								dist/ThreeCSG.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								dist/ThreeCSG.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,58 @@
 | 
			
		||||
import * as THREE from "three";
 | 
			
		||||
export declare class ThreeBSP {
 | 
			
		||||
    tree: Node;
 | 
			
		||||
    matrix: THREE.Matrix4;
 | 
			
		||||
    Node: typeof Node;
 | 
			
		||||
    Vertex: typeof Vertex;
 | 
			
		||||
    Polygon: typeof Polygon;
 | 
			
		||||
    constructor(geometry: any);
 | 
			
		||||
    subtract(other_tree: any): ThreeBSP;
 | 
			
		||||
    union(other_tree: any): ThreeBSP;
 | 
			
		||||
    intersect(other_tree: any): ThreeBSP;
 | 
			
		||||
    toGeometry(): THREE.Geometry;
 | 
			
		||||
    toMesh(material: any): THREE.Mesh;
 | 
			
		||||
}
 | 
			
		||||
export declare class Polygon {
 | 
			
		||||
    w: any;
 | 
			
		||||
    normal: any;
 | 
			
		||||
    vertices: any;
 | 
			
		||||
    constructor(vertices?: any, normal?: any, w?: any);
 | 
			
		||||
    calculateProperties(): this;
 | 
			
		||||
    clone(): Polygon;
 | 
			
		||||
    flip(): this;
 | 
			
		||||
    classifyVertex(vertex: any): 1 | 2 | 0;
 | 
			
		||||
    classifySide(polygon: any): 1 | 3 | 2 | 0;
 | 
			
		||||
    splitPolygon(polygon: any, coplanar_front: any, coplanar_back: any, front: any, back: any): void;
 | 
			
		||||
}
 | 
			
		||||
export declare class Vertex {
 | 
			
		||||
    uv: any;
 | 
			
		||||
    normal: any;
 | 
			
		||||
    z: any;
 | 
			
		||||
    y: any;
 | 
			
		||||
    x: any;
 | 
			
		||||
    constructor(x: number, y: number, z: number, normal: THREE.Vector3, uv: THREE.Vector2);
 | 
			
		||||
    clone(): Vertex;
 | 
			
		||||
    add(vertex: any): this;
 | 
			
		||||
    subtract(vertex: any): this;
 | 
			
		||||
    multiplyScalar(scalar: any): this;
 | 
			
		||||
    cross(vertex: any): this;
 | 
			
		||||
    normalize(): this;
 | 
			
		||||
    dot(vertex: any): number;
 | 
			
		||||
    lerp(a: any, t: any): this;
 | 
			
		||||
    interpolate(other: any, t: any): Vertex;
 | 
			
		||||
    applyMatrix4(m: any): this;
 | 
			
		||||
}
 | 
			
		||||
export declare class Node {
 | 
			
		||||
    divider: any;
 | 
			
		||||
    back: any;
 | 
			
		||||
    front: any;
 | 
			
		||||
    polygons: any[];
 | 
			
		||||
    constructor(polygons?: any);
 | 
			
		||||
    isConvex(polygons: any): boolean;
 | 
			
		||||
    build(polygons: any): void;
 | 
			
		||||
    allPolygons(): any[];
 | 
			
		||||
    clone(): Node;
 | 
			
		||||
    invert(): this;
 | 
			
		||||
    clipPolygons(polygons: any): any;
 | 
			
		||||
    clipTo(node: any): void;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										458
									
								
								dist/ThreeCSG.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										458
									
								
								dist/ThreeCSG.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,458 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var THREE = require("three");
 | 
			
		||||
/*jshint esversion: 6 */
 | 
			
		||||
var EPSILON = 1e-5, COPLANAR = 0, //共面
 | 
			
		||||
FRONT = 1, //前
 | 
			
		||||
BACK = 2, SPANNING = 3;
 | 
			
		||||
var ThreeBSP = /** @class */ (function () {
 | 
			
		||||
    function ThreeBSP(geometry) {
 | 
			
		||||
        // Convert THREE.Geometry to ThreeBSP
 | 
			
		||||
        var i, _length_i, face, vertex, faceVertexUvs, uvs, polygon, polygons = [], tree;
 | 
			
		||||
        this.Polygon = Polygon;
 | 
			
		||||
        this.Vertex = Vertex;
 | 
			
		||||
        this.Node = Node;
 | 
			
		||||
        if (geometry instanceof THREE.Geometry) {
 | 
			
		||||
            this.matrix = new THREE.Matrix4();
 | 
			
		||||
        }
 | 
			
		||||
        else if (geometry instanceof THREE.Mesh) {
 | 
			
		||||
            // #todo: add hierarchy support
 | 
			
		||||
            geometry.updateMatrix();
 | 
			
		||||
            this.matrix = geometry.matrix.clone();
 | 
			
		||||
            geometry = geometry.geometry;
 | 
			
		||||
        }
 | 
			
		||||
        else if (geometry instanceof Node) {
 | 
			
		||||
            this.tree = geometry;
 | 
			
		||||
            this.matrix = new THREE.Matrix4();
 | 
			
		||||
            return this;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            throw 'ThreeBSP: Given geometry is unsupported';
 | 
			
		||||
        }
 | 
			
		||||
        for (i = 0, _length_i = geometry.faces.length; i < _length_i; i++) {
 | 
			
		||||
            face = geometry.faces[i];
 | 
			
		||||
            faceVertexUvs = geometry.faceVertexUvs[0][i];
 | 
			
		||||
            polygon = new Polygon();
 | 
			
		||||
            if (face instanceof THREE.Face3) {
 | 
			
		||||
                vertex = geometry.vertices[face.a];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[0].x, faceVertexUvs[0].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[0], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
                vertex = geometry.vertices[face.b];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[1].x, faceVertexUvs[1].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[1], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
                vertex = geometry.vertices[face.c];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[2].x, faceVertexUvs[2].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[2], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
            }
 | 
			
		||||
            else {
 | 
			
		||||
                throw 'Invalid face type at index ' + i;
 | 
			
		||||
            }
 | 
			
		||||
            polygon.calculateProperties();
 | 
			
		||||
            polygons.push(polygon);
 | 
			
		||||
        }
 | 
			
		||||
        this.tree = new Node(polygons);
 | 
			
		||||
    }
 | 
			
		||||
    //减
 | 
			
		||||
    ThreeBSP.prototype.subtract = function (other_tree) {
 | 
			
		||||
        var a = this.tree.clone(), b = other_tree.tree.clone();
 | 
			
		||||
        a.invert();
 | 
			
		||||
        a.clipTo(b);
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        b.invert();
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        b.invert();
 | 
			
		||||
        a.build(b.allPolygons());
 | 
			
		||||
        a.invert();
 | 
			
		||||
        var bsp = new ThreeBSP(a);
 | 
			
		||||
        bsp.matrix = this.matrix;
 | 
			
		||||
        return bsp;
 | 
			
		||||
    };
 | 
			
		||||
    //结合
 | 
			
		||||
    ThreeBSP.prototype.union = function (other_tree) {
 | 
			
		||||
        var a = this.tree.clone(), b = other_tree.tree.clone();
 | 
			
		||||
        a.clipTo(b);
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        b.invert();
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        b.invert();
 | 
			
		||||
        a.build(b.allPolygons());
 | 
			
		||||
        var bsp = new ThreeBSP(a);
 | 
			
		||||
        bsp.matrix = this.matrix;
 | 
			
		||||
        return bsp;
 | 
			
		||||
    };
 | 
			
		||||
    //相交
 | 
			
		||||
    ThreeBSP.prototype.intersect = function (other_tree) {
 | 
			
		||||
        var a = this.tree.clone(), b = other_tree.tree.clone();
 | 
			
		||||
        a.invert();
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        b.invert();
 | 
			
		||||
        a.clipTo(b);
 | 
			
		||||
        b.clipTo(a);
 | 
			
		||||
        a.build(b.allPolygons());
 | 
			
		||||
        a.invert();
 | 
			
		||||
        var bsp = new ThreeBSP(a);
 | 
			
		||||
        bsp.matrix = this.matrix;
 | 
			
		||||
        return bsp;
 | 
			
		||||
    };
 | 
			
		||||
    ThreeBSP.prototype.toGeometry = function () {
 | 
			
		||||
        var i, j, matrix = new THREE.Matrix4().getInverse(this.matrix), geometry = new THREE.Geometry(), polygons = this.tree.allPolygons(), polygon_count = polygons.length, polygon, polygon_vertice_count, vertice_dict = {}, vertex_idx_a, vertex_idx_b, vertex_idx_c, vertex, face, verticeUvs;
 | 
			
		||||
        for (i = 0; i < polygon_count; i++) {
 | 
			
		||||
            polygon = polygons[i];
 | 
			
		||||
            polygon_vertice_count = polygon.vertices.length;
 | 
			
		||||
            for (j = 2; j < polygon_vertice_count; j++) {
 | 
			
		||||
                verticeUvs = [];
 | 
			
		||||
                vertex = polygon.vertices[0];
 | 
			
		||||
                verticeUvs.push(new THREE.Vector2(vertex.uv.x, vertex.uv.y));
 | 
			
		||||
                vertex = new THREE.Vector3(vertex.x, vertex.y, vertex.z);
 | 
			
		||||
                vertex.applyMatrix4(matrix);
 | 
			
		||||
                if (typeof vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] !== 'undefined') {
 | 
			
		||||
                    vertex_idx_a = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z];
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    geometry.vertices.push(vertex);
 | 
			
		||||
                    vertex_idx_a = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] = geometry.vertices.length - 1;
 | 
			
		||||
                }
 | 
			
		||||
                vertex = polygon.vertices[j - 1];
 | 
			
		||||
                verticeUvs.push(new THREE.Vector2(vertex.uv.x, vertex.uv.y));
 | 
			
		||||
                vertex = new THREE.Vector3(vertex.x, vertex.y, vertex.z);
 | 
			
		||||
                vertex.applyMatrix4(matrix);
 | 
			
		||||
                if (typeof vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] !== 'undefined') {
 | 
			
		||||
                    vertex_idx_b = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z];
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    geometry.vertices.push(vertex);
 | 
			
		||||
                    vertex_idx_b = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] = geometry.vertices.length - 1;
 | 
			
		||||
                }
 | 
			
		||||
                vertex = polygon.vertices[j];
 | 
			
		||||
                verticeUvs.push(new THREE.Vector2(vertex.uv.x, vertex.uv.y));
 | 
			
		||||
                vertex = new THREE.Vector3(vertex.x, vertex.y, vertex.z);
 | 
			
		||||
                vertex.applyMatrix4(matrix);
 | 
			
		||||
                if (typeof vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] !== 'undefined') {
 | 
			
		||||
                    vertex_idx_c = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z];
 | 
			
		||||
                }
 | 
			
		||||
                else {
 | 
			
		||||
                    geometry.vertices.push(vertex);
 | 
			
		||||
                    vertex_idx_c = vertice_dict[vertex.x + ',' + vertex.y + ',' + vertex.z] = geometry.vertices.length - 1;
 | 
			
		||||
                }
 | 
			
		||||
                face = new THREE.Face3(vertex_idx_a, vertex_idx_b, vertex_idx_c, new THREE.Vector3(polygon.normal.x, polygon.normal.y, polygon.normal.z));
 | 
			
		||||
                geometry.faces.push(face);
 | 
			
		||||
                geometry.faceVertexUvs[0].push(verticeUvs);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return geometry;
 | 
			
		||||
    };
 | 
			
		||||
    ThreeBSP.prototype.toMesh = function (material) {
 | 
			
		||||
        var geometry = this.toGeometry(), mesh = new THREE.Mesh(geometry, material);
 | 
			
		||||
        mesh.position.setFromMatrixPosition(this.matrix);
 | 
			
		||||
        mesh.rotation.setFromRotationMatrix(this.matrix);
 | 
			
		||||
        return mesh;
 | 
			
		||||
    };
 | 
			
		||||
    return ThreeBSP;
 | 
			
		||||
}());
 | 
			
		||||
exports.ThreeBSP = ThreeBSP;
 | 
			
		||||
//多边形
 | 
			
		||||
var Polygon = /** @class */ (function () {
 | 
			
		||||
    function Polygon(vertices, normal, w) {
 | 
			
		||||
        if (!(vertices instanceof Array)) {
 | 
			
		||||
            vertices = [];
 | 
			
		||||
        }
 | 
			
		||||
        this.vertices = vertices;
 | 
			
		||||
        if (vertices.length > 0) {
 | 
			
		||||
            this.calculateProperties();
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this.normal = this.w = undefined;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    Polygon.prototype.calculateProperties = function () {
 | 
			
		||||
        var a = this.vertices[0], b = this.vertices[1], c = this.vertices[2];
 | 
			
		||||
        this.normal = b.clone().subtract(a).cross(c.clone().subtract(a)).normalize();
 | 
			
		||||
        this.w = this.normal.clone().dot(a);
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Polygon.prototype.clone = function () {
 | 
			
		||||
        var i, vertice_count, polygon = new Polygon();
 | 
			
		||||
        for (i = 0, vertice_count = this.vertices.length; i < vertice_count; i++) {
 | 
			
		||||
            polygon.vertices.push(this.vertices[i].clone());
 | 
			
		||||
        }
 | 
			
		||||
        polygon.calculateProperties();
 | 
			
		||||
        return polygon;
 | 
			
		||||
    };
 | 
			
		||||
    Polygon.prototype.flip = function () {
 | 
			
		||||
        var i, vertices = [];
 | 
			
		||||
        this.normal.multiplyScalar(-1);
 | 
			
		||||
        this.w *= -1;
 | 
			
		||||
        for (i = this.vertices.length - 1; i >= 0; i--) {
 | 
			
		||||
            vertices.push(this.vertices[i]);
 | 
			
		||||
        }
 | 
			
		||||
        this.vertices = vertices;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    //划分?
 | 
			
		||||
    Polygon.prototype.classifyVertex = function (vertex) {
 | 
			
		||||
        var side_value = this.normal.dot(vertex) - this.w;
 | 
			
		||||
        if (side_value < -EPSILON) {
 | 
			
		||||
            return BACK;
 | 
			
		||||
        }
 | 
			
		||||
        else if (side_value > EPSILON) {
 | 
			
		||||
            return FRONT;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return COPLANAR;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    //划分边?
 | 
			
		||||
    Polygon.prototype.classifySide = function (polygon) {
 | 
			
		||||
        var i, vertex, classification, num_positive = 0, num_negative = 0, vertice_count = polygon.vertices.length;
 | 
			
		||||
        for (i = 0; i < vertice_count; i++) {
 | 
			
		||||
            vertex = polygon.vertices[i];
 | 
			
		||||
            classification = this.classifyVertex(vertex);
 | 
			
		||||
            if (classification === FRONT) {
 | 
			
		||||
                num_positive++;
 | 
			
		||||
            }
 | 
			
		||||
            else if (classification === BACK) {
 | 
			
		||||
                num_negative++;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (num_positive > 0 && num_negative === 0) {
 | 
			
		||||
            return FRONT;
 | 
			
		||||
        }
 | 
			
		||||
        else if (num_positive === 0 && num_negative > 0) {
 | 
			
		||||
            return BACK;
 | 
			
		||||
        }
 | 
			
		||||
        else if (num_positive === 0 && num_negative === 0) {
 | 
			
		||||
            return COPLANAR;
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            return SPANNING;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    //分解 分离 区域?
 | 
			
		||||
    Polygon.prototype.splitPolygon = function (polygon, coplanar_front, coplanar_back, front, back) {
 | 
			
		||||
        var classification = this.classifySide(polygon);
 | 
			
		||||
        if (classification === COPLANAR) {
 | 
			
		||||
            (this.normal.dot(polygon.normal) > 0 ? coplanar_front : coplanar_back).push(polygon);
 | 
			
		||||
        }
 | 
			
		||||
        else if (classification === FRONT) {
 | 
			
		||||
            front.push(polygon);
 | 
			
		||||
        }
 | 
			
		||||
        else if (classification === BACK) {
 | 
			
		||||
            back.push(polygon);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            var vertice_count = void 0, i = void 0, j = void 0, ti = void 0, tj = void 0, vi = void 0, vj = void 0, t = void 0, v = void 0, f = [], b = [];
 | 
			
		||||
            for (i = 0, vertice_count = polygon.vertices.length; i < vertice_count; i++) {
 | 
			
		||||
                j = (i + 1) % vertice_count;
 | 
			
		||||
                vi = polygon.vertices[i];
 | 
			
		||||
                vj = polygon.vertices[j];
 | 
			
		||||
                ti = this.classifyVertex(vi);
 | 
			
		||||
                tj = this.classifyVertex(vj);
 | 
			
		||||
                if (ti != BACK)
 | 
			
		||||
                    f.push(vi);
 | 
			
		||||
                if (ti != FRONT)
 | 
			
		||||
                    b.push(vi);
 | 
			
		||||
                if ((ti | tj) === SPANNING) {
 | 
			
		||||
                    t = (this.w - this.normal.dot(vi)) / this.normal.dot(vj.clone().subtract(vi));
 | 
			
		||||
                    v = vi.interpolate(vj, t);
 | 
			
		||||
                    f.push(v);
 | 
			
		||||
                    b.push(v);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            if (f.length >= 3)
 | 
			
		||||
                front.push(new Polygon(f).calculateProperties());
 | 
			
		||||
            if (b.length >= 3)
 | 
			
		||||
                back.push(new Polygon(b).calculateProperties());
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    return Polygon;
 | 
			
		||||
}());
 | 
			
		||||
exports.Polygon = Polygon;
 | 
			
		||||
var Vertex = /** @class */ (function () {
 | 
			
		||||
    function Vertex(x, y, z, normal, uv) {
 | 
			
		||||
        this.x = x;
 | 
			
		||||
        this.y = y;
 | 
			
		||||
        this.z = z;
 | 
			
		||||
        this.normal = normal || new THREE.Vector3();
 | 
			
		||||
        this.uv = uv || new THREE.Vector2();
 | 
			
		||||
    }
 | 
			
		||||
    Vertex.prototype.clone = function () {
 | 
			
		||||
        return new Vertex(this.x, this.y, this.z, this.normal.clone(), this.uv.clone());
 | 
			
		||||
    };
 | 
			
		||||
    Vertex.prototype.add = function (vertex) {
 | 
			
		||||
        this.x += vertex.x;
 | 
			
		||||
        this.y += vertex.y;
 | 
			
		||||
        this.z += vertex.z;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Vertex.prototype.subtract = function (vertex) {
 | 
			
		||||
        this.x -= vertex.x;
 | 
			
		||||
        this.y -= vertex.y;
 | 
			
		||||
        this.z -= vertex.z;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Vertex.prototype.multiplyScalar = function (scalar) {
 | 
			
		||||
        this.x *= scalar;
 | 
			
		||||
        this.y *= scalar;
 | 
			
		||||
        this.z *= scalar;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    //×乘
 | 
			
		||||
    Vertex.prototype.cross = function (vertex) {
 | 
			
		||||
        var x = this.x, y = this.y, z = this.z;
 | 
			
		||||
        this.x = y * vertex.z - z * vertex.y;
 | 
			
		||||
        this.y = z * vertex.x - x * vertex.z;
 | 
			
		||||
        this.z = x * vertex.y - y * vertex.x;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    Vertex.prototype.normalize = function () {
 | 
			
		||||
        var length = Math.sqrt(this.x * this.x + this.y * this.y + this.z * this.z);
 | 
			
		||||
        this.x /= length;
 | 
			
		||||
        this.y /= length;
 | 
			
		||||
        this.z /= length;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    //点乘
 | 
			
		||||
    Vertex.prototype.dot = function (vertex) {
 | 
			
		||||
        return this.x * vertex.x + this.y * vertex.y + this.z * vertex.z;
 | 
			
		||||
    };
 | 
			
		||||
    //线性插值
 | 
			
		||||
    Vertex.prototype.lerp = function (a, t) {
 | 
			
		||||
        this.add(a.clone().subtract(this).multiplyScalar(t));
 | 
			
		||||
        this.normal.add(a.normal.clone().sub(this.normal).multiplyScalar(t));
 | 
			
		||||
        this.uv.add(a.uv.clone().sub(this.uv).multiplyScalar(t));
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    //插值
 | 
			
		||||
    Vertex.prototype.interpolate = function (other, t) {
 | 
			
		||||
        return this.clone().lerp(other, t);
 | 
			
		||||
    };
 | 
			
		||||
    Vertex.prototype.applyMatrix4 = function (m) {
 | 
			
		||||
        // input: THREE.Matrix4 affine matrix
 | 
			
		||||
        var x = this.x, y = this.y, z = this.z;
 | 
			
		||||
        var e = m.elements;
 | 
			
		||||
        this.x = e[0] * x + e[4] * y + e[8] * z + e[12];
 | 
			
		||||
        this.y = e[1] * x + e[5] * y + e[9] * z + e[13];
 | 
			
		||||
        this.z = e[2] * x + e[6] * y + e[10] * z + e[14];
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    return Vertex;
 | 
			
		||||
}());
 | 
			
		||||
exports.Vertex = Vertex;
 | 
			
		||||
var Node = /** @class */ (function () {
 | 
			
		||||
    function Node(polygons) {
 | 
			
		||||
        var i, polygon_count, front = [], back = [];
 | 
			
		||||
        this.polygons = [];
 | 
			
		||||
        this.front = this.back = undefined;
 | 
			
		||||
        if (!(polygons instanceof Array) || polygons.length === 0)
 | 
			
		||||
            return;
 | 
			
		||||
        this.divider = polygons[0].clone();
 | 
			
		||||
        for (i = 0, polygon_count = polygons.length; i < polygon_count; i++) {
 | 
			
		||||
            this.divider.splitPolygon(polygons[i], this.polygons, this.polygons, front, back);
 | 
			
		||||
        }
 | 
			
		||||
        if (front.length > 0) {
 | 
			
		||||
            this.front = new Node(front);
 | 
			
		||||
        }
 | 
			
		||||
        if (back.length > 0) {
 | 
			
		||||
            this.back = new Node(back);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    //是凸的? 凸包?
 | 
			
		||||
    Node.prototype.isConvex = function (polygons) {
 | 
			
		||||
        var i, j;
 | 
			
		||||
        for (i = 0; i < polygons.length; i++) {
 | 
			
		||||
            for (j = 0; j < polygons.length; j++) {
 | 
			
		||||
                if (i !== j && polygons[i].classifySide(polygons[j]) !== BACK) {
 | 
			
		||||
                    return false;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return true;
 | 
			
		||||
    };
 | 
			
		||||
    Node.prototype.build = function (polygons) {
 | 
			
		||||
        var i, polygon_count, front = [], back = [];
 | 
			
		||||
        if (!this.divider) {
 | 
			
		||||
            this.divider = polygons[0].clone();
 | 
			
		||||
        }
 | 
			
		||||
        for (i = 0, polygon_count = polygons.length; i < polygon_count; i++) {
 | 
			
		||||
            this.divider.splitPolygon(polygons[i], this.polygons, this.polygons, front, back);
 | 
			
		||||
        }
 | 
			
		||||
        if (front.length > 0) {
 | 
			
		||||
            if (!this.front)
 | 
			
		||||
                this.front = new Node();
 | 
			
		||||
            this.front.build(front);
 | 
			
		||||
        }
 | 
			
		||||
        if (back.length > 0) {
 | 
			
		||||
            if (!this.back)
 | 
			
		||||
                this.back = new Node();
 | 
			
		||||
            this.back.build(back);
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    Node.prototype.allPolygons = function () {
 | 
			
		||||
        var polygons = this.polygons.slice();
 | 
			
		||||
        if (this.front)
 | 
			
		||||
            polygons = polygons.concat(this.front.allPolygons());
 | 
			
		||||
        if (this.back)
 | 
			
		||||
            polygons = polygons.concat(this.back.allPolygons());
 | 
			
		||||
        return polygons;
 | 
			
		||||
    };
 | 
			
		||||
    Node.prototype.clone = function () {
 | 
			
		||||
        var node = new Node();
 | 
			
		||||
        node.divider = this.divider.clone();
 | 
			
		||||
        node.polygons = this.polygons.map(function (polygon) {
 | 
			
		||||
            return polygon.clone();
 | 
			
		||||
        });
 | 
			
		||||
        node.front = this.front && this.front.clone();
 | 
			
		||||
        node.back = this.back && this.back.clone();
 | 
			
		||||
        return node;
 | 
			
		||||
    };
 | 
			
		||||
    //反转
 | 
			
		||||
    Node.prototype.invert = function () {
 | 
			
		||||
        var i, polygon_count, temp;
 | 
			
		||||
        for (i = 0, polygon_count = this.polygons.length; i < polygon_count; i++) {
 | 
			
		||||
            this.polygons[i].flip();
 | 
			
		||||
        }
 | 
			
		||||
        this.divider.flip();
 | 
			
		||||
        if (this.front)
 | 
			
		||||
            this.front.invert();
 | 
			
		||||
        if (this.back)
 | 
			
		||||
            this.back.invert();
 | 
			
		||||
        temp = this.front;
 | 
			
		||||
        this.front = this.back;
 | 
			
		||||
        this.back = temp;
 | 
			
		||||
        return this;
 | 
			
		||||
    };
 | 
			
		||||
    //
 | 
			
		||||
    Node.prototype.clipPolygons = function (polygons) {
 | 
			
		||||
        var i, polygon_count, front, back;
 | 
			
		||||
        if (!this.divider)
 | 
			
		||||
            return polygons.slice();
 | 
			
		||||
        front = [];
 | 
			
		||||
        back = [];
 | 
			
		||||
        for (i = 0, polygon_count = polygons.length; i < polygon_count; i++) {
 | 
			
		||||
            this.divider.splitPolygon(polygons[i], front, back, front, back);
 | 
			
		||||
        }
 | 
			
		||||
        if (this.front)
 | 
			
		||||
            front = this.front.clipPolygons(front);
 | 
			
		||||
        if (this.back)
 | 
			
		||||
            back = this.back.clipPolygons(back);
 | 
			
		||||
        else
 | 
			
		||||
            back = [];
 | 
			
		||||
        return front.concat(back);
 | 
			
		||||
    };
 | 
			
		||||
    Node.prototype.clipTo = function (node) {
 | 
			
		||||
        this.polygons = node.clipPolygons(this.polygons);
 | 
			
		||||
        if (this.front)
 | 
			
		||||
            this.front.clipTo(node);
 | 
			
		||||
        if (this.back)
 | 
			
		||||
            this.back.clipTo(node);
 | 
			
		||||
    };
 | 
			
		||||
    return Node;
 | 
			
		||||
}());
 | 
			
		||||
exports.Node = Node;
 | 
			
		||||
//# sourceMappingURL=ThreeCSG.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/ThreeCSG.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/ThreeCSG.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										5
									
								
								dist/Utils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								dist/Utils.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
import { Viewer } from ".";
 | 
			
		||||
export declare function LoadBoard(view: Viewer, data: any[], clear?: boolean): {
 | 
			
		||||
    blockMeshMap: Map<number, number>;
 | 
			
		||||
    meshBlockMap: Map<number, number>;
 | 
			
		||||
};
 | 
			
		||||
							
								
								
									
										33
									
								
								dist/Utils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								dist/Utils.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var _1 = require(".");
 | 
			
		||||
function dispose(m) {
 | 
			
		||||
    //@ts-ignore
 | 
			
		||||
    if (m.geometry)
 | 
			
		||||
        //@ts-ignore
 | 
			
		||||
        m.geometry.dispose();
 | 
			
		||||
    m.children.forEach(function (o) { return dispose(o); });
 | 
			
		||||
}
 | 
			
		||||
function LoadBoard(view, data, clear) {
 | 
			
		||||
    var _a, _b, _c;
 | 
			
		||||
    if (clear === void 0) { clear = true; }
 | 
			
		||||
    if (clear) {
 | 
			
		||||
        dispose(view.m_Scene);
 | 
			
		||||
        view.m_Scene.children.length = 0;
 | 
			
		||||
    }
 | 
			
		||||
    if (data.length === 0)
 | 
			
		||||
        return;
 | 
			
		||||
    //加板
 | 
			
		||||
    var _d = _1.createTemplateBoard(data), meshs = _d.meshs, edgesa = _d.edgesa, relations = _d.relations;
 | 
			
		||||
    //加标注
 | 
			
		||||
    var dims = _1.DrawDimension(meshs);
 | 
			
		||||
    (_a = view.m_Scene).add.apply(_a, meshs);
 | 
			
		||||
    (_b = view.m_Scene).add.apply(_b, edgesa);
 | 
			
		||||
    (_c = view.m_Scene).add.apply(_c, dims);
 | 
			
		||||
    view.ViewToSwiso();
 | 
			
		||||
    view.ZoomAll();
 | 
			
		||||
    view.Zoom(1.1);
 | 
			
		||||
    return relations;
 | 
			
		||||
}
 | 
			
		||||
exports.LoadBoard = LoadBoard;
 | 
			
		||||
//# sourceMappingURL=Utils.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Utils.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Utils.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"Utils.js","sourceRoot":"","sources":["../src/Utils.ts"],"names":[],"mappings":";;AACA,sBAA+E;AAE/E,SAAS,OAAO,CAAC,CAAW;IAExB,YAAY;IACZ,IAAI,CAAC,CAAC,QAAQ;QACV,YAAY;QACZ,CAAC,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;IAEzB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAA,CAAC,IAAI,OAAA,OAAO,CAAC,CAAC,CAAC,EAAV,CAAU,CAAC,CAAC;AACxC,CAAC;AAED,SAAgB,SAAS,CAAC,IAAY,EAAE,IAAW,EAAE,KAAqB;;IAArB,sBAAA,EAAA,YAAqB;IAEtE,IAAI,KAAK,EACT;QACI,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;KACpC;IAED,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO;IAC9B,IAAI;IACA,IAAA,iCAAwD,EAAtD,gBAAK,EAAE,kBAAM,EAAE,wBAAuC,CAAC;IAE7D,KAAK;IACL,IAAI,IAAI,GAAG,gBAAa,CAAC,KAAK,CAAC,CAAC;IAEhC,CAAA,KAAA,IAAI,CAAC,OAAO,CAAA,CAAC,GAAG,WAAI,KAAK,EAAE;IAC3B,CAAA,KAAA,IAAI,CAAC,OAAO,CAAA,CAAC,GAAG,WAAI,MAAM,EAAE;IAC5B,CAAA,KAAA,IAAI,CAAC,OAAO,CAAA,CAAC,GAAG,WAAI,IAAI,EAAE;IAE1B,IAAI,CAAC,WAAW,EAAE,CAAC;IACnB,IAAI,CAAC,OAAO,EAAE,CAAC;IACf,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEf,OAAO,SAAS,CAAC;AACrB,CAAC;AAxBD,8BAwBC"}
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/ViewSrc/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/ViewSrc/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
export {};
 | 
			
		||||
							
								
								
									
										70
									
								
								dist/ViewSrc/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								dist/ViewSrc/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
// import { Color, Face3, MeshBasicMaterial, Object3D, Vector2, Vector3 } from "three";
 | 
			
		||||
// import "./style.css";
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var CameraControls_1 = require("../CameraControls");
 | 
			
		||||
var data_1 = require("../data");
 | 
			
		||||
var GeUtils_1 = require("../GeUtils");
 | 
			
		||||
var Utils_1 = require("../Utils");
 | 
			
		||||
var Viewer_1 = require("../Viewer");
 | 
			
		||||
var btn = document.createElement("button");
 | 
			
		||||
btn.innerHTML = "载入";
 | 
			
		||||
document.body.appendChild(btn);
 | 
			
		||||
var btn2 = document.createElement("button");
 | 
			
		||||
btn2.innerHTML = "清理";
 | 
			
		||||
document.body.appendChild(btn2);
 | 
			
		||||
var btn3 = document.createElement("button");
 | 
			
		||||
btn3.innerHTML = "爆炸图";
 | 
			
		||||
document.body.appendChild(btn3);
 | 
			
		||||
var el = document.createElement("canvas");
 | 
			
		||||
el.style.width = "80%";
 | 
			
		||||
el.style.height = "80%";
 | 
			
		||||
document.body.appendChild(el);
 | 
			
		||||
var view = new Viewer_1.Viewer(el);
 | 
			
		||||
//修改这个顺序 改变1 2 3 个触摸点时的触发状态.
 | 
			
		||||
view.m_CameraCtrl.m_TouthTypeList = [CameraControls_1.CameraControlState.Rotate, CameraControls_1.CameraControlState.Scale, CameraControls_1.CameraControlState.Pan];
 | 
			
		||||
//例如,修改单指滑动为平移.
 | 
			
		||||
view.m_CameraCtrl.m_TouthTypeList = [CameraControls_1.CameraControlState.Pan, CameraControls_1.CameraControlState.Scale, CameraControls_1.CameraControlState.Rotate];
 | 
			
		||||
//加载
 | 
			
		||||
btn.onclick = function () {
 | 
			
		||||
    console.time();
 | 
			
		||||
    for (var i = 0; i < 1; i++)
 | 
			
		||||
        Utils_1.LoadBoard(view, data_1.data);
 | 
			
		||||
    console.timeEnd();
 | 
			
		||||
};
 | 
			
		||||
btn2.onclick = function () {
 | 
			
		||||
    // LoadBoard(view, []);
 | 
			
		||||
};
 | 
			
		||||
btn3.onclick = function () {
 | 
			
		||||
    var box = GeUtils_1.GetBox(view.m_Scene);
 | 
			
		||||
    var cen = box.getCenter(new three_1.Vector3());
 | 
			
		||||
    var m = [];
 | 
			
		||||
    for (var _i = 0, _a = view.m_Scene.children; _i < _a.length; _i++) {
 | 
			
		||||
        var obj = _a[_i];
 | 
			
		||||
        if (obj.userData && obj.userData instanceof three_1.Vector3) {
 | 
			
		||||
            var objCen = GeUtils_1.GetBox(obj).getCenter(new three_1.Vector3());
 | 
			
		||||
            var v = objCen.clone().sub(cen);
 | 
			
		||||
            var zv = obj.userData;
 | 
			
		||||
            if (zv instanceof three_1.Vector3) {
 | 
			
		||||
                var d = zv.dot(v);
 | 
			
		||||
                // m.set(obj, zv.clone().multiplyScalar(d));
 | 
			
		||||
                m.push([obj, zv.clone().multiplyScalar(d)]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    var count = 0;
 | 
			
		||||
    var t = setInterval(function () {
 | 
			
		||||
        for (var _i = 0, m_1 = m; _i < m_1.length; _i++) {
 | 
			
		||||
            var _a = m_1[_i], o = _a[0], v = _a[1];
 | 
			
		||||
            o.position.add(v.clone().multiplyScalar(1.5 / 120));
 | 
			
		||||
            o.updateMatrix();
 | 
			
		||||
        }
 | 
			
		||||
        view.ZoomAll();
 | 
			
		||||
        view.m_bNeedUpdate = true;
 | 
			
		||||
        count++;
 | 
			
		||||
        if (count === 60)
 | 
			
		||||
            clearInterval(t);
 | 
			
		||||
    }, 16);
 | 
			
		||||
};
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/ViewSrc/index.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/ViewSrc/index.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ViewSrc/index.ts"],"names":[],"mappings":";;AAAA,uFAAuF;AACvF,wBAAwB;AACxB,+BAAgC;AAChC,oDAAuD;AACvD,gCAA+B;AAC/B,sCAAoC;AACpC,kCAAqC;AACrC,oCAAmC;AAEnC,IAAI,GAAG,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC3C,GAAG,CAAC,SAAS,GAAG,IAAI,CAAA;AACpB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;AAE/B,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;AACrB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAEhC,IAAI,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC5C,IAAI,CAAC,SAAS,GAAG,KAAK,CAAA;AACtB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AAEhC,IAAI,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;AAE1C,EAAE,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC;AACvB,EAAE,CAAC,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC;AACxB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;AAE9B,IAAI,IAAI,GAAG,IAAI,eAAM,CAAC,EAAE,CAAC,CAAC;AAE1B,4BAA4B;AAC5B,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,CAAC,mCAAkB,CAAC,MAAM,EAAE,mCAAkB,CAAC,KAAK,EAAE,mCAAkB,CAAC,GAAG,CAAC,CAAC;AAClH,eAAe;AACf,IAAI,CAAC,YAAY,CAAC,eAAe,GAAG,CAAC,mCAAkB,CAAC,GAAG,EAAE,mCAAkB,CAAC,KAAK,EAAE,mCAAkB,CAAC,MAAM,CAAC,CAAC;AAElH,IAAI;AACJ,GAAG,CAAC,OAAO,GAAG;IAEV,OAAO,CAAC,IAAI,EAAE,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE;QACtB,iBAAS,CAAC,IAAI,EAAE,WAAI,CAAC,CAAC;IAC1B,OAAO,CAAC,OAAO,EAAE,CAAC;AACtB,CAAC,CAAA;AAED,IAAI,CAAC,OAAO,GAAG;IAEX,uBAAuB;AAC3B,CAAC,CAAA;AAED,IAAI,CAAC,OAAO,GAAG;IAEX,IAAI,GAAG,GAAG,gBAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAE/B,IAAI,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,IAAI,eAAO,EAAE,CAAC,CAAC;IACvC,IAAI,CAAC,GAAG,EAAE,CAAC;IACX,KAAgB,UAAqB,EAArB,KAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAArB,cAAqB,EAArB,IAAqB,EACrC;QADK,IAAI,GAAG,SAAA;QAER,IAAI,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,QAAQ,YAAY,eAAO,EACnD;YACI,IAAI,MAAM,GAAG,gBAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,IAAI,eAAO,EAAE,CAAC,CAAC;YAElD,IAAI,CAAC,GAAG,MAAM,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YAEhC,IAAI,EAAE,GAAG,GAAG,CAAC,QAAmB,CAAC;YACjC,IAAI,EAAE,YAAY,eAAO,EACzB;gBACI,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;gBAClB,4CAA4C;gBAC5C,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/C;SACJ;KACJ;IAGD,IAAI,KAAK,GAAG,CAAC,CAAC;IAEd,IAAI,CAAC,GAAG,WAAW,CAAC;QAEhB,KAAmB,UAAC,EAAD,OAAC,EAAD,eAAC,EAAD,IAAC,EACpB;YADS,IAAA,YAAM,EAAL,SAAC,EAAE,SAAC;YAEV,CAAC,CAAC,QAAQ,CAAC,GAAG,CACV,CAAC,CAAC,KAAK,EAAE,CAAC,cAAc,CAAC,GAAG,GAAG,GAAG,CAAC,CACtC,CAAC;YACF,CAAC,CAAC,YAAY,EAAE,CAAC;SACpB;QAED,IAAI,CAAC,OAAO,EAAE,CAAC;QAEf,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAE1B,KAAK,EAAE,CAAC;QAER,IAAI,KAAK,KAAK,EAAE;YACZ,aAAa,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC,EAAE,EAAE,CAAC,CAAA;AACV,CAAC,CAAA"}
 | 
			
		||||
							
								
								
									
										42
									
								
								dist/Viewer.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								dist/Viewer.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,42 @@
 | 
			
		||||
import { Mesh, Scene, Vector3, WebGLRenderer } from "three";
 | 
			
		||||
import { CameraControls } from ".";
 | 
			
		||||
import { CameraUpdate } from "./CameraUpdate";
 | 
			
		||||
export declare class Viewer {
 | 
			
		||||
    m_LookTarget: any;
 | 
			
		||||
    m_Camera: CameraUpdate;
 | 
			
		||||
    m_CameraCtrl: CameraControls;
 | 
			
		||||
    m_bNeedUpdate: boolean;
 | 
			
		||||
    m_Render: WebGLRenderer;
 | 
			
		||||
    m_DomEl: HTMLElement;
 | 
			
		||||
    _Height: number;
 | 
			
		||||
    _Width: number;
 | 
			
		||||
    m_Scene: Scene;
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param {HTMLElement} canvasContainer 可以传入一个div或者一个画布
 | 
			
		||||
     * @memberof Viewer
 | 
			
		||||
     */
 | 
			
		||||
    constructor(canvasContainer: HTMLElement);
 | 
			
		||||
    initRender(canvasContainer: HTMLElement): void;
 | 
			
		||||
    OnSize: (width?: any, height?: any) => void;
 | 
			
		||||
    StartRender: () => void;
 | 
			
		||||
    Render(): void;
 | 
			
		||||
    ScreenToWorld(pt: Vector3, planVec?: Vector3): void;
 | 
			
		||||
    WorldToScreen(pt: Vector3): void;
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新视角观测目标(物体中心)
 | 
			
		||||
     *
 | 
			
		||||
     * @memberof Viewer
 | 
			
		||||
     */
 | 
			
		||||
    UpdateLockTarget(): void;
 | 
			
		||||
    Rotate(mouseMove: Vector3): void;
 | 
			
		||||
    Pan(mouseMove: Vector3): void;
 | 
			
		||||
    Zoom(scale: number, center?: Vector3): void;
 | 
			
		||||
    ZoomAll(): void;
 | 
			
		||||
    ViewToTop(): void;
 | 
			
		||||
    ViewToFront(): void;
 | 
			
		||||
    ViewToSwiso(): void;
 | 
			
		||||
    oldMesh: Mesh;
 | 
			
		||||
    SelectByPoint(x: number, y: number): void;
 | 
			
		||||
    SelectBlock(blockMeshMap: Map<number, number>, dataID: number): void;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										172
									
								
								dist/Viewer.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										172
									
								
								dist/Viewer.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,172 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var _1 = require(".");
 | 
			
		||||
var CameraUpdate_1 = require("./CameraUpdate");
 | 
			
		||||
var ColorPalette_1 = require("./ColorPalette");
 | 
			
		||||
var GeUtils_1 = require("./GeUtils");
 | 
			
		||||
var PlaneExt_1 = require("./PlaneExt");
 | 
			
		||||
var Viewer = /** @class */ (function () {
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * @param {HTMLElement} canvasContainer 可以传入一个div或者一个画布
 | 
			
		||||
     * @memberof Viewer
 | 
			
		||||
     */
 | 
			
		||||
    function Viewer(canvasContainer) {
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        this.m_Camera = new CameraUpdate_1.CameraUpdate();
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
        this.m_Scene = new three_1.Scene();
 | 
			
		||||
        this.OnSize = function (width, height) {
 | 
			
		||||
            _this._Width = width ? width : _this.m_DomEl.clientWidth;
 | 
			
		||||
            _this._Height = height ? height : _this.m_DomEl.clientHeight;
 | 
			
		||||
            //校验.成为2的倍数 避免外轮廓错误.
 | 
			
		||||
            if (_this._Width % 2 == 1)
 | 
			
		||||
                _this._Width -= 1;
 | 
			
		||||
            if (_this._Height % 2 == 1)
 | 
			
		||||
                _this._Height -= 1;
 | 
			
		||||
            _this.m_Render.setSize(_this._Width, _this._Height);
 | 
			
		||||
            _this.m_Camera.SetSize(_this._Width, _this._Height);
 | 
			
		||||
        };
 | 
			
		||||
        this.StartRender = function () {
 | 
			
		||||
            requestAnimationFrame(_this.StartRender);
 | 
			
		||||
            if (_this.m_Scene != null && _this.m_bNeedUpdate) {
 | 
			
		||||
                _this.Render();
 | 
			
		||||
                _this.m_bNeedUpdate = false;
 | 
			
		||||
            }
 | 
			
		||||
        };
 | 
			
		||||
        this.m_DomEl = canvasContainer;
 | 
			
		||||
        this.initRender(canvasContainer);
 | 
			
		||||
        this.OnSize();
 | 
			
		||||
        this.StartRender();
 | 
			
		||||
        this.m_CameraCtrl = new _1.CameraControls(this);
 | 
			
		||||
        window.addEventListener("resize", function () {
 | 
			
		||||
            _this.OnSize();
 | 
			
		||||
        });
 | 
			
		||||
        this.m_Render.domElement.addEventListener("mousemove", function (e) {
 | 
			
		||||
            _this.SelectByPoint(e.offsetX, e.offsetY);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    //初始化render
 | 
			
		||||
    Viewer.prototype.initRender = function (canvasContainer) {
 | 
			
		||||
        var params = {
 | 
			
		||||
            antialias: true,
 | 
			
		||||
            precision: "highp",
 | 
			
		||||
            alpha: true //alpha:true/false是否可以设置背景色透明
 | 
			
		||||
        };
 | 
			
		||||
        if (canvasContainer instanceof HTMLCanvasElement) {
 | 
			
		||||
            params.canvas = canvasContainer;
 | 
			
		||||
            this.m_Render = new three_1.WebGLRenderer(params);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            this.m_Render = new three_1.WebGLRenderer(params);
 | 
			
		||||
            //加到画布
 | 
			
		||||
            canvasContainer.appendChild(this.m_Render.domElement);
 | 
			
		||||
        }
 | 
			
		||||
        this.m_Render.autoClear = true;
 | 
			
		||||
        //如果设置,那么它希望所有的纹理和颜色都是预乘的伽玛。默认值为false。
 | 
			
		||||
        // this.m_Render.gammaInput = true;
 | 
			
		||||
        // this.m_Render.gammaOutput = true;
 | 
			
		||||
        // this.m_Render.shadowMap.enabled = true;
 | 
			
		||||
        // this.m_Render.toneMapping = ReinhardToneMapping;
 | 
			
		||||
        //设置设备像素比。 这通常用于HiDPI设备,以防止模糊输出画布。
 | 
			
		||||
        this.m_Render.setPixelRatio(window.devicePixelRatio);
 | 
			
		||||
        this.m_Render.physicallyCorrectLights = true;
 | 
			
		||||
        //this.m_Render.toneMappingExposure = Math.pow(1, 5.0); // to allow for very bright scenes.
 | 
			
		||||
        //设置它的背景色为黑色
 | 
			
		||||
        this.m_Render.setClearColor(0xffffff, 1);
 | 
			
		||||
        this.OnSize();
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.Render = function () {
 | 
			
		||||
        this.m_Render.render(this.m_Scene, this.m_Camera.Camera);
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.ScreenToWorld = function (pt, planVec) {
 | 
			
		||||
        //变换和求交点
 | 
			
		||||
        var plan = new PlaneExt_1.PlaneExt(planVec || new three_1.Vector3(0, 0, 1));
 | 
			
		||||
        var raycaster = new three_1.Raycaster();
 | 
			
		||||
        // 射线从相机射线向屏幕点位置
 | 
			
		||||
        raycaster.setFromCamera({
 | 
			
		||||
            x: (pt.x / this._Width) * 2 - 1,
 | 
			
		||||
            y: -(pt.y / this._Height) * 2 + 1
 | 
			
		||||
        }, this.m_Camera.Camera);
 | 
			
		||||
        plan.intersectRay(raycaster.ray, pt, true);
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.WorldToScreen = function (pt) {
 | 
			
		||||
        var widthHalf = this._Width * 0.5;
 | 
			
		||||
        var heightHalf = this._Height * 0.5;
 | 
			
		||||
        pt.project(this.m_Camera.Camera);
 | 
			
		||||
        pt.x = (pt.x * widthHalf) + widthHalf;
 | 
			
		||||
        pt.y = -(pt.y * heightHalf) + heightHalf;
 | 
			
		||||
    };
 | 
			
		||||
    /**
 | 
			
		||||
     * 更新视角观测目标(物体中心)
 | 
			
		||||
     *
 | 
			
		||||
     * @memberof Viewer
 | 
			
		||||
     */
 | 
			
		||||
    Viewer.prototype.UpdateLockTarget = function () {
 | 
			
		||||
        var renderList = this.m_Render.renderLists.get(this.m_Scene, this.m_Camera.Camera);
 | 
			
		||||
        var box = GeUtils_1.GetBoxArr(renderList.opaque.map(function (o) { return o.object; }));
 | 
			
		||||
        if (box)
 | 
			
		||||
            this.m_LookTarget = box.getCenter(new three_1.Vector3());
 | 
			
		||||
        else
 | 
			
		||||
            this.m_LookTarget = GeUtils_1.cZeroVec;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.Rotate = function (mouseMove) {
 | 
			
		||||
        this.m_Camera.Rotate(mouseMove, this.m_LookTarget);
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.Pan = function (mouseMove) {
 | 
			
		||||
        this.m_Camera.Pan(mouseMove);
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.Zoom = function (scale, center) {
 | 
			
		||||
        this.m_Camera.Zoom(scale, center);
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.ZoomAll = function () {
 | 
			
		||||
        this.m_Camera.ZoomExtensBox3(GeUtils_1.GetBox(this.m_Scene, true));
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.ViewToTop = function () {
 | 
			
		||||
        this.m_Camera.LookAt(new three_1.Vector3(0, 0, -1));
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.ViewToFront = function () {
 | 
			
		||||
        this.m_Camera.LookAt(new three_1.Vector3(0, 1, 0));
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.ViewToSwiso = function () {
 | 
			
		||||
        this.m_Camera.LookAt(new three_1.Vector3(1, 1, -1));
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.SelectByPoint = function (x, y) {
 | 
			
		||||
        var mesh = _1.PointPick(this, x, y);
 | 
			
		||||
        if (this.oldMesh)
 | 
			
		||||
            this.oldMesh.material = _1.boardMaterial;
 | 
			
		||||
        if (mesh && mesh.material !== ColorPalette_1.ColorMaterial.GetBasicMaterial(1)) {
 | 
			
		||||
            this.oldMesh = mesh;
 | 
			
		||||
            mesh.material = _1.selectMaterial;
 | 
			
		||||
        }
 | 
			
		||||
        this.m_bNeedUpdate = true;
 | 
			
		||||
    };
 | 
			
		||||
    Viewer.prototype.SelectBlock = function (blockMeshMap, dataID) {
 | 
			
		||||
        var _this = this;
 | 
			
		||||
        if (blockMeshMap.has(dataID)) {
 | 
			
		||||
            var meshId_1 = blockMeshMap.get(dataID);
 | 
			
		||||
            if (this.oldMesh)
 | 
			
		||||
                this.oldMesh.material = _1.boardMaterial;
 | 
			
		||||
            this.m_Scene.children.forEach(function (obj) {
 | 
			
		||||
                if (obj instanceof three_1.Mesh) {
 | 
			
		||||
                    if (obj.id == meshId_1) {
 | 
			
		||||
                        _this.oldMesh = obj;
 | 
			
		||||
                        obj.material = _1.selectMaterial;
 | 
			
		||||
                        _this.m_bNeedUpdate = true;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    return Viewer;
 | 
			
		||||
}());
 | 
			
		||||
exports.Viewer = Viewer;
 | 
			
		||||
//# sourceMappingURL=Viewer.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/Viewer.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/Viewer.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										25
									
								
								dist/createBoard.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								dist/createBoard.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
import { Geometry, LineSegments, Mesh, Shape, Vector2, Vector3 } from 'three';
 | 
			
		||||
export declare class Arc2d {
 | 
			
		||||
    m_StartAn: number;
 | 
			
		||||
    m_EndAn: number;
 | 
			
		||||
    m_StartPoint: Vector2;
 | 
			
		||||
    m_EndPoint: Vector2;
 | 
			
		||||
    m_Center: Vector2;
 | 
			
		||||
    m_Radius: number;
 | 
			
		||||
    constructor(p1: Vector2, p2: Vector2, bul: number);
 | 
			
		||||
}
 | 
			
		||||
export declare function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Shape;
 | 
			
		||||
export declare function getVec(data: object): Vector3;
 | 
			
		||||
export declare function createBoard(boardData: object): {
 | 
			
		||||
    mesh: Mesh;
 | 
			
		||||
    edges: (Mesh | LineSegments)[];
 | 
			
		||||
};
 | 
			
		||||
export declare function createTemplateBoard(brDataList: any[]): {
 | 
			
		||||
    meshs: any[];
 | 
			
		||||
    edgesa: any[];
 | 
			
		||||
    relations: {
 | 
			
		||||
        blockMeshMap: Map<number, number>;
 | 
			
		||||
        meshBlockMap: Map<number, number>;
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
export declare function createEdge(geo: Geometry): LineSegments;
 | 
			
		||||
							
								
								
									
										188
									
								
								dist/createBoard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										188
									
								
								dist/createBoard.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,188 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
var three_1 = require("three");
 | 
			
		||||
var ColorPalette_1 = require("./ColorPalette");
 | 
			
		||||
var GeUtils_1 = require("./GeUtils");
 | 
			
		||||
var Material_1 = require("./Material");
 | 
			
		||||
var RotateUV_1 = require("./RotateUV");
 | 
			
		||||
var ThreeCSG_1 = require("./ThreeCSG");
 | 
			
		||||
//解析二维圆弧类.
 | 
			
		||||
var Arc2d = /** @class */ (function () {
 | 
			
		||||
    function Arc2d(p1, p2, bul) {
 | 
			
		||||
        this.m_StartPoint = p1.clone();
 | 
			
		||||
        this.m_EndPoint = p2.clone();
 | 
			
		||||
        var vec = p2.clone().sub(p1);
 | 
			
		||||
        var len = vec.length();
 | 
			
		||||
        var an = vec.angle();
 | 
			
		||||
        this.m_Radius = len / Math.sin(2 * Math.atan(bul)) / 2;
 | 
			
		||||
        var allAngle = Math.atan(bul) * 4;
 | 
			
		||||
        var delDis = bul * len / 2;
 | 
			
		||||
        var toDis = this.m_Radius - delDis;
 | 
			
		||||
        an += Math.PI * 0.5;
 | 
			
		||||
        this.m_Center = p1.clone().add(p2);
 | 
			
		||||
        this.m_Center.multiplyScalar(0.5);
 | 
			
		||||
        GeUtils_1.polar(this.m_Center, an, toDis);
 | 
			
		||||
        this.m_StartAn = p1.clone().sub(this.m_Center).angle();
 | 
			
		||||
        this.m_EndAn = p2.clone().sub(this.m_Center).angle();
 | 
			
		||||
        if (bul < 0) {
 | 
			
		||||
            //一个神奇的特性 它需要这么做
 | 
			
		||||
            this.m_StartAn -= Math.PI;
 | 
			
		||||
            this.m_EndAn -= Math.PI;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return Arc2d;
 | 
			
		||||
}());
 | 
			
		||||
exports.Arc2d = Arc2d;
 | 
			
		||||
//创建轮廓 通过点表和凸度
 | 
			
		||||
function createPath(pts, buls, shapeOut) {
 | 
			
		||||
    var shape = shapeOut || new three_1.Shape();
 | 
			
		||||
    if (pts.length === 0)
 | 
			
		||||
        return shape;
 | 
			
		||||
    var firstPt = pts[0];
 | 
			
		||||
    shape.moveTo(firstPt.x, firstPt.y);
 | 
			
		||||
    for (var i = 0; i < pts.length - 1; i++) {
 | 
			
		||||
        var nextPt = pts[i + 1];
 | 
			
		||||
        if (buls[i] == 0) {
 | 
			
		||||
            shape.lineTo(nextPt.x, nextPt.y);
 | 
			
		||||
        }
 | 
			
		||||
        else {
 | 
			
		||||
            var pt = pts[i];
 | 
			
		||||
            //参考
 | 
			
		||||
            //http://www.dorodnic.com/blog/tag/three-js/ 绘制一个齿轮
 | 
			
		||||
            //https://www.kirupa.com/html5/drawing_circles_canvas.htm //html5
 | 
			
		||||
            var arc2 = new Arc2d(pt, nextPt, buls[i]);
 | 
			
		||||
            var cen = arc2.m_Center;
 | 
			
		||||
            shape.absarc(cen.x, cen.y, arc2.m_Radius, arc2.m_StartAn, arc2.m_EndAn, buls[i] < 0);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return shape;
 | 
			
		||||
}
 | 
			
		||||
exports.createPath = createPath;
 | 
			
		||||
function getVec(data) {
 | 
			
		||||
    return new three_1.Vector3(data["x"], data["y"], data["z"]);
 | 
			
		||||
}
 | 
			
		||||
exports.getVec = getVec;
 | 
			
		||||
//创建板件 暂时这么写
 | 
			
		||||
function createBoard(boardData) {
 | 
			
		||||
    var _a;
 | 
			
		||||
    var pts = [];
 | 
			
		||||
    var buls = [];
 | 
			
		||||
    var boardPts = boardData["Pts"];
 | 
			
		||||
    var boardBuls = boardData["Buls"];
 | 
			
		||||
    var boardHeight = boardData["H"];
 | 
			
		||||
    var boardMat = new three_1.Matrix4();
 | 
			
		||||
    var matInv = new three_1.Matrix4();
 | 
			
		||||
    //InitBoardMat
 | 
			
		||||
    var xD = getVec(boardData["XVec"]);
 | 
			
		||||
    var yD = getVec(boardData["YVec"]);
 | 
			
		||||
    var ZD = getVec(boardData["ZVec"]);
 | 
			
		||||
    var pBase = getVec(boardData["BasePoint"]);
 | 
			
		||||
    boardMat.makeBasis(xD, yD, ZD);
 | 
			
		||||
    boardMat.setPosition(pBase);
 | 
			
		||||
    matInv.getInverse(boardMat);
 | 
			
		||||
    if (boardPts && boardPts.length !== 0)
 | 
			
		||||
        for (var i = 0; i < boardPts.length; i++) {
 | 
			
		||||
            var pt = getVec(boardPts[i]);
 | 
			
		||||
            if (boardPts[i].z !== undefined)
 | 
			
		||||
                pt.applyMatrix4(matInv);
 | 
			
		||||
            pts.push(new three_1.Vector2(pt.x, pt.y));
 | 
			
		||||
            buls.push(boardBuls[i]);
 | 
			
		||||
        }
 | 
			
		||||
    else {
 | 
			
		||||
        var length_1 = boardData["L"];
 | 
			
		||||
        var width = boardData["W"];
 | 
			
		||||
        var height = boardData["H"];
 | 
			
		||||
        pts.push(new three_1.Vector2(0, 0), new three_1.Vector2(width, 0), new three_1.Vector2(width, length_1), new three_1.Vector2(0, length_1), new three_1.Vector2(0, 0));
 | 
			
		||||
        buls.push(0, 0, 0, 0, 0);
 | 
			
		||||
    }
 | 
			
		||||
    var sp = createPath(pts, buls);
 | 
			
		||||
    var extrudeSettings = {
 | 
			
		||||
        steps: 1,
 | 
			
		||||
        bevelEnabled: false,
 | 
			
		||||
        depth: boardHeight
 | 
			
		||||
    };
 | 
			
		||||
    var ext = new three_1.ExtrudeGeometry(sp, extrudeSettings);
 | 
			
		||||
    ext.computeBoundingSphere();
 | 
			
		||||
    ext.computeBoundingBox();
 | 
			
		||||
    ext.translate(0, 0, -boardHeight);
 | 
			
		||||
    ext.applyMatrix4(boardMat);
 | 
			
		||||
    if (!GeUtils_1.equalv3(xD.clone().cross(yD), ZD)) {
 | 
			
		||||
        for (var _i = 0, _b = ext.faces; _i < _b.length; _i++) {
 | 
			
		||||
            var f = _b[_i];
 | 
			
		||||
            _a = [f.c, f.a], f.a = _a[0], f.c = _a[1];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    //外边.
 | 
			
		||||
    var edges = [createEdge(ext)];
 | 
			
		||||
    //差集
 | 
			
		||||
    if (checkObjectArray(boardData, "SubBoardLocal")
 | 
			
		||||
        || checkObjectArray(boardData, "Drillings")) {
 | 
			
		||||
        var thisCsg = new ThreeCSG_1.ThreeBSP(ext);
 | 
			
		||||
        if (boardData["SubBoardLocal"]) {
 | 
			
		||||
            var subBoardList = boardData["SubBoardLocal"].map(function (d) { return createBoard(d); });
 | 
			
		||||
            for (var _c = 0, subBoardList_1 = subBoardList; _c < subBoardList_1.length; _c++) {
 | 
			
		||||
                var br = subBoardList_1[_c];
 | 
			
		||||
                edges.push.apply(edges, br.edges);
 | 
			
		||||
                var subCsg = new ThreeCSG_1.ThreeBSP(br.mesh);
 | 
			
		||||
                thisCsg = thisCsg.subtract(subCsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (boardData["Drillings"]) {
 | 
			
		||||
            var dris = boardData["Drillings"];
 | 
			
		||||
            for (var _d = 0, dris_1 = dris; _d < dris_1.length; _d++) {
 | 
			
		||||
                var dri = dris_1[_d];
 | 
			
		||||
                var geo = new three_1.CylinderGeometry(dri.r, dri.r, dri.h, 8);
 | 
			
		||||
                geo.rotateX(Math.PI * 0.5);
 | 
			
		||||
                if (dri.f === 0) //0正
 | 
			
		||||
                    geo.translate(dri.x, dri.y, -dri.h * 0.5);
 | 
			
		||||
                else //1反
 | 
			
		||||
                    geo.translate(dri.x, dri.y, dri.h * 0.5 - boardData["H"]);
 | 
			
		||||
                geo.applyMatrix4(boardMat);
 | 
			
		||||
                var mesh_1 = new three_1.Mesh(geo, ColorPalette_1.ColorMaterial.GetBasicMaterial(1));
 | 
			
		||||
                edges.push(mesh_1);
 | 
			
		||||
                // let edge = createEdge(geo);
 | 
			
		||||
                // edge.material = new LineBasicMaterial({ color: new Color(1, 0, 0) });
 | 
			
		||||
                // edges.push(edge);
 | 
			
		||||
                // let subCsg = new ThreeBSP(geo);
 | 
			
		||||
                // thisCsg = thisCsg.subtract(subCsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ext = thisCsg.toGeometry();
 | 
			
		||||
    }
 | 
			
		||||
    if (boardData["BoardName"] === "地脚线")
 | 
			
		||||
        RotateUV_1.RotateUVs(ext);
 | 
			
		||||
    var mesh = new three_1.Mesh(ext, Material_1.boardMaterial);
 | 
			
		||||
    mesh.userData = ZD;
 | 
			
		||||
    edges.forEach(function (e) { return e.userData = ZD; });
 | 
			
		||||
    return { mesh: mesh, edges: edges };
 | 
			
		||||
}
 | 
			
		||||
exports.createBoard = createBoard;
 | 
			
		||||
function checkObjectArray(obj, key) {
 | 
			
		||||
    return obj[key] && obj[key].length > 0;
 | 
			
		||||
}
 | 
			
		||||
function createTemplateBoard(brDataList) {
 | 
			
		||||
    var meshs = [];
 | 
			
		||||
    var edgesa = [];
 | 
			
		||||
    var relations = {
 | 
			
		||||
        blockMeshMap: new Map(),
 | 
			
		||||
        meshBlockMap: new Map()
 | 
			
		||||
    };
 | 
			
		||||
    for (var _i = 0, brDataList_1 = brDataList; _i < brDataList_1.length; _i++) {
 | 
			
		||||
        var d = brDataList_1[_i];
 | 
			
		||||
        var _a = createBoard(d), mesh = _a.mesh, edges = _a.edges;
 | 
			
		||||
        meshs.push(mesh);
 | 
			
		||||
        edgesa.push.apply(edgesa, edges);
 | 
			
		||||
        if (d['DataID']) {
 | 
			
		||||
            relations.blockMeshMap.set(d['DataID'], mesh.id);
 | 
			
		||||
            relations.meshBlockMap.set(mesh.id, d['DataID']);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return { meshs: meshs, edgesa: edgesa, relations: relations };
 | 
			
		||||
}
 | 
			
		||||
exports.createTemplateBoard = createTemplateBoard;
 | 
			
		||||
function createEdge(geo) {
 | 
			
		||||
    var edge = new three_1.EdgesGeometry(geo, 1);
 | 
			
		||||
    return new three_1.LineSegments(edge, Material_1.edgeMaterial);
 | 
			
		||||
}
 | 
			
		||||
exports.createEdge = createEdge;
 | 
			
		||||
//# sourceMappingURL=createBoard.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/createBoard.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/createBoard.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										75
									
								
								dist/data.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										75
									
								
								dist/data.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,75 @@
 | 
			
		||||
export declare var data: ({
 | 
			
		||||
    L: number;
 | 
			
		||||
    W: number;
 | 
			
		||||
    H: number;
 | 
			
		||||
    BasePoint: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    XVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    YVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    ZVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    Pts: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    }[];
 | 
			
		||||
    Buls: number[];
 | 
			
		||||
    SubBoardLocal: any[];
 | 
			
		||||
    SubBoardAssoc: any[];
 | 
			
		||||
    MaterialId?: undefined;
 | 
			
		||||
    Handle?: undefined;
 | 
			
		||||
    CabName?: undefined;
 | 
			
		||||
    BoardName?: undefined;
 | 
			
		||||
    Grain?: undefined;
 | 
			
		||||
} | {
 | 
			
		||||
    L: number;
 | 
			
		||||
    W: number;
 | 
			
		||||
    H: number;
 | 
			
		||||
    MaterialId: string;
 | 
			
		||||
    BasePoint: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    XVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    YVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    ZVec: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    };
 | 
			
		||||
    Handle: string;
 | 
			
		||||
    CabName: string;
 | 
			
		||||
    BoardName: string;
 | 
			
		||||
    Grain: number;
 | 
			
		||||
    Pts: {
 | 
			
		||||
        x: number;
 | 
			
		||||
        y: number;
 | 
			
		||||
        z: number;
 | 
			
		||||
    }[];
 | 
			
		||||
    Buls: number[];
 | 
			
		||||
    SubBoardLocal: any[];
 | 
			
		||||
    SubBoardAssoc: any[];
 | 
			
		||||
})[];
 | 
			
		||||
							
								
								
									
										552
									
								
								dist/data.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										552
									
								
								dist/data.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,552 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
exports.data = [
 | 
			
		||||
    {
 | 
			
		||||
        "L": 100.0,
 | 
			
		||||
        "W": 800.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2076.407626150509,
 | 
			
		||||
            "y": 1942.2104819571228,
 | 
			
		||||
            "z": 1882.0
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 4.930380657631324e-32,
 | 
			
		||||
            "z": -2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": 2.220446049250313e-16,
 | 
			
		||||
            "y": 2.220446049250313e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 9.860761315262648e-32,
 | 
			
		||||
            "y": -1.0,
 | 
			
		||||
            "z": 2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1882.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1881.9999999999998
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1981.9999999999998
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1982.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1882.0
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 800.0,
 | 
			
		||||
        "W": 100.00000000000068,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2876.407626150509,
 | 
			
		||||
            "y": 1960.2104819571226,
 | 
			
		||||
            "z": 1900.0000000000005
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.440892098500626e-16,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 2.2204460492503124e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -1.0,
 | 
			
		||||
            "y": 4.440892098500626e-16,
 | 
			
		||||
            "z": 2.220446049250314e-16
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 2.220446049250313e-16,
 | 
			
		||||
            "y": -2.220446049250313e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "293",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 2060.210481957123,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.210481957123,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.210481957123,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 1899.9999999999998,
 | 
			
		||||
        "W": 800.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2076.407626150509,
 | 
			
		||||
            "y": 2060.2104819571225,
 | 
			
		||||
            "z": -1.816324868286756e-13
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 4.440892098500626e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": -1.0,
 | 
			
		||||
            "z": 4.440892098500626e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "291",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "背板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": -1.021405182655144e-13
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": -1.816324868286756e-13
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 2060.210481957123,
 | 
			
		||||
                "z": 1899.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.210481957123,
 | 
			
		||||
                "z": 1899.9999999999998
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": -1.021405182655144e-13
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 800.0,
 | 
			
		||||
        "W": 482.0000000000002,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2876.407626150509,
 | 
			
		||||
            "y": 1578.210481957122,
 | 
			
		||||
            "z": 97.99999999999999
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.440892098500626e-16,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -1.0,
 | 
			
		||||
            "y": 4.440892098500626e-16,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "290",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "底板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1578.210481957122,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1578.2104819571226,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1578.210481957122,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 80.0,
 | 
			
		||||
        "W": 800.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2076.407626150509,
 | 
			
		||||
            "y": 1578.2104819571223,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 4.440892098500626e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": -1.0,
 | 
			
		||||
            "z": 4.440892098500626e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "28E",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "地脚线",
 | 
			
		||||
        "Grain": 1,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 80.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 80.0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 800.0,
 | 
			
		||||
        "W": 482.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2876.4076261505085,
 | 
			
		||||
            "y": 1478.210481957122,
 | 
			
		||||
            "z": 1999.9999999999996
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.440892098500626e-16,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -1.0,
 | 
			
		||||
            "y": 4.440892098500626e-16,
 | 
			
		||||
            "z": 0.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 0.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "28C",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "顶板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.2104819571223,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1478.2104819571226,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1478.210481957122,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2876.4076261505085,
 | 
			
		||||
                "y": 1960.210481957122,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.2104819571223,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 1999.9999999999996,
 | 
			
		||||
        "W": 600.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2894.4076261505094,
 | 
			
		||||
            "y": 1478.2104819571223,
 | 
			
		||||
            "z": -2.2737367544323197e-13
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.930380657631324e-32,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": -2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -2.220446049250313e-16,
 | 
			
		||||
            "y": 2.220446049250313e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "28B",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "右侧板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1899.9999999999989
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1999.9999999999994
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.407626150509,
 | 
			
		||||
                "y": 1478.2104819571228,
 | 
			
		||||
                "z": 1999.9999999999994
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.4076261505094,
 | 
			
		||||
                "y": 1478.2104819571223,
 | 
			
		||||
                "z": -1.816324868286755e-13
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.4076261505094,
 | 
			
		||||
                "y": 2078.2104819571225,
 | 
			
		||||
                "z": -6.274980535181384e-13
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.407626150509,
 | 
			
		||||
                "y": 2078.2104819571229,
 | 
			
		||||
                "z": 1899.9999999999973
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2894.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1899.9999999999989
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "L": 1999.9999999999996,
 | 
			
		||||
        "W": 600.0,
 | 
			
		||||
        "H": 18.0,
 | 
			
		||||
        "MaterialId": "EE",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 2076.4076261505094,
 | 
			
		||||
            "y": 1478.2104819571223,
 | 
			
		||||
            "z": 1.0097419586828951e-28
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.930380657631324e-32,
 | 
			
		||||
            "y": 1.0,
 | 
			
		||||
            "z": -2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -2.220446049250313e-16,
 | 
			
		||||
            "y": 2.220446049250313e-16,
 | 
			
		||||
            "z": 1.0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 1.0,
 | 
			
		||||
            "y": 0.0,
 | 
			
		||||
            "z": 2.220446049250313e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Handle": "288",
 | 
			
		||||
        "CabName": "1.标准柜上梁1",
 | 
			
		||||
        "BoardName": "左侧板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "Pts": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1899.999999999999
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1478.2104819571228,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.4076261505094,
 | 
			
		||||
                "y": 1478.2104819571223,
 | 
			
		||||
                "z": 1.0097419586828951e-28
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.4076261505094,
 | 
			
		||||
                "y": 2078.2104819571225,
 | 
			
		||||
                "z": -4.4586556668946279e-13
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2078.2104819571229,
 | 
			
		||||
                "z": 1899.9999999999978
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1960.2104819571228,
 | 
			
		||||
                "z": 1899.999999999999
 | 
			
		||||
            }
 | 
			
		||||
        ],
 | 
			
		||||
        "Buls": [
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0,
 | 
			
		||||
            0.0
 | 
			
		||||
        ],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": []
 | 
			
		||||
    }
 | 
			
		||||
];
 | 
			
		||||
//# sourceMappingURL=data.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/data.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/data.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										9
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								dist/index.d.ts
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,9 @@
 | 
			
		||||
export * from "./Viewer";
 | 
			
		||||
export * from "./CameraControls";
 | 
			
		||||
export * from "./GeUtils";
 | 
			
		||||
export * from "./createBoard";
 | 
			
		||||
export * from "./Dimension";
 | 
			
		||||
export * from "./DrawDimension";
 | 
			
		||||
export * from "./Material";
 | 
			
		||||
export * from "./PointPick";
 | 
			
		||||
export * from "./Utils";
 | 
			
		||||
							
								
								
									
										15
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								dist/index.js
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
function __export(m) {
 | 
			
		||||
    for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
 | 
			
		||||
}
 | 
			
		||||
Object.defineProperty(exports, "__esModule", { value: true });
 | 
			
		||||
__export(require("./Viewer"));
 | 
			
		||||
__export(require("./CameraControls"));
 | 
			
		||||
__export(require("./GeUtils"));
 | 
			
		||||
__export(require("./createBoard"));
 | 
			
		||||
__export(require("./Dimension"));
 | 
			
		||||
__export(require("./DrawDimension"));
 | 
			
		||||
__export(require("./Material"));
 | 
			
		||||
__export(require("./PointPick"));
 | 
			
		||||
__export(require("./Utils"));
 | 
			
		||||
//# sourceMappingURL=index.js.map
 | 
			
		||||
							
								
								
									
										1
									
								
								dist/index.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								dist/index.js.map
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;AAAA,8BAAyB;AACzB,sCAAiC;AACjC,+BAA0B;AAC1B,mCAA8B;AAC9B,iCAA4B;AAC5B,qCAAgC;AAChC,gCAA2B;AAC3B,iCAA2B;AAC3B,6BAAuB"}
 | 
			
		||||
							
								
								
									
										4444
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4444
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										91
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										91
									
								
								package.json
									
									
									
									
									
								
							@@ -1,45 +1,50 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "cadview",
 | 
			
		||||
  "version": "1.2.0",
 | 
			
		||||
  "description": "",
 | 
			
		||||
  "main": "src/index.ts",
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "build": "tsc",
 | 
			
		||||
    "umd": "webpack --config ./config/webpack.umd.ts",
 | 
			
		||||
    "dev": "webpack-dev-server --config ./config/webpack.view.ts",
 | 
			
		||||
    "type": "ts-node ./utils/copy_type.ts"
 | 
			
		||||
  },
 | 
			
		||||
  "repository": {
 | 
			
		||||
    "type": "git",
 | 
			
		||||
    "url": "http://git.cf/cx/CADViewComponent.git"
 | 
			
		||||
  },
 | 
			
		||||
  "author": "cx",
 | 
			
		||||
  "license": "ISC",
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@types/hard-source-webpack-plugin": "^0.9.0",
 | 
			
		||||
    "@types/node": "^10.11.7",
 | 
			
		||||
    "@types/uglifyjs-webpack-plugin": "^1.1.0",
 | 
			
		||||
    "@types/webpack": "^4.4.16",
 | 
			
		||||
    "@types/webpack-dev-server": "^3.1.1",
 | 
			
		||||
    "@types/webpack-env": "^1.13.6",
 | 
			
		||||
    "@types/webpack-merge": "^4.1.3",
 | 
			
		||||
    "awesome-typescript-loader": "^5.2.1",
 | 
			
		||||
    "fork-ts-checker-webpack-plugin": "^0.4.8",
 | 
			
		||||
    "hard-source-webpack-plugin": "^0.12.0",
 | 
			
		||||
    "html-webpack-plugin": "^3.2.0",
 | 
			
		||||
    "ts-loader": "^5.2.1",
 | 
			
		||||
    "ts-node": "^7.0.1",
 | 
			
		||||
    "typescript": "^3.7.5",
 | 
			
		||||
    "uglifyjs-webpack-plugin": "^2.0.1",
 | 
			
		||||
    "webpack": "^4.20.2",
 | 
			
		||||
    "webpack-cli": "^3.1.2",
 | 
			
		||||
    "webpack-dev-server": "^3.1.9",
 | 
			
		||||
    "webpack-merge": "^4.1.4"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@types/three": "^0.92.25",
 | 
			
		||||
    "three": "^0.95.0",
 | 
			
		||||
    "wolfy87-eventemitter": "^5.2.5"
 | 
			
		||||
  }
 | 
			
		||||
    "name": "cadview",
 | 
			
		||||
    "version": "1.1.9",
 | 
			
		||||
    "description": "",
 | 
			
		||||
    "main": "src/index.ts",
 | 
			
		||||
    "private": true,
 | 
			
		||||
    "scripts": {
 | 
			
		||||
        "t": "tsc --noEmit -w",
 | 
			
		||||
        "build": "tsc",
 | 
			
		||||
        "umd": "webpack --config ./config/webpack.umd.ts",
 | 
			
		||||
        "dev": "webpack-dev-server --config ./config/webpack.view.ts",
 | 
			
		||||
        "rmtype": "ts-node ./utils/rmtype.ts"
 | 
			
		||||
    },
 | 
			
		||||
    "repository": {
 | 
			
		||||
        "type": "git",
 | 
			
		||||
        "url": "http://git.cf/cx/CADViewComponent.git"
 | 
			
		||||
    },
 | 
			
		||||
    "author": "cx",
 | 
			
		||||
    "license": "ISC",
 | 
			
		||||
    "devDependencies": {
 | 
			
		||||
        "@types/hard-source-webpack-plugin": "^1.0.1",
 | 
			
		||||
        "@types/node": "^13.13.52",
 | 
			
		||||
        "@types/three": "^0.103.2",
 | 
			
		||||
        "@types/uglifyjs-webpack-plugin": "^1.1.0",
 | 
			
		||||
        "@types/webpack": "^4.41.32",
 | 
			
		||||
        "@types/webpack-env": "^1.18.0",
 | 
			
		||||
        "awesome-typescript-loader": "^5.2.1",
 | 
			
		||||
        "cache-loader": "^4.1.0",
 | 
			
		||||
        "fork-ts-checker-webpack-plugin": "^4.1.6",
 | 
			
		||||
        "hard-source-webpack-plugin": "^0.13.1",
 | 
			
		||||
        "html-webpack-plugin": "^4.5.2",
 | 
			
		||||
        "ts-loader": "^7.0.5",
 | 
			
		||||
        "ts-node": "^8.10.2",
 | 
			
		||||
        "typescript": "^4.5.5",
 | 
			
		||||
        "uglifyjs-webpack-plugin": "^2.2.0",
 | 
			
		||||
        "webpack": "^5.75.0",
 | 
			
		||||
        "webpack-cli": "^4.10.0",
 | 
			
		||||
        "webpack-dev-server": "^4.11.1",
 | 
			
		||||
        "webpack-merge": "^5.8.0"
 | 
			
		||||
    },
 | 
			
		||||
    "dependencies": {
 | 
			
		||||
        "@jscad/modeling": "^2.11.0",
 | 
			
		||||
        "flatbush": "^3.3.0",
 | 
			
		||||
        "three": "npm:three-cf@0.122.5",
 | 
			
		||||
        "js-angusj-clipper": "^1.2.1",
 | 
			
		||||
        "polylabel": "^1.1.0",
 | 
			
		||||
        "xaop": "^2.0.0",
 | 
			
		||||
        "webcad_ue4_api": "http://gitea.cf/cx/webcad-ue4-api/archive/3.2.4.tar.gz"
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -56,7 +56,6 @@ export class CameraControls
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 窗体失去焦点时.
 | 
			
		||||
     * 
 | 
			
		||||
     * @memberof CameraControls
 | 
			
		||||
     */
 | 
			
		||||
    onBlur = () =>
 | 
			
		||||
@@ -136,7 +135,7 @@ export class CameraControls
 | 
			
		||||
 | 
			
		||||
    //最后一次按中键的时间
 | 
			
		||||
    lastMiddleClickTime = 0;
 | 
			
		||||
    //鼠标    
 | 
			
		||||
    //鼠标
 | 
			
		||||
    onMouseDown = (event: MouseEvent) =>
 | 
			
		||||
    {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
@@ -220,12 +219,11 @@ export class CameraControls
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 鼠标滚轮事件
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @memberof CameraControls
 | 
			
		||||
     */
 | 
			
		||||
    onMouseWheel = (event: WheelEvent) =>
 | 
			
		||||
    {
 | 
			
		||||
        event.preventDefault();
 | 
			
		||||
        event.stopPropagation();
 | 
			
		||||
 | 
			
		||||
        let pt = new THREE.Vector3(event.offsetX, event.offsetY, 0);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,21 +1,20 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { Vector3 } from 'three';
 | 
			
		||||
import { Box3, Camera, MathUtils, OrthographicCamera, PerspectiveCamera, Vector3 } from 'three';
 | 
			
		||||
import { Orbit } from './Orbit';
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * 相机的控制.
 | 
			
		||||
 * ->切换相机
 | 
			
		||||
 * ->设置视口大小
 | 
			
		||||
 * ->旋转和移动相机.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class ViewCameraManage
 | 
			
		||||
 */
 | 
			
		||||
export class CameraUpdate
 | 
			
		||||
{
 | 
			
		||||
    private m_CurCamera: THREE.Camera;
 | 
			
		||||
    private m_CameraArray: Map<any, THREE.Camera> = new Map<any, THREE.Camera>();
 | 
			
		||||
    private m_CurCamera: Camera;
 | 
			
		||||
    private m_CameraArray: Map<any, Camera> = new Map<any, Camera>();
 | 
			
		||||
 | 
			
		||||
    //视口的画布大小
 | 
			
		||||
    private m_Width: number;
 | 
			
		||||
@@ -24,9 +23,9 @@ export class CameraUpdate
 | 
			
		||||
    private m_ViewHeight: number = 10;
 | 
			
		||||
 | 
			
		||||
    //观察的位置
 | 
			
		||||
    private m_Target: THREE.Vector3 = new THREE.Vector3();
 | 
			
		||||
    private m_Target: Vector3 = new Vector3();
 | 
			
		||||
    //观察向量
 | 
			
		||||
    private m_Direction: THREE.Vector3 = new THREE.Vector3(0, 0, -1);
 | 
			
		||||
    private m_Direction: Vector3 = new Vector3(0, 0, -1);
 | 
			
		||||
    //观察的轨道.
 | 
			
		||||
    private m_Orbit: Orbit = new Orbit();
 | 
			
		||||
 | 
			
		||||
@@ -35,12 +34,12 @@ export class CameraUpdate
 | 
			
		||||
 | 
			
		||||
    constructor()
 | 
			
		||||
    {
 | 
			
		||||
        this.m_CameraArray.set(THREE.OrthographicCamera, new THREE.OrthographicCamera(-2, 2, 2, -2,
 | 
			
		||||
        this.m_CameraArray.set(OrthographicCamera, new OrthographicCamera(-2, 2, 2, -2,
 | 
			
		||||
            -1e6, 1e6));
 | 
			
		||||
 | 
			
		||||
        this.m_CameraArray.set(THREE.PerspectiveCamera, new THREE.PerspectiveCamera(50, 1, 0.01, 10000));
 | 
			
		||||
        this.m_CameraArray.set(PerspectiveCamera, new PerspectiveCamera(50, 1, 0.01, 10000));
 | 
			
		||||
 | 
			
		||||
        this.m_CurCamera = this.m_CameraArray.get(THREE.OrthographicCamera);
 | 
			
		||||
        this.m_CurCamera = this.m_CameraArray.get(OrthographicCamera);
 | 
			
		||||
 | 
			
		||||
        this.m_Orbit.UpdateRoValue(this.m_Direction);
 | 
			
		||||
 | 
			
		||||
@@ -53,7 +52,7 @@ export class CameraUpdate
 | 
			
		||||
        return this.m_Width / this.m_Height;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    get Camera(): THREE.Camera
 | 
			
		||||
    get Camera(): Camera
 | 
			
		||||
    {
 | 
			
		||||
        return this.m_CurCamera;
 | 
			
		||||
    }
 | 
			
		||||
@@ -63,7 +62,7 @@ export class CameraUpdate
 | 
			
		||||
    }
 | 
			
		||||
    set ViewHeight(height)
 | 
			
		||||
    {
 | 
			
		||||
        this.m_ViewHeight = THREE.Math.clamp(height, this.m_MinViewHeight, this.m_MaxViewHeight);
 | 
			
		||||
        this.m_ViewHeight = MathUtils.clamp(height, this.m_MinViewHeight, this.m_MaxViewHeight);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    SetSize(width: number, height: number)
 | 
			
		||||
@@ -74,11 +73,11 @@ export class CameraUpdate
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 平移相机.
 | 
			
		||||
     * 
 | 
			
		||||
     * @param {THREE.Vector3} mouseMove
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} mouseMove
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    Pan(mouseMove: THREE.Vector3)
 | 
			
		||||
    Pan(mouseMove: Vector3)
 | 
			
		||||
    {
 | 
			
		||||
        mouseMove.y *= -1;
 | 
			
		||||
        mouseMove.multiplyScalar(-this.m_ViewHeight / this.m_Height);
 | 
			
		||||
@@ -86,7 +85,7 @@ export class CameraUpdate
 | 
			
		||||
        this.m_Target.add(mouseMove);
 | 
			
		||||
        this.Update();
 | 
			
		||||
    }
 | 
			
		||||
    Rotate(mouseMove: THREE.Vector3, target: THREE.Vector3)
 | 
			
		||||
    Rotate(mouseMove: Vector3, target: Vector3)
 | 
			
		||||
    {
 | 
			
		||||
        this.m_Orbit.RoX -= mouseMove.y * 0.003;
 | 
			
		||||
        this.m_Orbit.RoZ -= mouseMove.x * 0.003;
 | 
			
		||||
@@ -112,9 +111,9 @@ export class CameraUpdate
 | 
			
		||||
 | 
			
		||||
        this.Update();
 | 
			
		||||
    }
 | 
			
		||||
    Zoom(scale: number, scaleCenter?: THREE.Vector3)
 | 
			
		||||
    Zoom(scale: number, scaleCenter?: Vector3)
 | 
			
		||||
    {
 | 
			
		||||
        if (this.Camera instanceof THREE.OrthographicCamera)
 | 
			
		||||
        if (this.Camera instanceof OrthographicCamera)
 | 
			
		||||
        {
 | 
			
		||||
            this.ViewHeight *= scale;
 | 
			
		||||
            if (scaleCenter && this.m_ViewHeight < this.m_MaxViewHeight)
 | 
			
		||||
@@ -124,7 +123,7 @@ export class CameraUpdate
 | 
			
		||||
                this.m_Target.add(scaleCenter);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        else if (this.Camera instanceof THREE.PerspectiveCamera)
 | 
			
		||||
        else if (this.Camera instanceof PerspectiveCamera)
 | 
			
		||||
        {
 | 
			
		||||
            let add = scale > 1 ? 1 : -1;
 | 
			
		||||
            add *= this.Camera.position.distanceTo(this.m_Target) / 10;
 | 
			
		||||
@@ -132,7 +131,7 @@ export class CameraUpdate
 | 
			
		||||
        }
 | 
			
		||||
        this.Update();
 | 
			
		||||
    }
 | 
			
		||||
    ZoomExtensBox3(box3: THREE.Box3)
 | 
			
		||||
    ZoomExtensBox3(box3: Box3)
 | 
			
		||||
    {
 | 
			
		||||
        if (!box3 || box3.isEmpty()) return;
 | 
			
		||||
        this.Camera.updateMatrixWorld(false);
 | 
			
		||||
@@ -159,7 +158,7 @@ export class CameraUpdate
 | 
			
		||||
        }
 | 
			
		||||
        this.Update();
 | 
			
		||||
    }
 | 
			
		||||
    LookAt(dir: THREE.Vector3)
 | 
			
		||||
    LookAt(dir: Vector3)
 | 
			
		||||
    {
 | 
			
		||||
        this.m_Orbit.UpdateRoValue(dir);
 | 
			
		||||
        this.m_Direction.copy(dir);
 | 
			
		||||
@@ -173,15 +172,15 @@ export class CameraUpdate
 | 
			
		||||
    }
 | 
			
		||||
    /**
 | 
			
		||||
     * 根据视口大小,设置相机视口范围.
 | 
			
		||||
     * 
 | 
			
		||||
     * @returns 
 | 
			
		||||
     *
 | 
			
		||||
     * @returns
 | 
			
		||||
     * @memberof CameraControl
 | 
			
		||||
     */
 | 
			
		||||
    Update()
 | 
			
		||||
    {
 | 
			
		||||
        this.Camera.position.copy(this.m_Target);
 | 
			
		||||
 | 
			
		||||
        if (this.Camera instanceof THREE.OrthographicCamera)
 | 
			
		||||
        if (this.Camera instanceof OrthographicCamera)
 | 
			
		||||
        {
 | 
			
		||||
            this.Camera.left = this.Aspect * this.m_ViewHeight / -2;
 | 
			
		||||
            this.Camera.right = this.Aspect * this.m_ViewHeight / 2;
 | 
			
		||||
@@ -190,10 +189,10 @@ export class CameraUpdate
 | 
			
		||||
 | 
			
		||||
            this.Camera.position.sub(this.m_Direction);
 | 
			
		||||
        }
 | 
			
		||||
        else if (this.Camera instanceof THREE.PerspectiveCamera)
 | 
			
		||||
        else if (this.Camera instanceof PerspectiveCamera)
 | 
			
		||||
        {
 | 
			
		||||
            this.Camera.aspect = this.Aspect;
 | 
			
		||||
            let distens = (this.m_ViewHeight / 2) / (Math.tan(THREE.Math.degToRad(this.Camera.fov) / 2));
 | 
			
		||||
            let distens = (this.m_ViewHeight / 2) / (Math.tan(MathUtils.degToRad(this.Camera.fov) / 2));
 | 
			
		||||
 | 
			
		||||
            this.Camera.position.sub(this.m_Direction.clone().multiplyScalar(distens));
 | 
			
		||||
        }
 | 
			
		||||
@@ -209,13 +208,13 @@ export class CameraUpdate
 | 
			
		||||
 | 
			
		||||
    SwitchCamera()
 | 
			
		||||
    {
 | 
			
		||||
        if (this.Camera instanceof THREE.OrthographicCamera)
 | 
			
		||||
        if (this.Camera instanceof OrthographicCamera)
 | 
			
		||||
        {
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(THREE.PerspectiveCamera);
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(PerspectiveCamera);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(THREE.OrthographicCamera);
 | 
			
		||||
            this.m_CurCamera = this.m_CameraArray.get(OrthographicCamera);
 | 
			
		||||
        }
 | 
			
		||||
        this.UpdateUp();
 | 
			
		||||
        this.Update();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { LineBasicMaterial, MeshBasicMaterial, Color } from 'three';
 | 
			
		||||
import { Color, LineBasicMaterial, MeshBasicMaterial } from 'three';
 | 
			
		||||
const ColorPalette = [
 | 
			
		||||
    [255, 0, 0, 255],    //----- 0 - lets make it red for an example
 | 
			
		||||
    //[255, 255, 255, 255],//----- 0 - ByBlock - White
 | 
			
		||||
@@ -284,7 +284,7 @@ export class ColorMaterial
 | 
			
		||||
    {
 | 
			
		||||
        if (this.m_BasicMaterialMap.has(index))
 | 
			
		||||
            return this.m_BasicMaterialMap.get(index);
 | 
			
		||||
        let mat = new MeshBasicMaterial({ color: this.GetColor(index) });
 | 
			
		||||
        let mat = new MeshBasicMaterial({ color: this.GetColor(index), side: THREE.DoubleSide });
 | 
			
		||||
        this.m_BasicMaterialMap.set(index, mat);
 | 
			
		||||
        return mat;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -5,7 +5,6 @@ import { MoveMatrix } from "./GeUtils";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 标注实体
 | 
			
		||||
 * 
 | 
			
		||||
 * @export
 | 
			
		||||
 * @class Dimension
 | 
			
		||||
 * @extends {Group}
 | 
			
		||||
@@ -42,12 +41,12 @@ export class Dimension extends Group
 | 
			
		||||
        if (mirror)
 | 
			
		||||
        {
 | 
			
		||||
            let roMat = new Matrix4().makeRotationZ(Math.PI);
 | 
			
		||||
            text.applyMatrix(roMat);
 | 
			
		||||
            text.applyMatrix(MoveMatrix(new Vector3(length * 0.5, footLength - textHeight * 0.1)));
 | 
			
		||||
            text.applyMatrix4(roMat);
 | 
			
		||||
            text.applyMatrix4(MoveMatrix(new Vector3(length * 0.5, footLength - textHeight * 0.1)));
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            text.applyMatrix(MoveMatrix(new Vector3(length * 0.5, footLength * 1.1)));
 | 
			
		||||
            text.applyMatrix4(MoveMatrix(new Vector3(length * 0.5, footLength * 1.1)));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,12 +1,12 @@
 | 
			
		||||
import { Box3, Vector3, Matrix4, Mesh } from "three";
 | 
			
		||||
import { Box3, Matrix4, Mesh, Vector3 } from "three";
 | 
			
		||||
import { Dimension, GetBoxArr } from ".";
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 绘制标注实体
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Box3} box 
 | 
			
		||||
 * @param {Box3} box
 | 
			
		||||
 * @returns 标注实体列表
 | 
			
		||||
 */
 | 
			
		||||
export function DrawDimension(brList: Mesh[]): Dimension[]
 | 
			
		||||
@@ -24,7 +24,7 @@ export function DrawDimension(brList: Mesh[]): Dimension[]
 | 
			
		||||
 | 
			
		||||
    let textHeight = 45;
 | 
			
		||||
    let dimx = new Dimension(size.x, textHeight, true);
 | 
			
		||||
    dimx.applyMatrix(mat4);
 | 
			
		||||
    dimx.applyMatrix4(mat4);
 | 
			
		||||
 | 
			
		||||
    let dimz = new Dimension(size.z, textHeight);
 | 
			
		||||
    mat4.makeBasis(
 | 
			
		||||
@@ -33,7 +33,7 @@ export function DrawDimension(brList: Mesh[]): Dimension[]
 | 
			
		||||
        new Vector3(0, -1, 0)
 | 
			
		||||
    )
 | 
			
		||||
    mat4.setPosition(box.max.clone().add(new Vector3(30, -size.y)));
 | 
			
		||||
    dimz.applyMatrix(mat4);
 | 
			
		||||
    dimz.applyMatrix4(mat4);
 | 
			
		||||
 | 
			
		||||
    let dimy = new Dimension(size.y, textHeight, true, true);
 | 
			
		||||
    mat4.makeBasis(
 | 
			
		||||
@@ -42,7 +42,7 @@ export function DrawDimension(brList: Mesh[]): Dimension[]
 | 
			
		||||
        new Vector3(0, 0, 1)
 | 
			
		||||
    )
 | 
			
		||||
    mat4.setPosition(box.max.clone().add(new Vector3(30, -size.y)));
 | 
			
		||||
    dimy.applyMatrix(mat4);
 | 
			
		||||
    dimy.applyMatrix4(mat4);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return [dimx, dimy, dimz];
 | 
			
		||||
 
 | 
			
		||||
@@ -1,16 +1,15 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { Geometry, Vector, Vector2, Vector3, Box3 } from 'three';
 | 
			
		||||
import { Geometry, Vector, Vector2, Vector3, Box3, Matrix4, Object3D, Line, Mesh } from 'three';
 | 
			
		||||
import { Matrix2 } from './Matrix2';
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
export const cZeroVec = new THREE.Vector3();
 | 
			
		||||
export const cXAxis = new THREE.Vector3(1, 0, 0);
 | 
			
		||||
export const cYAxis = new THREE.Vector3(0, 1, 0);
 | 
			
		||||
export const cZAxis = new THREE.Vector3(0, 0, 1);
 | 
			
		||||
export const cZeroVec = new Vector3();
 | 
			
		||||
export const cXAxis = new Vector3(1, 0, 0);
 | 
			
		||||
export const cYAxis = new Vector3(0, 1, 0);
 | 
			
		||||
export const cZAxis = new Vector3(0, 0, 1);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 旋转一个点,旋转中心在原点
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {Vector3} pt 点
 | 
			
		||||
 * @param {number} ang 角度.
 | 
			
		||||
@@ -26,6 +25,12 @@ export function equaln(v1: number, v2: number, fuzz = 1e-3)
 | 
			
		||||
{
 | 
			
		||||
    return Math.abs(v1 - v2) < fuzz;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function equalv3(v1: Vector3, v2: Vector3, fuzz = 1e-8)
 | 
			
		||||
{
 | 
			
		||||
    return equaln(v1.x, v2.x, fuzz) && equaln(v1.y, v2.y, fuzz) && equaln(v1.z, v2.z, fuzz);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function equal<T extends Vector>(v1: T, v2: T)
 | 
			
		||||
{
 | 
			
		||||
    return v1.distanceToSquared(v2) < 1e-8;
 | 
			
		||||
@@ -50,13 +55,13 @@ export function fixAngle(an: number, fixAngle: number, fuzz: number = 0.1)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 按照极坐标的方式移动一个点
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @template 
 | 
			
		||||
 * @template
 | 
			
		||||
 * @param {T} v 向量(2d,3d)
 | 
			
		||||
 * @param {number} an 角度
 | 
			
		||||
 * @param {number} dis 距离
 | 
			
		||||
 * @returns {T} 
 | 
			
		||||
 * @returns {T}
 | 
			
		||||
 */
 | 
			
		||||
export function polar<T extends Vector2 | Vector3>(v: T, an: number, dis: number): T
 | 
			
		||||
{
 | 
			
		||||
@@ -76,22 +81,22 @@ export function angle(v: Vector3 | Vector2)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 求两个向量的夹角,顺时针为负,逆时针为正
 | 
			
		||||
 * 
 | 
			
		||||
 * @param {THREE.Vector3} v1 
 | 
			
		||||
 * @param {THREE.Vector3} v2 
 | 
			
		||||
 * @param {THREE.Vector3} [ref] 参考向量,如果为世界坐标系则为0,0,1
 | 
			
		||||
 * @returns 
 | 
			
		||||
 *
 | 
			
		||||
 * @param {Vector3} v1
 | 
			
		||||
 * @param {Vector3} v2
 | 
			
		||||
 * @param {Vector3} [ref] 参考向量,如果为世界坐标系则为0,0,1
 | 
			
		||||
 * @returns
 | 
			
		||||
 */
 | 
			
		||||
export function angleTo(v1: THREE.Vector3, v2: THREE.Vector3, ref: THREE.Vector3 = new THREE.Vector3(0, 0, 1))
 | 
			
		||||
export function angleTo(v1: Vector3, v2: Vector3, ref: Vector3 = new Vector3(0, 0, 1))
 | 
			
		||||
{
 | 
			
		||||
    if (!ref.equals(new Vector3(0, 0, 1)))
 | 
			
		||||
    {
 | 
			
		||||
        //任意轴坐标系. 使用相机的构造矩阵.
 | 
			
		||||
        ref.multiplyScalar(-1);
 | 
			
		||||
        let up = getLoocAtUpVec(ref);
 | 
			
		||||
        let refOcs = new THREE.Matrix4();
 | 
			
		||||
        let refOcs = new Matrix4();
 | 
			
		||||
        refOcs.lookAt(cZeroVec, ref, up);
 | 
			
		||||
        let refOcsInv = new THREE.Matrix4().getInverse(refOcs);
 | 
			
		||||
        let refOcsInv = new Matrix4().getInverse(refOcs);
 | 
			
		||||
        v1.applyMatrix4(refOcsInv);
 | 
			
		||||
        v2.applyMatrix4(refOcsInv);
 | 
			
		||||
        v1.z = 0;
 | 
			
		||||
@@ -103,7 +108,7 @@ export function angleTo(v1: THREE.Vector3, v2: THREE.Vector3, ref: THREE.Vector3
 | 
			
		||||
    return cv.z === 0 ? v1.angleTo(v2) : v1.angleTo(v2) * cv.z;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function getLoocAtUpVec(dir: THREE.Vector3): THREE.Vector3
 | 
			
		||||
export function getLoocAtUpVec(dir: Vector3): Vector3
 | 
			
		||||
{
 | 
			
		||||
    if (dir.equals(cZeroVec))
 | 
			
		||||
    {
 | 
			
		||||
@@ -112,37 +117,37 @@ export function getLoocAtUpVec(dir: THREE.Vector3): THREE.Vector3
 | 
			
		||||
    let norm = dir.clone().normalize();
 | 
			
		||||
    if (norm.equals(cZAxis))
 | 
			
		||||
    {
 | 
			
		||||
        return new THREE.Vector3(0, 1, 0);
 | 
			
		||||
        return new Vector3(0, 1, 0);
 | 
			
		||||
    }
 | 
			
		||||
    else if (norm.equals(cZAxis.clone().negate()))
 | 
			
		||||
    {
 | 
			
		||||
        return new THREE.Vector3(0, -1, 0);
 | 
			
		||||
        return new Vector3(0, -1, 0);
 | 
			
		||||
    }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        let xv: THREE.Vector3 = new THREE.Vector3();
 | 
			
		||||
        let xv: Vector3 = new Vector3();
 | 
			
		||||
        xv.crossVectors(cZAxis, norm);
 | 
			
		||||
 | 
			
		||||
        let up = new THREE.Vector3();
 | 
			
		||||
        let up = new Vector3();
 | 
			
		||||
        up.crossVectors(norm, xv);
 | 
			
		||||
        return up;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function createLookAtMat4(dir: THREE.Vector3): THREE.Matrix4
 | 
			
		||||
export function createLookAtMat4(dir: Vector3): Matrix4
 | 
			
		||||
{
 | 
			
		||||
    let up = getLoocAtUpVec(dir);
 | 
			
		||||
    let mat = new THREE.Matrix4();
 | 
			
		||||
    let mat = new Matrix4();
 | 
			
		||||
    mat.lookAt(cZeroVec, dir, up);
 | 
			
		||||
    return mat;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function isParallelTo(v1: THREE.Vector3, v2: THREE.Vector3)
 | 
			
		||||
export function isParallelTo(v1: Vector3, v2: Vector3)
 | 
			
		||||
{
 | 
			
		||||
    return v1.clone().cross(v2).lengthSq() < 1e-9;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function ptToString(v: THREE.Vector3, fractionDigits: number = 3): string
 | 
			
		||||
export function ptToString(v: Vector3, fractionDigits: number = 3): string
 | 
			
		||||
{
 | 
			
		||||
    return v.toArray().map(o =>
 | 
			
		||||
    {
 | 
			
		||||
@@ -150,16 +155,16 @@ export function ptToString(v: THREE.Vector3, fractionDigits: number = 3): string
 | 
			
		||||
    }).join(",")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function midPoint(v1: THREE.Vector3, v2: THREE.Vector3): THREE.Vector3
 | 
			
		||||
export function midPoint(v1: Vector3, v2: Vector3): Vector3
 | 
			
		||||
{
 | 
			
		||||
    return v1.clone().add(v2).multiplyScalar(0.5);
 | 
			
		||||
}
 | 
			
		||||
export function midPoint2(v1: THREE.Vector2, v2: THREE.Vector2): THREE.Vector2
 | 
			
		||||
export function midPoint2(v1: Vector2, v2: Vector2): Vector2
 | 
			
		||||
{
 | 
			
		||||
    return v1.clone().add(v2).multiplyScalar(0.5);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function midPtCir(v1: THREE.Vector3, v2: THREE.Vector3)
 | 
			
		||||
export function midPtCir(v1: Vector3, v2: Vector3)
 | 
			
		||||
{
 | 
			
		||||
    let baseline = new Vector3(1, 0, 0);
 | 
			
		||||
    let outLine = v2.clone().sub(v1);
 | 
			
		||||
@@ -170,11 +175,11 @@ export function midPtCir(v1: THREE.Vector3, v2: THREE.Vector3)
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 获得Three对象的包围盒.
 | 
			
		||||
 * @param obj 
 | 
			
		||||
 * @param obj
 | 
			
		||||
 * @param [updateMatrix] 是否应该更新对象矩阵
 | 
			
		||||
 * @returns box 
 | 
			
		||||
 * @returns box
 | 
			
		||||
 */
 | 
			
		||||
export function GetBox(obj: THREE.Object3D, updateMatrix?: boolean): THREE.Box3
 | 
			
		||||
export function GetBox(obj: Object3D, updateMatrix?: boolean): Box3
 | 
			
		||||
{
 | 
			
		||||
    let box = new Box3();
 | 
			
		||||
    if (updateMatrix) obj.updateMatrixWorld(false);
 | 
			
		||||
@@ -199,7 +204,7 @@ export function GetBox(obj: THREE.Object3D, updateMatrix?: boolean): THREE.Box3
 | 
			
		||||
    return box;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function GetBoxArr(arr: Array<THREE.Object3D>): THREE.Box3
 | 
			
		||||
export function GetBoxArr(arr: Array<Object3D>): Box3
 | 
			
		||||
{
 | 
			
		||||
    let box = new Box3();
 | 
			
		||||
    for (let o of arr)
 | 
			
		||||
@@ -211,9 +216,9 @@ export function GetBoxArr(arr: Array<THREE.Object3D>): THREE.Box3
 | 
			
		||||
    return box;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function MoveMatrix(v: THREE.Vector3): THREE.Matrix4
 | 
			
		||||
export function MoveMatrix(v: Vector3): Matrix4
 | 
			
		||||
{
 | 
			
		||||
    let mat = new THREE.Matrix4();
 | 
			
		||||
    let mat = new Matrix4();
 | 
			
		||||
    mat.makeTranslation(v.x, v.y, v.z);
 | 
			
		||||
    return mat;
 | 
			
		||||
}
 | 
			
		||||
@@ -265,9 +270,9 @@ export function angleAndX(v: Vector3 | Vector2)
 | 
			
		||||
}
 | 
			
		||||
/**
 | 
			
		||||
 * 将角度调整为0-2pi之间
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @export
 | 
			
		||||
 * @param {number} an 
 | 
			
		||||
 * @param {number} an
 | 
			
		||||
 */
 | 
			
		||||
export function angleTo2Pi(an: number)
 | 
			
		||||
{
 | 
			
		||||
@@ -275,9 +280,9 @@ export function angleTo2Pi(an: number)
 | 
			
		||||
    if (an < 0) an += Math.PI * 2
 | 
			
		||||
    return an;
 | 
			
		||||
}
 | 
			
		||||
export function updateGeometry(l: THREE.Line | THREE.Mesh, geometry: Geometry)
 | 
			
		||||
export function updateGeometry(l: Line | Mesh, geometry: Geometry)
 | 
			
		||||
{
 | 
			
		||||
    let geo = l.geometry as THREE.Geometry;
 | 
			
		||||
    let geo = l.geometry as Geometry;
 | 
			
		||||
    geo.dispose();
 | 
			
		||||
    l.geometry = geometry;
 | 
			
		||||
    geometry.verticesNeedUpdate = true;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								src/Orbit.ts
									
									
									
									
									
								
							
							
						
						
									
										44
									
								
								src/Orbit.ts
									
									
									
									
									
								
							@@ -1,9 +1,9 @@
 | 
			
		||||
import * as THREE from "three";
 | 
			
		||||
import { MathUtils, Vector3 } from "three";
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 轨道控制的数学类,观察向量和角度的互相转换
 | 
			
		||||
 * 当x当抬头或者低头到90度时,触发万向锁.
 | 
			
		||||
 * 
 | 
			
		||||
 *
 | 
			
		||||
 * @class Orbit
 | 
			
		||||
 */
 | 
			
		||||
export class Orbit
 | 
			
		||||
@@ -20,19 +20,19 @@ export class Orbit
 | 
			
		||||
    }
 | 
			
		||||
    set RoX(v)
 | 
			
		||||
    {
 | 
			
		||||
        this.m_RoX = THREE.Math.clamp(v, Math.PI * -0.5, Math.PI * 0.5);
 | 
			
		||||
        this.m_RoX = MathUtils.clamp(v, Math.PI * -0.5, Math.PI * 0.5);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用旋转角度 计算观察向量
 | 
			
		||||
     * 
 | 
			
		||||
     * @param {THREE.Vector3} [dir] 引用传入,如果传入,那么就不构造新的向量
 | 
			
		||||
     * @returns {THREE.Vector3} 返回观察向量
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} [dir] 引用传入,如果传入,那么就不构造新的向量
 | 
			
		||||
     * @returns {Vector3} 返回观察向量
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    UpdateDirection(dir?: THREE.Vector3): THREE.Vector3
 | 
			
		||||
    UpdateDirection(dir?: Vector3): Vector3
 | 
			
		||||
    {
 | 
			
		||||
        let rtDir = dir ? dir : new THREE.Vector3();
 | 
			
		||||
        let rtDir = dir ? dir : new Vector3();
 | 
			
		||||
 | 
			
		||||
        rtDir.z = Math.sin(this.m_RoX);
 | 
			
		||||
 | 
			
		||||
@@ -47,11 +47,11 @@ export class Orbit
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 使用观察向量,计算旋转角度
 | 
			
		||||
     * 
 | 
			
		||||
     * @param {THREE.Vector3} dir 
 | 
			
		||||
     *
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    UpdateRoValue(dir: THREE.Vector3)
 | 
			
		||||
    UpdateRoValue(dir: Vector3)
 | 
			
		||||
    {
 | 
			
		||||
        dir.normalize();
 | 
			
		||||
        this.m_RoX = Math.asin(dir.z);
 | 
			
		||||
@@ -62,30 +62,30 @@ export class Orbit
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * 根据观察向量 求头部的向量.
 | 
			
		||||
     * 
 | 
			
		||||
     *
 | 
			
		||||
     * @static
 | 
			
		||||
     * @param {THREE.Vector3} dir 
 | 
			
		||||
     * @param {THREE.Vector3} [up] 
 | 
			
		||||
     * @returns {THREE.Vector3} 
 | 
			
		||||
     * @param {Vector3} dir
 | 
			
		||||
     * @param {Vector3} [up]
 | 
			
		||||
     * @returns {Vector3}
 | 
			
		||||
     * @memberof Orbit
 | 
			
		||||
     */
 | 
			
		||||
    static ComputUpDirection(dir: THREE.Vector3, up?: THREE.Vector3): THREE.Vector3
 | 
			
		||||
    static ComputUpDirection(dir: Vector3, up?: Vector3): Vector3
 | 
			
		||||
    {
 | 
			
		||||
        let upRes = up ? up : new THREE.Vector3();
 | 
			
		||||
        if (dir.equals(new THREE.Vector3(0, 0, -1)))
 | 
			
		||||
        let upRes = up ? up : new Vector3();
 | 
			
		||||
        if (dir.equals(new Vector3(0, 0, -1)))
 | 
			
		||||
        {
 | 
			
		||||
            upRes.set(0, 1, 0);
 | 
			
		||||
        }
 | 
			
		||||
        else if (dir.equals(new THREE.Vector3(0, 0, 1)))
 | 
			
		||||
        else if (dir.equals(new Vector3(0, 0, 1)))
 | 
			
		||||
        {
 | 
			
		||||
            upRes.set(0, -1, 0);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            let xv = new THREE.Vector3();
 | 
			
		||||
            xv.crossVectors(new THREE.Vector3(0, 0, 1), dir);
 | 
			
		||||
            let xv = new Vector3();
 | 
			
		||||
            xv.crossVectors(new Vector3(0, 0, 1), dir);
 | 
			
		||||
            upRes.crossVectors(dir, xv);
 | 
			
		||||
            upRes.normalize();
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										185
									
								
								src/SimpleBoard.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										185
									
								
								src/SimpleBoard.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,185 @@
 | 
			
		||||
import { CylinderGeometry, LineSegments, Matrix4, Mesh, MeshBasicMaterial, Vector2, Vector3 } from "three";
 | 
			
		||||
import { ExtrudeSolid, Polyline, boardUVGenerator2 } from "webcad_ue4_api";
 | 
			
		||||
import { ColorMaterial } from "./ColorPalette";
 | 
			
		||||
import { edgeMaterial } from "./Material";
 | 
			
		||||
import { DbText } from "./Text";
 | 
			
		||||
 | 
			
		||||
function getVec(data: object): Vector3
 | 
			
		||||
{
 | 
			
		||||
    return new Vector3(data["x"], data["y"], data["z"]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum BoardType
 | 
			
		||||
{
 | 
			
		||||
    Layer = 0,
 | 
			
		||||
    Vertical = 1,
 | 
			
		||||
    Behind = 2
 | 
			
		||||
}
 | 
			
		||||
export class SimpleBoard
 | 
			
		||||
{
 | 
			
		||||
    BoardName: string;
 | 
			
		||||
    boardPts: any[];
 | 
			
		||||
    boardBuls: any[];
 | 
			
		||||
    xD: Vector3;
 | 
			
		||||
    yD: Vector3;
 | 
			
		||||
    zD: Vector3;
 | 
			
		||||
    height: number;
 | 
			
		||||
    width: number;
 | 
			
		||||
 | 
			
		||||
    thickness: number;
 | 
			
		||||
    pBase: Vector3;
 | 
			
		||||
    SubBoardLocal: any[];
 | 
			
		||||
    Drillings: any[];
 | 
			
		||||
    DataID: number;
 | 
			
		||||
    _BoardType: BoardType;
 | 
			
		||||
    _CustomNumber: string;
 | 
			
		||||
 | 
			
		||||
    constructor(boardData: any)
 | 
			
		||||
    {
 | 
			
		||||
        this.boardPts = boardData["Pts"];
 | 
			
		||||
        this.boardBuls = boardData["Buls"];
 | 
			
		||||
        this.pBase = getVec(boardData["BasePoint"]);
 | 
			
		||||
 | 
			
		||||
        this.xD = getVec(boardData["XVec"]);
 | 
			
		||||
        this.yD = getVec(boardData["YVec"]);
 | 
			
		||||
        this.zD = getVec(boardData["ZVec"]);
 | 
			
		||||
 | 
			
		||||
        this.SubBoardLocal = boardData["SubBoardLocal"] ?? [];
 | 
			
		||||
 | 
			
		||||
        this.Drillings = boardData["Drillings"] ?? [];
 | 
			
		||||
 | 
			
		||||
        this.height = boardData["L"];
 | 
			
		||||
        this.width = boardData["W"];
 | 
			
		||||
        this.thickness = boardData["H"];
 | 
			
		||||
 | 
			
		||||
        this.BoardName = boardData["BoardName"];
 | 
			
		||||
        this.DataID = boardData['DataID'];
 | 
			
		||||
 | 
			
		||||
        this._BoardType = boardData['BoardType'];
 | 
			
		||||
        this._CustomNumber = boardData['CustomNumber'];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public Conver2Ext(): ExtrudeSolid
 | 
			
		||||
    {
 | 
			
		||||
        let pts: Vector2[] = [];
 | 
			
		||||
        let buls: number[] = [];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        let boardMat = new Matrix4();
 | 
			
		||||
        let matInv: Matrix4 = new Matrix4();
 | 
			
		||||
        //InitBoardMat
 | 
			
		||||
 | 
			
		||||
        this.pBase.add(this.zD.clone().multiplyScalar(-this.thickness));
 | 
			
		||||
 | 
			
		||||
        boardMat.makeBasis(this.xD, this.yD, this.zD);
 | 
			
		||||
        boardMat.setPosition(this.pBase);
 | 
			
		||||
        matInv.getInverse(boardMat);
 | 
			
		||||
 | 
			
		||||
        if (this.boardPts && this.boardPts.length !== 0)
 | 
			
		||||
            for (let i = 0; i < this.boardPts.length; i++)
 | 
			
		||||
            {
 | 
			
		||||
                let pt = getVec(this.boardPts[i]);
 | 
			
		||||
                if (this.boardPts[i].z !== undefined)
 | 
			
		||||
                    pt.applyMatrix4(matInv);
 | 
			
		||||
                pts.push(new Vector2(pt.x, pt.y));
 | 
			
		||||
                buls.push(this.boardBuls[i]);
 | 
			
		||||
            }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            pts.push(new Vector2(0, 0),
 | 
			
		||||
                new Vector2(this.width, 0),
 | 
			
		||||
                new Vector2(this.width, this.height),
 | 
			
		||||
                new Vector2(0, this.height),
 | 
			
		||||
                new Vector2(0, 0)
 | 
			
		||||
            );
 | 
			
		||||
            buls.push(0, 0, 0, 0, 0);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let ext = new ExtrudeSolid();
 | 
			
		||||
        ext.OCSNoClone.copy(boardMat);
 | 
			
		||||
        let pl = new Polyline(pts.map((p, i) => { return { pt: p, bul: buls[i] }; }));
 | 
			
		||||
        ext.Thickness = this.thickness;
 | 
			
		||||
        ext.ContourCurve = pl;
 | 
			
		||||
 | 
			
		||||
        if (this.SubBoardLocal.length > 0)
 | 
			
		||||
            ext.Grooves.push(...this.SubBoardLocal.map(sub => new SimpleBoard(sub).Conver2Ext()));
 | 
			
		||||
        return ext;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    createBoard(boardMaterial: MeshBasicMaterial)
 | 
			
		||||
    {
 | 
			
		||||
        let ext = this.Conver2Ext();
 | 
			
		||||
        if (this.BoardName === "地脚线")
 | 
			
		||||
            Object.defineProperty(ext, "UCGenerator",
 | 
			
		||||
                {
 | 
			
		||||
                    get: function ()
 | 
			
		||||
                    {
 | 
			
		||||
                        return boardUVGenerator2;
 | 
			
		||||
                    },
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
        //板件被镜像时.
 | 
			
		||||
        // if (!equalv3(xD.clone().cross(yD), ZD))
 | 
			
		||||
        // {
 | 
			
		||||
        //     for (let f of ext.faces)
 | 
			
		||||
        //         [f.a, f.c] = [f.c, f.a];
 | 
			
		||||
        // }
 | 
			
		||||
 | 
			
		||||
        //边
 | 
			
		||||
        let edges: (LineSegments | Mesh)[] = [new LineSegments(ext.EdgeGeometry, edgeMaterial)];
 | 
			
		||||
        edges[0].applyMatrix4(ext.OCSNoClone);
 | 
			
		||||
 | 
			
		||||
        if (this.Drillings.length > 0)
 | 
			
		||||
        {
 | 
			
		||||
            let dris = this.Drillings;
 | 
			
		||||
            for (let dri of dris)
 | 
			
		||||
            {
 | 
			
		||||
                let geo = new CylinderGeometry(dri.r, dri.r, dri.h, 8);
 | 
			
		||||
                geo.rotateX(Math.PI * 0.5);
 | 
			
		||||
 | 
			
		||||
                if (dri.f === 0) //0正
 | 
			
		||||
                    geo.translate(dri.x, dri.y, -dri.h * 0.5 + this.thickness);
 | 
			
		||||
                else             //1反
 | 
			
		||||
                    geo.translate(dri.x, dri.y, dri.h * 0.5);
 | 
			
		||||
 | 
			
		||||
                geo.applyMatrix4(ext.OCSNoClone);
 | 
			
		||||
 | 
			
		||||
                let mesh = new Mesh(geo, ColorMaterial.GetBasicMaterial(1));
 | 
			
		||||
                edges.push(mesh);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let mesh = new Mesh(ext.MeshGeometry, boardMaterial);
 | 
			
		||||
        mesh.userData = ext.Normal;
 | 
			
		||||
        edges.forEach(e => e.userData = ext.Normal);
 | 
			
		||||
        // 自定义编号
 | 
			
		||||
        if (this._CustomNumber)
 | 
			
		||||
        {
 | 
			
		||||
            mesh.add(this.createCustomNo());
 | 
			
		||||
        }
 | 
			
		||||
        mesh.applyMatrix4(ext.OCSNoClone);
 | 
			
		||||
        mesh.updateWorldMatrix(false, true);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        return { mesh, edges };
 | 
			
		||||
    }
 | 
			
		||||
    private createCustomNo()
 | 
			
		||||
    {
 | 
			
		||||
        let text = new DbText(this._CustomNumber?.toString(), 100);
 | 
			
		||||
        let position = new Vector3(this.width * 0.5, this.height * 0.5, this.thickness * 0.5);
 | 
			
		||||
        if (this._BoardType === BoardType.Layer)
 | 
			
		||||
        {
 | 
			
		||||
            text.applyMatrix4(new Matrix4().makeRotationZ(-Math.PI / 2).setPosition(position));
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            text.applyMatrix4(new Matrix4().setPosition(position));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // text.CreateDoubleMesh(this._BoardType === BoardType.Layer);
 | 
			
		||||
 | 
			
		||||
        return text;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										70
									
								
								src/Text.ts
									
									
									
									
									
								
							
							
						
						
									
										70
									
								
								src/Text.ts
									
									
									
									
									
								
							@@ -1,43 +1,59 @@
 | 
			
		||||
import { Font, FontLoader, Mesh, ShapeGeometry, Vector3, Shape } from "three";
 | 
			
		||||
import { Font, FontLoader, Matrix4, Mesh, Shape, ShapeGeometry, Vector3 } from "three";
 | 
			
		||||
import { ColorMaterial } from "./ColorPalette";
 | 
			
		||||
import { MoveMatrix } from "./GeUtils";
 | 
			
		||||
import { XAxis, XAxisN, YAxis, YAxisN, ZAxisN } from "./Utils";
 | 
			
		||||
 | 
			
		||||
class FontLoaderUtil
 | 
			
		||||
{
 | 
			
		||||
  private static defFont: Font;
 | 
			
		||||
  static Load(): Font
 | 
			
		||||
  {
 | 
			
		||||
    if (!this.defFont)
 | 
			
		||||
    private static defFont: Font;
 | 
			
		||||
    static Load(): Font
 | 
			
		||||
    {
 | 
			
		||||
      const f = require("../resources/fonts/helvetiker_regular.typeface.json");
 | 
			
		||||
      let loader = new FontLoader();
 | 
			
		||||
      this.defFont = loader.parse(f);
 | 
			
		||||
        if (!this.defFont)
 | 
			
		||||
        {
 | 
			
		||||
            const f = require("../resources/fonts/helvetiker_regular.typeface.json");
 | 
			
		||||
            let loader = new FontLoader();
 | 
			
		||||
            this.defFont = loader.parse(f);
 | 
			
		||||
        }
 | 
			
		||||
        return this.defFont;
 | 
			
		||||
    }
 | 
			
		||||
    return this.defFont;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class DbText extends Mesh
 | 
			
		||||
{
 | 
			
		||||
  /**
 | 
			
		||||
   *
 | 
			
		||||
   * 构造一个文本对象,8位点(中心点下面)在0点
 | 
			
		||||
   * @param {string} str 数字字符串
 | 
			
		||||
   * @param {number} height 文本高度
 | 
			
		||||
   * @memberof DbText
 | 
			
		||||
   */
 | 
			
		||||
  constructor(str: string, height: number = 5)
 | 
			
		||||
  {
 | 
			
		||||
    let font = FontLoaderUtil.Load();
 | 
			
		||||
    /**
 | 
			
		||||
     *
 | 
			
		||||
     * 构造一个文本对象,8位点(中心点下面)在0点
 | 
			
		||||
     * @param {string} str 数字字符串
 | 
			
		||||
     * @param {number} height 文本高度
 | 
			
		||||
     * @memberof DbText
 | 
			
		||||
     */
 | 
			
		||||
    constructor(str: string, height: number = 5)
 | 
			
		||||
    {
 | 
			
		||||
        let font = FontLoaderUtil.Load();
 | 
			
		||||
 | 
			
		||||
    let shapes: Shape[] = font.generateShapes(str, height, 0.1);
 | 
			
		||||
    let geometry = new ShapeGeometry(shapes);
 | 
			
		||||
        let shapes: Shape[] = font.generateShapes(str, height);
 | 
			
		||||
        let geometry = new ShapeGeometry(shapes);
 | 
			
		||||
 | 
			
		||||
    geometry.computeBoundingBox();
 | 
			
		||||
        geometry.computeBoundingBox();
 | 
			
		||||
 | 
			
		||||
    super(geometry, ColorMaterial.GetBasicMaterial(5));
 | 
			
		||||
        super(geometry, ColorMaterial.GetBasicMaterial(5));
 | 
			
		||||
 | 
			
		||||
    let center = geometry.boundingBox.getCenter(new Vector3());
 | 
			
		||||
    this.applyMatrix(MoveMatrix(new Vector3(-center.x, 0, 0)));
 | 
			
		||||
  }
 | 
			
		||||
        let center = geometry.boundingBox.getCenter(new Vector3());
 | 
			
		||||
        this.applyMatrix4(MoveMatrix(new Vector3(-center.x, 0, 0)));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    CreateDoubleMesh(IsFsText: boolean)
 | 
			
		||||
    {
 | 
			
		||||
        let mesh2 = new Mesh(this.geometry, ColorMaterial.GetBasicMaterial(5));
 | 
			
		||||
        //左右视图时应该这样,俯视图是X,-Y,-Z(y+=(xxx)
 | 
			
		||||
        if (IsFsText)
 | 
			
		||||
        {
 | 
			
		||||
            mesh2.applyMatrix4(new Matrix4().makeBasis(XAxis, YAxisN, ZAxisN));
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
            mesh2.applyMatrix4(new Matrix4().makeBasis(XAxisN, YAxis, ZAxisN));
 | 
			
		||||
        }
 | 
			
		||||
        this.add(mesh2);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -71,32 +71,8 @@ export class ThreeBSP
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[2], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
            } else if (typeof THREE.Face4)
 | 
			
		||||
            {
 | 
			
		||||
                vertex = geometry.vertices[face.a];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[0].x, faceVertexUvs[0].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[0], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
 | 
			
		||||
                vertex = geometry.vertices[face.b];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[1].x, faceVertexUvs[1].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[1], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
 | 
			
		||||
                vertex = geometry.vertices[face.c];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[2].x, faceVertexUvs[2].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[2], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
 | 
			
		||||
                vertex = geometry.vertices[face.d];
 | 
			
		||||
                uvs = faceVertexUvs ? new THREE.Vector2(faceVertexUvs[3].x, faceVertexUvs[3].y) : null;
 | 
			
		||||
                vertex = new Vertex(vertex.x, vertex.y, vertex.z, face.vertexNormals[3], uvs);
 | 
			
		||||
                vertex.applyMatrix4(this.matrix);
 | 
			
		||||
                polygon.vertices.push(vertex);
 | 
			
		||||
            } else
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                throw 'Invalid face type at index ' + i;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								src/Utils.ts
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								src/Utils.ts
									
									
									
									
									
								
							@@ -1,5 +1,12 @@
 | 
			
		||||
import { Object3D, Mesh } from "three";
 | 
			
		||||
import { createTemplateBoard, DrawDimension, Viewer, selectMaterial } from ".";
 | 
			
		||||
import { Object3D, Vector3 } from "three";
 | 
			
		||||
import { DrawDimension, Viewer, createTemplateBoard } from ".";
 | 
			
		||||
 | 
			
		||||
export const XAxis = new Vector3(1, 0, 0);
 | 
			
		||||
export const XAxisN = new Vector3(-1, 0, 0);
 | 
			
		||||
export const YAxis = new Vector3(0, 1, 0);
 | 
			
		||||
export const YAxisN = new Vector3(0, -1, 0);
 | 
			
		||||
export const ZAxis = new Vector3(0, 0, 1);
 | 
			
		||||
export const ZAxisN = new Vector3(0, 0, -1);
 | 
			
		||||
 | 
			
		||||
function dispose(m: Object3D)
 | 
			
		||||
{
 | 
			
		||||
@@ -21,7 +28,7 @@ export function LoadBoard(view: Viewer, data: any[], clear: boolean = true)
 | 
			
		||||
 | 
			
		||||
    if (data.length === 0) return;
 | 
			
		||||
    //加板
 | 
			
		||||
    let { meshs, edgesa, relations } = createTemplateBoard(data);
 | 
			
		||||
    let { meshs, edgesa, relations } = createTemplateBoard(data, view._Settings.boardMaterial);
 | 
			
		||||
 | 
			
		||||
    //加标注
 | 
			
		||||
    let dims = DrawDimension(meshs);
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										197
									
								
								src/ViewSrc/data.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										197
									
								
								src/ViewSrc/data.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,197 @@
 | 
			
		||||
[
 | 
			
		||||
    {
 | 
			
		||||
        "DataID": 3996018,
 | 
			
		||||
        "OrderNo": 20230727027642,
 | 
			
		||||
        "L": 800,
 | 
			
		||||
        "W": 600,
 | 
			
		||||
        "H": 18,
 | 
			
		||||
        "BoardName": "层板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "BoardType": 0,
 | 
			
		||||
        "CustomNumber": "",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 1877.02062480031,
 | 
			
		||||
            "y": -1.77635683940025e-13,
 | 
			
		||||
            "z": 823.651271182857
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 2.22044604925031e-16,
 | 
			
		||||
            "y": 1,
 | 
			
		||||
            "z": 0
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -1,
 | 
			
		||||
            "y": 2.22044604925031e-16,
 | 
			
		||||
            "z": 0
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 0,
 | 
			
		||||
            "y": 0,
 | 
			
		||||
            "z": 1
 | 
			
		||||
        },
 | 
			
		||||
        "Pts": [],
 | 
			
		||||
        "Buls": [],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": [],
 | 
			
		||||
        "Drillings": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 50,
 | 
			
		||||
                "y": 766,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 300,
 | 
			
		||||
                "y": 766,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 550,
 | 
			
		||||
                "y": 766,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 550,
 | 
			
		||||
                "y": 34,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 300,
 | 
			
		||||
                "y": 34,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 50,
 | 
			
		||||
                "y": 34,
 | 
			
		||||
                "r": 7.5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "DataID": 3996019,
 | 
			
		||||
        "OrderNo": 20230727027642,
 | 
			
		||||
        "L": 1200,
 | 
			
		||||
        "W": 600,
 | 
			
		||||
        "H": 18,
 | 
			
		||||
        "BoardName": "右侧板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "BoardType": 0,
 | 
			
		||||
        "CustomNumber": "",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 1895.02062480031,
 | 
			
		||||
            "y": 0,
 | 
			
		||||
            "z": 214.651271182857
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.93038065763132e-32,
 | 
			
		||||
            "y": 1,
 | 
			
		||||
            "z": -2.22044604925031e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -2.22044604925031e-16,
 | 
			
		||||
            "y": 2.22044604925031e-16,
 | 
			
		||||
            "z": 1
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 1,
 | 
			
		||||
            "y": 0,
 | 
			
		||||
            "z": 2.22044604925031e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Pts": [],
 | 
			
		||||
        "Buls": [],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": [],
 | 
			
		||||
        "Drillings": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 550,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 1
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 300,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 1
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 50,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 1
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        "DataID": 3996020,
 | 
			
		||||
        "OrderNo": 20230727027642,
 | 
			
		||||
        "L": 1200,
 | 
			
		||||
        "W": 600,
 | 
			
		||||
        "H": 18,
 | 
			
		||||
        "BoardName": "左侧板",
 | 
			
		||||
        "Grain": 0,
 | 
			
		||||
        "BoardType": 0,
 | 
			
		||||
        "CustomNumber": "",
 | 
			
		||||
        "BasePoint": {
 | 
			
		||||
            "x": 1077.02062480031,
 | 
			
		||||
            "y": 0,
 | 
			
		||||
            "z": 214.651271182857
 | 
			
		||||
        },
 | 
			
		||||
        "XVec": {
 | 
			
		||||
            "x": 4.93038065763132e-32,
 | 
			
		||||
            "y": 1,
 | 
			
		||||
            "z": -2.22044604925031e-16
 | 
			
		||||
        },
 | 
			
		||||
        "YVec": {
 | 
			
		||||
            "x": -2.22044604925031e-16,
 | 
			
		||||
            "y": 2.22044604925031e-16,
 | 
			
		||||
            "z": 1
 | 
			
		||||
        },
 | 
			
		||||
        "ZVec": {
 | 
			
		||||
            "x": 1,
 | 
			
		||||
            "y": 0,
 | 
			
		||||
            "z": 2.22044604925031e-16
 | 
			
		||||
        },
 | 
			
		||||
        "Pts": [],
 | 
			
		||||
        "Buls": [],
 | 
			
		||||
        "SubBoardLocal": [],
 | 
			
		||||
        "SubBoardAssoc": [],
 | 
			
		||||
        "Drillings": [
 | 
			
		||||
            {
 | 
			
		||||
                "x": 50,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 300,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            },
 | 
			
		||||
            {
 | 
			
		||||
                "x": 550,
 | 
			
		||||
                "y": 600,
 | 
			
		||||
                "r": 5,
 | 
			
		||||
                "h": 13.5,
 | 
			
		||||
                "f": 0
 | 
			
		||||
            }
 | 
			
		||||
        ]
 | 
			
		||||
    }
 | 
			
		||||
]
 | 
			
		||||
							
								
								
									
										14
									
								
								src/ViewSrc/index.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										14
									
								
								src/ViewSrc/index.html
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,14 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html lang="en">
 | 
			
		||||
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="UTF-8">
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
			
		||||
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
 | 
			
		||||
    <title>WebCAD</title>
 | 
			
		||||
</head>
 | 
			
		||||
 | 
			
		||||
<body>
 | 
			
		||||
</body>
 | 
			
		||||
 | 
			
		||||
</html>
 | 
			
		||||
@@ -1,22 +1,21 @@
 | 
			
		||||
// import { Color, Face3, MeshBasicMaterial, Object3D, Vector2, Vector3 } from "three";
 | 
			
		||||
// import "./style.css";
 | 
			
		||||
import { Vector3 } from "three";
 | 
			
		||||
import { Color, MeshBasicMaterial, Vector3 } from "three";
 | 
			
		||||
import { CameraControlState } from "../CameraControls";
 | 
			
		||||
import { data } from "../data";
 | 
			
		||||
import { GetBox } from "../GeUtils";
 | 
			
		||||
import { LoadBoard } from "../Utils";
 | 
			
		||||
import { Viewer } from "../Viewer";
 | 
			
		||||
 | 
			
		||||
let btn = document.createElement("button");
 | 
			
		||||
btn.innerHTML = "载入"
 | 
			
		||||
btn.innerHTML = "载入";
 | 
			
		||||
document.body.appendChild(btn);
 | 
			
		||||
 | 
			
		||||
let btn2 = document.createElement("button");
 | 
			
		||||
btn2.innerHTML = "清理"
 | 
			
		||||
btn2.innerHTML = "清理";
 | 
			
		||||
document.body.appendChild(btn2);
 | 
			
		||||
 | 
			
		||||
let btn3 = document.createElement("button");
 | 
			
		||||
btn3.innerHTML = "爆炸图"
 | 
			
		||||
btn3.innerHTML = "爆炸图";
 | 
			
		||||
document.body.appendChild(btn3);
 | 
			
		||||
 | 
			
		||||
let el = document.createElement("canvas");
 | 
			
		||||
@@ -25,7 +24,17 @@ el.style.width = "80%";
 | 
			
		||||
el.style.height = "80%";
 | 
			
		||||
document.body.appendChild(el);
 | 
			
		||||
 | 
			
		||||
let view = new Viewer(el);
 | 
			
		||||
let view = new Viewer(el, (settings) =>
 | 
			
		||||
{
 | 
			
		||||
    settings.boardMaterial = new MeshBasicMaterial({
 | 
			
		||||
        color: new Color(0.8, 0.8, 0.8),
 | 
			
		||||
        polygonOffset: true,
 | 
			
		||||
        polygonOffsetFactor: 1, // positive value pushes polygon further away
 | 
			
		||||
        polygonOffsetUnits: 1,
 | 
			
		||||
        transparent: true,
 | 
			
		||||
        opacity: 0.5
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
//修改这个顺序 改变1 2 3 个触摸点时的触发状态.
 | 
			
		||||
view.m_CameraCtrl.m_TouthTypeList = [CameraControlState.Rotate, CameraControlState.Scale, CameraControlState.Pan];
 | 
			
		||||
@@ -36,15 +45,16 @@ view.m_CameraCtrl.m_TouthTypeList = [CameraControlState.Pan, CameraControlState.
 | 
			
		||||
btn.onclick = () =>
 | 
			
		||||
{
 | 
			
		||||
    console.time();
 | 
			
		||||
    let data = require("./data.json");
 | 
			
		||||
    for (let i = 0; i < 1; i++)
 | 
			
		||||
        LoadBoard(view, data);
 | 
			
		||||
    console.timeEnd();
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
btn2.onclick = () =>
 | 
			
		||||
{
 | 
			
		||||
    // LoadBoard(view, []);
 | 
			
		||||
}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
btn3.onclick = () =>
 | 
			
		||||
{
 | 
			
		||||
@@ -91,5 +101,5 @@ btn3.onclick = () =>
 | 
			
		||||
 | 
			
		||||
        if (count === 60)
 | 
			
		||||
            clearInterval(t);
 | 
			
		||||
    }, 16)
 | 
			
		||||
}
 | 
			
		||||
    }, 16);
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										12
									
								
								src/ViewSrc/style.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								src/ViewSrc/style.css
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,12 @@
 | 
			
		||||
body {
 | 
			
		||||
    font-size: 11px;
 | 
			
		||||
    overflow: hidden;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
html,
 | 
			
		||||
body {
 | 
			
		||||
    background: #5C7080;
 | 
			
		||||
    height: 100%;
 | 
			
		||||
    padding: 0;
 | 
			
		||||
    margin: 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -1,11 +1,18 @@
 | 
			
		||||
 | 
			
		||||
import { Mesh, Raycaster, Scene, Vector3, WebGLRenderer, WebGLRendererParameters } from "three";
 | 
			
		||||
import { Mesh, MeshBasicMaterial, Raycaster, Scene, Vector3, WebGLRenderer, WebGLRendererParameters } from "three";
 | 
			
		||||
import { boardMaterial, CameraControls, PointPick, selectMaterial } from ".";
 | 
			
		||||
import { CameraUpdate } from "./CameraUpdate";
 | 
			
		||||
import { ColorMaterial } from "./ColorPalette";
 | 
			
		||||
import { cZeroVec, GetBox, GetBoxArr } from "./GeUtils";
 | 
			
		||||
import { PlaneExt } from "./PlaneExt";
 | 
			
		||||
 | 
			
		||||
export class ViewerSettings
 | 
			
		||||
{
 | 
			
		||||
  boardMaterial: MeshBasicMaterial = boardMaterial;
 | 
			
		||||
  selectMaterial: MeshBasicMaterial = selectMaterial;
 | 
			
		||||
  selectByPointCallback: (meshId: number) => void = () => { };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export class Viewer
 | 
			
		||||
{
 | 
			
		||||
  m_LookTarget: any;
 | 
			
		||||
@@ -20,13 +27,19 @@ export class Viewer
 | 
			
		||||
 | 
			
		||||
  m_Scene: Scene = new Scene();
 | 
			
		||||
 | 
			
		||||
  _Settings = new ViewerSettings();
 | 
			
		||||
  /**
 | 
			
		||||
   * 
 | 
			
		||||
   * @param {HTMLElement} canvasContainer 可以传入一个div或者一个画布
 | 
			
		||||
   * @memberof Viewer
 | 
			
		||||
   */
 | 
			
		||||
  constructor(canvasContainer: HTMLElement)
 | 
			
		||||
  constructor(canvasContainer: HTMLElement, setupAction: (settings: ViewerSettings) => void = null)
 | 
			
		||||
  {
 | 
			
		||||
    if (setupAction)
 | 
			
		||||
    {
 | 
			
		||||
      setupAction(this._Settings);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    this.m_DomEl = canvasContainer;
 | 
			
		||||
    this.initRender(canvasContainer);
 | 
			
		||||
    this.OnSize();
 | 
			
		||||
@@ -193,11 +206,15 @@ export class Viewer
 | 
			
		||||
  {
 | 
			
		||||
    let mesh = PointPick(this, x, y);
 | 
			
		||||
    if (this.oldMesh)
 | 
			
		||||
      this.oldMesh.material = boardMaterial;
 | 
			
		||||
      this.oldMesh.material = this._Settings.boardMaterial;
 | 
			
		||||
    if (mesh && mesh.material !== ColorMaterial.GetBasicMaterial(1))
 | 
			
		||||
    {
 | 
			
		||||
      this.oldMesh = mesh;
 | 
			
		||||
      mesh.material = selectMaterial;
 | 
			
		||||
      mesh.material = this._Settings.selectMaterial;
 | 
			
		||||
      if (this._Settings.selectByPointCallback)
 | 
			
		||||
      {
 | 
			
		||||
        this._Settings.selectByPointCallback(mesh.id);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
    this.m_bNeedUpdate = true;
 | 
			
		||||
  }
 | 
			
		||||
@@ -207,7 +224,7 @@ export class Viewer
 | 
			
		||||
    {
 | 
			
		||||
      let meshId = blockMeshMap.get(dataID);
 | 
			
		||||
      if (this.oldMesh)
 | 
			
		||||
        this.oldMesh.material = boardMaterial;
 | 
			
		||||
        this.oldMesh.material = this._Settings.boardMaterial;
 | 
			
		||||
      this.m_Scene.children.forEach(obj =>
 | 
			
		||||
      {
 | 
			
		||||
        if (obj instanceof Mesh)
 | 
			
		||||
@@ -215,7 +232,7 @@ export class Viewer
 | 
			
		||||
          if (obj.id == meshId)
 | 
			
		||||
          {
 | 
			
		||||
            this.oldMesh = obj;
 | 
			
		||||
            obj.material = selectMaterial;
 | 
			
		||||
            obj.material = this._Settings.selectMaterial;
 | 
			
		||||
            this.m_bNeedUpdate = true;
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,25 +1,22 @@
 | 
			
		||||
import * as THREE from 'three';
 | 
			
		||||
import { CylinderGeometry, Geometry, LineSegments, Mesh, Shape, Vector2 } from 'three';
 | 
			
		||||
import { ColorMaterial } from './ColorPalette';
 | 
			
		||||
import { EdgesGeometry, Geometry, LineSegments, MeshBasicMaterial, Shape, Vector2 } from 'three';
 | 
			
		||||
import { polar } from './GeUtils';
 | 
			
		||||
import { boardMaterial, edgeMaterial } from './Material';
 | 
			
		||||
import { RotateUVs } from './RotateUV';
 | 
			
		||||
import { ThreeBSP } from './ThreeCSG';
 | 
			
		||||
import { edgeMaterial } from './Material';
 | 
			
		||||
import { SimpleBoard } from './SimpleBoard';
 | 
			
		||||
//解析二维圆弧类.
 | 
			
		||||
export class Arc2d
 | 
			
		||||
{
 | 
			
		||||
    m_StartAn: number;
 | 
			
		||||
    m_EndAn: number;
 | 
			
		||||
    m_StartPoint: THREE.Vector2;
 | 
			
		||||
    m_EndPoint: THREE.Vector2;
 | 
			
		||||
    m_Center: THREE.Vector2;
 | 
			
		||||
    m_StartPoint: Vector2;
 | 
			
		||||
    m_EndPoint: Vector2;
 | 
			
		||||
    m_Center: Vector2;
 | 
			
		||||
    m_Radius: number;
 | 
			
		||||
    constructor(p1: THREE.Vector2, p2: THREE.Vector2, bul: number)
 | 
			
		||||
    constructor(p1: Vector2, p2: Vector2, bul: number)
 | 
			
		||||
    {
 | 
			
		||||
        this.m_StartPoint = p1.clone();
 | 
			
		||||
        this.m_EndPoint = p2.clone();
 | 
			
		||||
 | 
			
		||||
        let vec: THREE.Vector2 = p2.clone().sub(p1);
 | 
			
		||||
        let vec: Vector2 = p2.clone().sub(p1);
 | 
			
		||||
        let len = vec.length();
 | 
			
		||||
        let an = vec.angle();
 | 
			
		||||
        this.m_Radius = len / Math.sin(2 * Math.atan(bul)) / 2;
 | 
			
		||||
@@ -44,7 +41,7 @@ export class Arc2d
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//创建轮廓 通过点表和凸度    
 | 
			
		||||
//创建轮廓 通过点表和凸度
 | 
			
		||||
export function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Shape
 | 
			
		||||
{
 | 
			
		||||
    let shape = shapeOut || new Shape();
 | 
			
		||||
@@ -57,7 +54,7 @@ export function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Sh
 | 
			
		||||
        let nextPt = pts[i + 1];
 | 
			
		||||
        if (buls[i] == 0)
 | 
			
		||||
        {
 | 
			
		||||
            shape.lineTo(nextPt.x, nextPt.y)
 | 
			
		||||
            shape.lineTo(nextPt.x, nextPt.y);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
@@ -72,131 +69,13 @@ export function createPath(pts: Vector2[], buls: number[], shapeOut?: Shape): Sh
 | 
			
		||||
    }
 | 
			
		||||
    return shape;
 | 
			
		||||
}
 | 
			
		||||
export function getVec(data: object): THREE.Vector3
 | 
			
		||||
{
 | 
			
		||||
    return new THREE.Vector3(data["x"], data["y"], data["z"]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
//创建板件 暂时这么写
 | 
			
		||||
export function createBoard(boardData: object)
 | 
			
		||||
{
 | 
			
		||||
    let pts: THREE.Vector2[] = [];
 | 
			
		||||
    let buls: number[] = [];
 | 
			
		||||
    let boardPts = boardData["Pts"];
 | 
			
		||||
    let boardBuls = boardData["Buls"];
 | 
			
		||||
 | 
			
		||||
    let boardHeight = boardData["H"];
 | 
			
		||||
 | 
			
		||||
    let boardMat = new THREE.Matrix4();
 | 
			
		||||
    let matInv: THREE.Matrix4 = new THREE.Matrix4();
 | 
			
		||||
    //InitBoardMat
 | 
			
		||||
    let xD = getVec(boardData["XVec"]);
 | 
			
		||||
    let yD = getVec(boardData["YVec"]);
 | 
			
		||||
    let ZD = getVec(boardData["ZVec"]);
 | 
			
		||||
    let pBase = getVec(boardData["BasePoint"]);
 | 
			
		||||
 | 
			
		||||
    boardMat.makeBasis(xD, yD, ZD);
 | 
			
		||||
    boardMat.setPosition(pBase);
 | 
			
		||||
    matInv.getInverse(boardMat, true);
 | 
			
		||||
 | 
			
		||||
    if (boardPts && boardPts.length !== 0)
 | 
			
		||||
        for (let i = 0; i < boardPts.length; i++)
 | 
			
		||||
        {
 | 
			
		||||
            let pt = getVec(boardPts[i]);
 | 
			
		||||
            if (boardPts[i].z !== undefined)
 | 
			
		||||
                pt.applyMatrix4(matInv);
 | 
			
		||||
            pts.push(new THREE.Vector2(pt.x, pt.y));
 | 
			
		||||
            buls.push(boardBuls[i]);
 | 
			
		||||
        }
 | 
			
		||||
    else
 | 
			
		||||
    {
 | 
			
		||||
        let length = boardData["L"];
 | 
			
		||||
        let width = boardData["W"];
 | 
			
		||||
        let height = boardData["H"];
 | 
			
		||||
        pts.push(new Vector2(0, 0),
 | 
			
		||||
            new Vector2(width, 0),
 | 
			
		||||
            new Vector2(width, length),
 | 
			
		||||
            new Vector2(0, length),
 | 
			
		||||
            new Vector2(0, 0)
 | 
			
		||||
        );
 | 
			
		||||
        buls.push(0, 0, 0, 0, 0);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    let sp = createPath(pts, buls);
 | 
			
		||||
    let extrudeSettings = {
 | 
			
		||||
        steps: 1,
 | 
			
		||||
        bevelEnabled: false,
 | 
			
		||||
        amount: boardHeight
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    let ext = new THREE.ExtrudeGeometry(sp, extrudeSettings) as Geometry;
 | 
			
		||||
    ext.computeBoundingSphere();
 | 
			
		||||
    ext.computeBoundingBox();
 | 
			
		||||
    ext.translate(0, 0, -boardHeight)
 | 
			
		||||
    ext.applyMatrix(boardMat);
 | 
			
		||||
 | 
			
		||||
    //外边.
 | 
			
		||||
    let edges: (LineSegments | Mesh)[] = [createEdge(ext)];
 | 
			
		||||
 | 
			
		||||
    //差集
 | 
			
		||||
    if (checkObjectArray(boardData, "SubBoardLocal")
 | 
			
		||||
        || checkObjectArray(boardData, "Drillings"))
 | 
			
		||||
    {
 | 
			
		||||
        let thisCsg = new ThreeBSP(ext);
 | 
			
		||||
 | 
			
		||||
        if (boardData["SubBoardLocal"])
 | 
			
		||||
        {
 | 
			
		||||
            let subBoardList = boardData["SubBoardLocal"].map(d => createBoard(d));
 | 
			
		||||
            for (let br of subBoardList)
 | 
			
		||||
            {
 | 
			
		||||
                edges.push(...br.edges);
 | 
			
		||||
                let subCsg = new ThreeBSP(br.mesh);
 | 
			
		||||
                thisCsg = thisCsg.subtract(subCsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (boardData["Drillings"])
 | 
			
		||||
        {
 | 
			
		||||
            let dris = boardData["Drillings"];
 | 
			
		||||
            for (let dri of dris)
 | 
			
		||||
            {
 | 
			
		||||
                let geo = new CylinderGeometry(dri.r, dri.r, dri.h, 8);
 | 
			
		||||
                geo.rotateX(Math.PI * 0.5);
 | 
			
		||||
 | 
			
		||||
                if (dri.f === 0) //0正
 | 
			
		||||
                    geo.translate(dri.x, dri.y, -dri.h * 0.5);
 | 
			
		||||
                else             //1反
 | 
			
		||||
                    geo.translate(dri.x, dri.y, dri.h * 0.5 - boardData["H"]);
 | 
			
		||||
 | 
			
		||||
                geo.applyMatrix(boardMat);
 | 
			
		||||
 | 
			
		||||
                let mesh = new Mesh(geo, ColorMaterial.GetBasicMaterial(1));
 | 
			
		||||
                edges.push(mesh);
 | 
			
		||||
                // let edge = createEdge(geo);
 | 
			
		||||
                // edge.material = new LineBasicMaterial({ color: new Color(1, 0, 0) });
 | 
			
		||||
                // edges.push(edge);
 | 
			
		||||
 | 
			
		||||
                // let subCsg = new ThreeBSP(geo);
 | 
			
		||||
                // thisCsg = thisCsg.subtract(subCsg);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        ext = thisCsg.toGeometry();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (boardData["BoardName"] === "地脚线")
 | 
			
		||||
        RotateUVs(ext);
 | 
			
		||||
 | 
			
		||||
    let mesh = new THREE.Mesh(ext, boardMaterial);
 | 
			
		||||
    mesh.userData = ZD;
 | 
			
		||||
    edges.forEach(e => e.userData = ZD);
 | 
			
		||||
    return { mesh, edges };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function checkObjectArray(obj: any, key: string)
 | 
			
		||||
{
 | 
			
		||||
    return obj[key] && obj[key].length > 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
export function createTemplateBoard(brDataList: any[])
 | 
			
		||||
export function createTemplateBoard(brDataList: any[], material: MeshBasicMaterial)
 | 
			
		||||
{
 | 
			
		||||
    let meshs = [];
 | 
			
		||||
    let edgesa = [];
 | 
			
		||||
@@ -207,14 +86,15 @@ export function createTemplateBoard(brDataList: any[])
 | 
			
		||||
    };
 | 
			
		||||
    for (let d of brDataList)
 | 
			
		||||
    {
 | 
			
		||||
        let { mesh, edges } = createBoard(d);
 | 
			
		||||
        let board = new SimpleBoard(d);
 | 
			
		||||
        let { mesh, edges } = board.createBoard(material);
 | 
			
		||||
        meshs.push(mesh);
 | 
			
		||||
        edgesa.push(...edges);
 | 
			
		||||
 | 
			
		||||
        if (d['DataID'])
 | 
			
		||||
        if (board.DataID)
 | 
			
		||||
        {
 | 
			
		||||
            relations.blockMeshMap.set(d['DataID'], mesh.id);
 | 
			
		||||
            relations.meshBlockMap.set(mesh.id, d['DataID']);
 | 
			
		||||
            relations.blockMeshMap.set(board.DataID, mesh.id);
 | 
			
		||||
            relations.meshBlockMap.set(mesh.id, board.DataID);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return { meshs, edgesa, relations };
 | 
			
		||||
@@ -222,6 +102,6 @@ export function createTemplateBoard(brDataList: any[])
 | 
			
		||||
 | 
			
		||||
export function createEdge(geo: Geometry): LineSegments
 | 
			
		||||
{
 | 
			
		||||
    let edge = new THREE.EdgesGeometry(geo, 1);
 | 
			
		||||
    let edge = new EdgesGeometry(geo, 1);
 | 
			
		||||
    return new LineSegments(edge, edgeMaterial);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										550
									
								
								src/data.ts
									
									
									
									
									
								
							
							
						
						
									
										550
									
								
								src/data.ts
									
									
									
									
									
								
							@@ -1,550 +0,0 @@
 | 
			
		||||
export var data =
 | 
			
		||||
    [
 | 
			
		||||
        {
 | 
			
		||||
            "L": 100.0,
 | 
			
		||||
            "W": 800.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1942.2104819571228,
 | 
			
		||||
                "z": 1882.0
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 1.0,
 | 
			
		||||
                "y": 4.930380657631324e-32,
 | 
			
		||||
                "z": -2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": 2.220446049250313e-16,
 | 
			
		||||
                "y": 2.220446049250313e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 9.860761315262648e-32,
 | 
			
		||||
                "y": -1.0,
 | 
			
		||||
                "z": 2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1942.2104819571228,
 | 
			
		||||
                    "z": 1882.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1942.2104819571228,
 | 
			
		||||
                    "z": 1881.9999999999998
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1942.2104819571228,
 | 
			
		||||
                    "z": 1981.9999999999998
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1942.2104819571228,
 | 
			
		||||
                    "z": 1982.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1942.2104819571228,
 | 
			
		||||
                    "z": 1882.0
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 800.0,
 | 
			
		||||
            "W": 100.00000000000068,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1960.2104819571226,
 | 
			
		||||
                "z": 1900.0000000000005
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 4.440892098500626e-16,
 | 
			
		||||
                "y": 1.0,
 | 
			
		||||
                "z": 2.2204460492503124e-16
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": -1.0,
 | 
			
		||||
                "y": 4.440892098500626e-16,
 | 
			
		||||
                "z": 2.220446049250314e-16
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 2.220446049250313e-16,
 | 
			
		||||
                "y": -2.220446049250313e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "293",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1900.0000000000005
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 2060.210481957123,
 | 
			
		||||
                    "z": 1900.0000000000005
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2060.210481957123,
 | 
			
		||||
                    "z": 1900.0000000000005
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.210481957123,
 | 
			
		||||
                    "z": 1900.0000000000005
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1900.0000000000005
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 1899.9999999999998,
 | 
			
		||||
            "W": 800.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 2060.2104819571225,
 | 
			
		||||
                "z": -1.816324868286756e-13
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 1.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": 4.440892098500626e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": -1.0,
 | 
			
		||||
                "z": 4.440892098500626e-16
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "291",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "背板",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2060.2104819571225,
 | 
			
		||||
                    "z": -1.021405182655144e-13
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 2060.2104819571225,
 | 
			
		||||
                    "z": -1.816324868286756e-13
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 2060.210481957123,
 | 
			
		||||
                    "z": 1899.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2060.210481957123,
 | 
			
		||||
                    "z": 1899.9999999999998
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2060.2104819571225,
 | 
			
		||||
                    "z": -1.021405182655144e-13
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 800.0,
 | 
			
		||||
            "W": 482.0000000000002,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2876.407626150509,
 | 
			
		||||
                "y": 1578.210481957122,
 | 
			
		||||
                "z": 97.99999999999999
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 4.440892098500626e-16,
 | 
			
		||||
                "y": 1.0,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": -1.0,
 | 
			
		||||
                "y": 4.440892098500626e-16,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "290",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "底板",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1578.210481957122,
 | 
			
		||||
                    "z": 97.99999999999999
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 2060.2104819571225,
 | 
			
		||||
                    "z": 97.99999999999999
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2060.2104819571225,
 | 
			
		||||
                    "z": 97.99999999999999
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571226,
 | 
			
		||||
                    "z": 97.99999999999999
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1578.210481957122,
 | 
			
		||||
                    "z": 97.99999999999999
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 80.0,
 | 
			
		||||
            "W": 800.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2076.407626150509,
 | 
			
		||||
                "y": 1578.2104819571223,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 1.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": 4.440892098500626e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": -1.0,
 | 
			
		||||
                "z": 4.440892098500626e-16
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "28E",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "地脚线",
 | 
			
		||||
            "Grain": 1,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571223,
 | 
			
		||||
                    "z": 0.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571223,
 | 
			
		||||
                    "z": 0.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571223,
 | 
			
		||||
                    "z": 80.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571223,
 | 
			
		||||
                    "z": 80.0
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1578.2104819571223,
 | 
			
		||||
                    "z": 0.0
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 800.0,
 | 
			
		||||
            "W": 482.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2876.4076261505085,
 | 
			
		||||
                "y": 1478.210481957122,
 | 
			
		||||
                "z": 1999.9999999999996
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 4.440892098500626e-16,
 | 
			
		||||
                "y": 1.0,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": -1.0,
 | 
			
		||||
                "y": 4.440892098500626e-16,
 | 
			
		||||
                "z": 0.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 0.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "28C",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "顶板",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571223,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1478.2104819571226,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.407626150509,
 | 
			
		||||
                    "y": 1478.210481957122,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2876.4076261505085,
 | 
			
		||||
                    "y": 1960.210481957122,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571223,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 1999.9999999999996,
 | 
			
		||||
            "W": 600.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2894.4076261505094,
 | 
			
		||||
                "y": 1478.2104819571223,
 | 
			
		||||
                "z": -2.2737367544323197e-13
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 4.930380657631324e-32,
 | 
			
		||||
                "y": 1.0,
 | 
			
		||||
                "z": -2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": -2.220446049250313e-16,
 | 
			
		||||
                "y": 2.220446049250313e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 1.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "28B",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "右侧板",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1899.9999999999989
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1999.9999999999994
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.407626150509,
 | 
			
		||||
                    "y": 1478.2104819571228,
 | 
			
		||||
                    "z": 1999.9999999999994
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.4076261505094,
 | 
			
		||||
                    "y": 1478.2104819571223,
 | 
			
		||||
                    "z": -1.816324868286755e-13
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.4076261505094,
 | 
			
		||||
                    "y": 2078.2104819571225,
 | 
			
		||||
                    "z": -6.274980535181384e-13
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.407626150509,
 | 
			
		||||
                    "y": 2078.2104819571229,
 | 
			
		||||
                    "z": 1899.9999999999973
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2894.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1899.9999999999989
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            "L": 1999.9999999999996,
 | 
			
		||||
            "W": 600.0,
 | 
			
		||||
            "H": 18.0,
 | 
			
		||||
            "MaterialId": "EE",
 | 
			
		||||
            "BasePoint": {
 | 
			
		||||
                "x": 2076.4076261505094,
 | 
			
		||||
                "y": 1478.2104819571223,
 | 
			
		||||
                "z": 1.0097419586828951e-28
 | 
			
		||||
            },
 | 
			
		||||
            "XVec": {
 | 
			
		||||
                "x": 4.930380657631324e-32,
 | 
			
		||||
                "y": 1.0,
 | 
			
		||||
                "z": -2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "YVec": {
 | 
			
		||||
                "x": -2.220446049250313e-16,
 | 
			
		||||
                "y": 2.220446049250313e-16,
 | 
			
		||||
                "z": 1.0
 | 
			
		||||
            },
 | 
			
		||||
            "ZVec": {
 | 
			
		||||
                "x": 1.0,
 | 
			
		||||
                "y": 0.0,
 | 
			
		||||
                "z": 2.220446049250313e-16
 | 
			
		||||
            },
 | 
			
		||||
            "Handle": "288",
 | 
			
		||||
            "CabName": "1.标准柜上梁1",
 | 
			
		||||
            "BoardName": "左侧板",
 | 
			
		||||
            "Grain": 0,
 | 
			
		||||
            "Pts": [
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1899.999999999999
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1478.2104819571228,
 | 
			
		||||
                    "z": 1999.9999999999996
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.4076261505094,
 | 
			
		||||
                    "y": 1478.2104819571223,
 | 
			
		||||
                    "z": 1.0097419586828951e-28
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.4076261505094,
 | 
			
		||||
                    "y": 2078.2104819571225,
 | 
			
		||||
                    "z": -4.4586556668946279e-13
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 2078.2104819571229,
 | 
			
		||||
                    "z": 1899.9999999999978
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    "x": 2076.407626150509,
 | 
			
		||||
                    "y": 1960.2104819571228,
 | 
			
		||||
                    "z": 1899.999999999999
 | 
			
		||||
                }
 | 
			
		||||
            ],
 | 
			
		||||
            "Buls": [
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0,
 | 
			
		||||
                0.0
 | 
			
		||||
            ],
 | 
			
		||||
            "SubBoardLocal": [],
 | 
			
		||||
            "SubBoardAssoc": []
 | 
			
		||||
        }
 | 
			
		||||
    ]
 | 
			
		||||
@@ -1,10 +1,13 @@
 | 
			
		||||
{
 | 
			
		||||
    "compileOnSave": true,
 | 
			
		||||
    "compilerOptions": {
 | 
			
		||||
        "sourceMap": true,
 | 
			
		||||
        "declaration": true,
 | 
			
		||||
        "outDir": "./dist",
 | 
			
		||||
        "target": "es5",
 | 
			
		||||
        "sourceMap": true,
 | 
			
		||||
        "module": "commonjs",
 | 
			
		||||
        "target": "es2020",
 | 
			
		||||
        "noLib": false,
 | 
			
		||||
        "moduleResolution": "node",
 | 
			
		||||
        "skipLibCheck": true,
 | 
			
		||||
        "esModuleInterop": true,
 | 
			
		||||
        "lib": [
 | 
			
		||||
            "esnext",
 | 
			
		||||
            "dom"
 | 
			
		||||
@@ -12,13 +15,13 @@
 | 
			
		||||
        "types": [
 | 
			
		||||
            "node",
 | 
			
		||||
            "webpack-env",
 | 
			
		||||
            "webpack-dev-server"
 | 
			
		||||
            "webpack-dev-server",
 | 
			
		||||
        ],
 | 
			
		||||
        "module": "commonjs",
 | 
			
		||||
        "jsx": "react",
 | 
			
		||||
        "experimentalDecorators": true
 | 
			
		||||
    },
 | 
			
		||||
    "include": [
 | 
			
		||||
        "./src/**/*",
 | 
			
		||||
        // "./config/**/*"
 | 
			
		||||
        "./config/**/*"
 | 
			
		||||
    ]
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -96,7 +96,7 @@ downloadTypes({
 | 
			
		||||
    urlPath: "https://gitee.com/BearCAD/DefinitelyType2/raw/master/three/",
 | 
			
		||||
    files: [
 | 
			
		||||
        // "index.d.ts",
 | 
			
		||||
        "three-core.d.ts",
 | 
			
		||||
        // "three-core.d.ts",
 | 
			
		||||
        // "three-outlinepass.d.ts",
 | 
			
		||||
        // "three-smaapass.d.ts"
 | 
			
		||||
    ]
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								utils/rmtype.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								utils/rmtype.ts
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,7 @@
 | 
			
		||||
import fs from "fs";
 | 
			
		||||
 | 
			
		||||
fs.rmdir(".\\node_modules\\@types\\webpack-merge\\node_modules\\webpack", { recursive: true }, (err) =>
 | 
			
		||||
{
 | 
			
		||||
    console.log("删除webpack目录");
 | 
			
		||||
    if (err) console.log(err);
 | 
			
		||||
});
 | 
			
		||||
		Reference in New Issue
	
	Block a user