# 通用项
# 平面点集的法线识别
/**
* robust 识别出点集或者多边形的法线
* @param {Polygon|Array<Point|Vector3>} points
* @returns {Vector3} 法线
*/
recognitionPolygonNormal(points);
# 判断多个点是否共线:
/**
* 判断多个点是否共线:
* 考虑情况点之间的距离应该大于最小容忍值
* @param {...Point} ps
* @returns {boolean}
*/
pointsCollinear(...ps);
# 点集操作
# 计算包围盒
/**
* 计算包围盒
* @param {*} points 点集
* @returns {Array[min,max]} 返回最小最大值
*/
boundingBox(points);
# 空间操作(平移,旋转是,缩放)
/**
* 平移
* @param {*} points
* @param {*} distance
* @param {*} ref
*/
translate(points, distance, ref = true);
/**
* 旋转
* @param {*} points
* @param {*} axis
* @param {*} angle
* @param {*} ref
*/
rotate(points, axis, angle, ref = true)
/**
* 两个向量之间存在的旋转量来旋转点集
* @param {*} points
* @param {*} axis
* @param {*} angle
* @param {*} ref
*/
rotateByUnitVectors(points, vFrom, vTo, ref = true)
/**
* 缩放
* @param {*} points
* @param {*} axis
* @param {*} angle
* @param {*} ref
*/
scale(points, scale, ref = true)
/**
* 响应矩阵
* @param {*} points
* @param {*} axis
* @param {*} angle
* @param {*} ref
*/
applyMatrix4(points, matrix, ref = true) {
# 折线或者路径简化
折线或者路径中过密或者过直的点去除;
(2020 年 1 月 17 增加)
/**
* 简化点集数组,折线,路径
* @param {*} points 点集数组,折线,路径 ,继承Array
* @param {*} maxDistance 简化最大距离 默认值0.1
* @param {*} maxAngle 简化最大角度 弧度 默认值 Math.PI / 180 * 5
*/
simplifyPointList(points, maxDistance, maxAngle);
# 三角剖分
/**
* 三角剖分 earcut.js
* @param {Array} boundary 边界
* @param {Array<Array>} holes 洞的数组
* @param {options:{feature,dim,normal}} feature 选择平平面
* @returns {Array<Number>} 三角形索引数组
*/
trianglation(inboundary, (holes = []), (options = {}));
<script src="../../"></script>
# 挤压
/**
* 挤压
* @param {Polygon|Array<Point|Vector3> } shape 多边形或顶点数组
* @param {Path|Array<Point|Vector3> } path 路径或者或顶点数组
* @param {Object} options {
* isClosed: false,闭合为多边形
* isClosed2: false, 闭合为圈
* textureEnable: true, 计算纹理坐标
* textureScale: new Vector2(1, 1),纹理坐标缩放
* smoothAngle: Math.PI / 180 * 30,大于这个角度则不平滑
* sealStart: true, 是否密封开始面
* sealEnd: true,是否密封结束面}
*/
extrude(shape, arg_path, (options = {}));
# 缝合
/**
* 缝合shape集合
* @param {Array<Array<Point|Vector3>} shapes 路基 点集的集合, 每个shape的点数量一致
* @param {Boolean} isClosed 每一个shape是否是封闭的圈 默认false
* @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
*/
linkSides(shapes, (isClosed = false), (isClosed2 = false));
/**
* 缝合s 折线集合
* @param {Array} polylines 路基 点集的集合,
* @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
*/
linkPolyline(polylines);
/**
* 缝合 多边形集合
* @param {Array} polygon
* @returns {Array} 返回三角形集合 如果有所用范围索引,否则返回顶点
*/
linkPloygon(polygon);