同步代码
This commit is contained in:
171
api.esm.js
171
api.esm.js
@@ -150,11 +150,15 @@ var RenderType;
|
||||
/**物理带线框 */
|
||||
RenderType[RenderType["Physical2Print"] = 106] = "Physical2Print";
|
||||
})(RenderType || (RenderType = {}));
|
||||
function IsPhysical(renderType) {
|
||||
return renderType === RenderType.Physical || renderType === RenderType.Physical2 || renderType === RenderType.PhysicalPrint || renderType === RenderType.Physical2Print;
|
||||
}
|
||||
|
||||
class IHostApplicationServices {
|
||||
constructor() {
|
||||
this.UseShadow = true;
|
||||
this.isShowLightShadow = true; //灯光阴影 (除太阳光外)
|
||||
this.ShowHistoryLog = true;
|
||||
this.DrawWallBottomFace = false; //绘制底面
|
||||
//#region _RenderType 渲染类型
|
||||
this._renderType = RenderType.Wireframe;
|
||||
//#endregion
|
||||
@@ -219,6 +223,9 @@ class IHostApplicationServices {
|
||||
async LoadMetalEnv() { return; }
|
||||
}
|
||||
IHostApplicationServices.__ProxyKeys__ = []; //代理对象,当代理对象存在时,获取内部的值指向代理对象
|
||||
__decorate([
|
||||
ProxyValue
|
||||
], IHostApplicationServices.prototype, "isShowLightShadow", void 0);
|
||||
__decorate([
|
||||
ProxyValue
|
||||
], IHostApplicationServices.prototype, "_renderType", void 0);
|
||||
@@ -4952,7 +4959,7 @@ class CurveIntersection {
|
||||
* @param {Curve[]} cus 请注意数组的顺序会被更改,如果你在意数组的顺序,请拷贝数组后传进来
|
||||
* @memberof CurveIntersection
|
||||
*/
|
||||
constructor(cus, parseIntersectionParam = false, intType = IntersectOption.OnBothOperands, fuzz = 1e-6, parseRecord = false) {
|
||||
constructor(cus, parseIntersectionParam = false, intType = IntersectOption.ExtendNone, fuzz = 1e-6, parseRecord = false) {
|
||||
this.fuzz = fuzz;
|
||||
//用来缓存的曲线包围盒
|
||||
this.boxMap = new Map();
|
||||
@@ -5523,7 +5530,7 @@ function isTargetCurInOrOnSourceCur(sourceCur, targetCur) {
|
||||
}
|
||||
//获取交点处上下距0.01par的点
|
||||
function getIntPtContextPts(sourceCur, cu, pts = []) {
|
||||
let interPts = cu.IntersectWith(sourceCur, IntersectOption.OnBothOperands);
|
||||
let interPts = cu.IntersectWith(sourceCur, IntersectOption.ExtendNone);
|
||||
if (interPts.length > 0) {
|
||||
let pars = interPts.map(pt => cu.GetParamAtPoint(pt));
|
||||
for (let par of pars) {
|
||||
@@ -5714,7 +5721,7 @@ class Contour {
|
||||
//可能会有提升,但是好像不大(并且还有更慢的趋势)
|
||||
// if (!sourceOutline.BoundingBox.intersectsBox(targetOutline.BoundingBox, 1e-3))
|
||||
// return { intersectionList, unionList };
|
||||
let interPts = sourceOutline.IntersectWith2(targetOutline, IntersectOption.OnBothOperands, COMBINE_FUZZ);
|
||||
let interPts = sourceOutline.IntersectWith2(targetOutline, IntersectOption.ExtendNone, COMBINE_FUZZ);
|
||||
let sourceContainerTarget;
|
||||
let targetContainerSource;
|
||||
if (sourceOutline.Area > targetOutline.Area) {
|
||||
@@ -5786,7 +5793,7 @@ class Contour {
|
||||
let sourceOutline = this._Curve;
|
||||
let targetOutline = target.Curve;
|
||||
let isEqualNormal = equalv3(sourceOutline.Normal, targetOutline.Normal, 1e-3);
|
||||
let interPts = sourceOutline.IntersectWith2(targetOutline, IntersectOption.OnBothOperands, COMBINE_FUZZ);
|
||||
let interPts = sourceOutline.IntersectWith2(targetOutline, IntersectOption.ExtendNone, COMBINE_FUZZ);
|
||||
if (interPts.length <= 1) {
|
||||
//反包含
|
||||
if (fastCurveInCurve2(targetOutline, sourceOutline) || equalCurve(targetOutline, sourceOutline))
|
||||
@@ -5866,7 +5873,7 @@ class Contour {
|
||||
const targetOutline = con.Curve;
|
||||
if (!IntersectBox2(outBox, targetOutline.BoundingBox))
|
||||
continue;
|
||||
let pts = sourceOutline.IntersectWith2(con.Curve, IntersectOption.OnBothOperands, COMBINE_FUZZ);
|
||||
let pts = sourceOutline.IntersectWith2(con.Curve, IntersectOption.ExtendNone, COMBINE_FUZZ);
|
||||
if (pts.length <= 1) {
|
||||
//反包含
|
||||
if (fastCurveInCurve2(targetOutline, sourceOutline) || equalCurve(targetOutline, sourceOutline))
|
||||
@@ -6015,7 +6022,7 @@ class CurveTreeNode {
|
||||
}
|
||||
}
|
||||
//交点参数列表
|
||||
let iParams = this.curve.IntersectWith(contour.Curve, IntersectOption.OnBothOperands)
|
||||
let iParams = this.curve.IntersectWith(contour.Curve, IntersectOption.ExtendNone)
|
||||
.map(p => this.curve.GetParamAtPoint2(p));
|
||||
let cus = this.curve.GetSplitCurves(iParams);
|
||||
if (cus.length === 0) {
|
||||
@@ -6273,7 +6280,7 @@ class OffsetPolyline {
|
||||
let [p1, p2, p3, p4] = [cu1.StartPoint, cu2.StartPoint, cu1.EndPoint, cu2.EndPoint];
|
||||
let l1 = new Line(p1, p2);
|
||||
let l2 = new Line(p3, p4);
|
||||
let ipts = l1.IntersectWith(l2, IntersectOption.OnBothOperands, 1e-8);
|
||||
let ipts = l1.IntersectWith(l2, IntersectOption.ExtendNone, 1e-8);
|
||||
if (ipts.length > 0) {
|
||||
let p = ipts[0];
|
||||
l1.EndPoint = p;
|
||||
@@ -6293,8 +6300,8 @@ class OffsetPolyline {
|
||||
let l2Intact = true;
|
||||
if (cu2 instanceof Arc) {
|
||||
if (Math.sign(cu2.Bul) !== this._OffsetDistSign) {
|
||||
let ipts1 = cu2.IntersectWith(l1, IntersectOption.OnBothOperands);
|
||||
let ipts2 = cu2.IntersectWith(l2, IntersectOption.OnBothOperands);
|
||||
let ipts1 = cu2.IntersectWith(l1, IntersectOption.ExtendNone);
|
||||
let ipts2 = cu2.IntersectWith(l2, IntersectOption.ExtendNone);
|
||||
let sp;
|
||||
let ep;
|
||||
if (ipts1.length === 2)
|
||||
@@ -6321,7 +6328,7 @@ class OffsetPolyline {
|
||||
if (l1Intact && d.preCurve && d.preCurve instanceof Arc) {
|
||||
let a = d.preCurve;
|
||||
if (Math.sign(a.Bul) !== this._OffsetDistSign && a.AllAngle > 1e-6) {
|
||||
let ipts = a.IntersectWith(l1, IntersectOption.OnBothOperands);
|
||||
let ipts = a.IntersectWith(l1, IntersectOption.ExtendNone);
|
||||
if (ipts.length === 2) {
|
||||
let sp = SelectNearP(ipts, p1);
|
||||
l1.EndPoint = sp;
|
||||
@@ -6333,7 +6340,7 @@ class OffsetPolyline {
|
||||
if (l2Intact && d.nextCurve && d.nextCurve instanceof Arc) {
|
||||
let a = d.nextCurve;
|
||||
if (Math.sign(a.Bul) !== this._OffsetDistSign && a.AllAngle > 1e-6) {
|
||||
let ipts = a.IntersectWith(l2, IntersectOption.OnBothOperands);
|
||||
let ipts = a.IntersectWith(l2, IntersectOption.ExtendNone);
|
||||
if (ipts.length === 2) {
|
||||
let ep = SelectNearP(ipts, p3);
|
||||
l2.EndPoint = ep;
|
||||
@@ -7667,7 +7674,7 @@ let Polyline = Polyline_1 = class Polyline extends Curve {
|
||||
let d1 = this._LineData[i];
|
||||
let d2 = this._LineData[FixIndex$1(i + 1, this._LineData)];
|
||||
let curve;
|
||||
if (equaln$1(d1.bul, 0, 1e-8))
|
||||
if (equaln$1(d1.bul, 0, 1e-5))
|
||||
curve = new Line(AsVector3(d1.pt), AsVector3(d2.pt)).ApplyMatrix(this.OCSNoClone);
|
||||
else
|
||||
curve = new Arc().ParseFromBul(d1.pt, d2.pt, d1.bul).ApplyMatrix(this.OCSNoClone);
|
||||
@@ -7687,7 +7694,7 @@ let Polyline = Polyline_1 = class Polyline extends Curve {
|
||||
let c = cus[i];
|
||||
for (let j = i + 2; j < cus.length; j++) {
|
||||
let c2 = cus[j];
|
||||
let pts = c.IntersectWith(c2, IntersectOption.OnBothOperands);
|
||||
let pts = c.IntersectWith(c2, IntersectOption.ExtendNone);
|
||||
for (let p of pts) {
|
||||
intParams.push(i + c.GetParamAtPoint(p));
|
||||
intParams.push(j + c2.GetParamAtPoint(p));
|
||||
@@ -8067,7 +8074,7 @@ var IntersectOption;
|
||||
/**
|
||||
* 两者都不延伸
|
||||
*/
|
||||
IntersectOption[IntersectOption["OnBothOperands"] = 0] = "OnBothOperands";
|
||||
IntersectOption[IntersectOption["ExtendNone"] = 0] = "ExtendNone";
|
||||
/**
|
||||
* 延伸自身
|
||||
*/
|
||||
@@ -8511,7 +8518,7 @@ function IntersectEllipseAndCircleOrArc(el, cir, type) {
|
||||
if (type === IntersectOption.ExtendBoth)
|
||||
type = IntersectOption.ExtendArg;
|
||||
else if (type !== IntersectOption.ExtendArg)
|
||||
type = IntersectOption.OnBothOperands;
|
||||
type = IntersectOption.ExtendNone;
|
||||
let intPts = IntersectPolylineAndCurve(pl, cirClone, type);
|
||||
intPts.forEach(r => r.pt.applyMatrix4(el.OCS));
|
||||
return intPts;
|
||||
@@ -14937,7 +14944,7 @@ function GetIntersection(cu1, cu2) {
|
||||
else
|
||||
m = new Map();
|
||||
intCache.set(cu1, m);
|
||||
let r = cu1.IntersectWith2(cu2, IntersectOption.OnBothOperands);
|
||||
let r = cu1.IntersectWith2(cu2, IntersectOption.ExtendNone);
|
||||
let cu1EndParam = cu1.EndParam;
|
||||
let cu2EndParam = cu2.EndParam;
|
||||
for (let d of r) {
|
||||
@@ -20945,20 +20952,20 @@ class CurveTrim {
|
||||
this._curve = _curve;
|
||||
this._TrimParams = [];
|
||||
this._IsErase = false;
|
||||
this._Box = _curve.BoundingBox;
|
||||
this._Box = _curve.BoundingBox.expandByVector(new Vector3(0.01, 0.01));
|
||||
}
|
||||
TrimBy(contour, box) {
|
||||
TrimBy(contour, box, saveSyntropy = false) {
|
||||
if (this._IsErase)
|
||||
return;
|
||||
//交点参数列表
|
||||
let iParams = this._curve.IntersectWith2(contour.Curve, IntersectOption.OnBothOperands).map(p => p.thisParam).filter(p => p > 1e-4 && p < 0.9999);
|
||||
let iParams = this._curve.IntersectWith2(contour.Curve, IntersectOption.ExtendNone).map(p => p.thisParam).filter(p => p > 1e-6 && p < 0.999999);
|
||||
iParams.push(0, 1);
|
||||
iParams.sort((a, b) => a - b);
|
||||
arrayRemoveDuplicateBySort(iParams, (a1, a2) => equaln(a1, a2, 1e-4));
|
||||
arrayRemoveDuplicateBySort(iParams, (a1, a2) => equaln(a1, a2, 1e-6));
|
||||
if (iParams.length === 2) //[0,1]全包含 或者在外部
|
||||
{
|
||||
let p = this._curve.GetPointAtParam(0.5);
|
||||
if (this.PointInContour(p, contour, box))
|
||||
let p = this.GetPointAtParam(0.5);
|
||||
if (this.PointInContour(p, contour, box, saveSyntropy))
|
||||
this._IsErase = true;
|
||||
return;
|
||||
}
|
||||
@@ -20968,8 +20975,8 @@ class CurveTrim {
|
||||
if (insertIndex !== 0 && this._TrimParams[insertIndex - 1][1] > eparam) //包含在已经被切割的范围内,那么直接不用重复判断 (只可能被前一段包含)
|
||||
continue;
|
||||
let midParam = (sparam + eparam) * 0.5;
|
||||
let p = this._curve.GetPointAtParam(midParam); //这个性能不高 可以优化
|
||||
if (this.PointInContour(p, contour, box)) {
|
||||
let p = this.GetPointAtParam(midParam);
|
||||
if (this.PointInContour(p, contour, box, saveSyntropy)) {
|
||||
InsertRangeAndUnion(this._TrimParams, sparam, eparam, insertIndex);
|
||||
if (this._TrimParams.length === 1 && this._TrimParams[0][0] === 0 && this._TrimParams[0][1] === 1) {
|
||||
this._IsErase = true;
|
||||
@@ -20978,7 +20985,7 @@ class CurveTrim {
|
||||
}
|
||||
}
|
||||
}
|
||||
PointInContour(p, contour, contourBox) {
|
||||
PointInContour(p, contour, contourBox, saveSyntropy = false) {
|
||||
return contourBox.containsPoint(p) && (contour.Curve.PtInCurve(p) && !contour.Curve.PtOnCurve(p));
|
||||
}
|
||||
TrimParam(sparam, eparam) {
|
||||
@@ -21007,7 +21014,7 @@ class CurveTrimLine extends CurveTrim {
|
||||
GetPointAtParam(param) {
|
||||
return this._Fd.clone().multiplyScalar(param).add(this._Sp);
|
||||
}
|
||||
PointInContour(p, contour, contourBox) {
|
||||
PointInContour(p, contour, contourBox, saveSyntropy = false) {
|
||||
if (!contourBox.containsPoint(p))
|
||||
return false;
|
||||
let pl = contour.Curve;
|
||||
@@ -21018,12 +21025,14 @@ class CurveTrimLine extends CurveTrim {
|
||||
if (cu.ParamOnCurve(d.param) && equalv3(d.closestPt, p, 1e-5)) //点在线上
|
||||
{
|
||||
let derv = cu.GetFistDeriv(d.param).normalize();
|
||||
return equalv3(derv, this.derv);
|
||||
return equalv3(derv, this.derv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), this.derv, 1e-4)); //因为墙体为顺时针 轮廓为逆时针 所以这里相等=反向
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cu.PtOnCurve(p))
|
||||
return equalv3(this.derv, cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize());
|
||||
if (cu.PtOnCurve(p, 1e-5)) {
|
||||
let derv = cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize();
|
||||
return equalv3(this.derv, derv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), this.derv, 1e-4));
|
||||
}
|
||||
}
|
||||
}
|
||||
return contour.Curve.PtInCurve(p);
|
||||
@@ -21052,27 +21061,27 @@ class CurveTrimArc extends CurveTrim {
|
||||
this._curve = _curve;
|
||||
this._IsLeft = _IsLeft;
|
||||
}
|
||||
PointInContour(p, contour, contourBox) {
|
||||
PointInContour(p, contour, contourBox, saveSyntropy = false) {
|
||||
if (!contourBox.containsPoint(p))
|
||||
return false;
|
||||
let pl = contour.Curve;
|
||||
let thisDerv = this._curve.GetFistDeriv(p).normalize();
|
||||
if (this._IsLeft)
|
||||
thisDerv.negate();
|
||||
for (let i = 0; i < pl.EndParam; i++) {
|
||||
let cu = pl.GetCurveAtIndex(i);
|
||||
if (cu instanceof Line) {
|
||||
let d = cu.GetClosestAtPoint(p, true);
|
||||
if (cu.ParamOnCurve(d.param) && equalv3(d.closestPt, p, 1e-5)) //点在线上
|
||||
if (cu.ParamOnCurve(d.param) && equalv3(d.closestPt, p, 1e-5)) //点在线上 //这个代码似乎是错误的,因为直线和圆弧不可能重合
|
||||
{
|
||||
let derv = cu.GetFistDeriv(d.param).normalize();
|
||||
return equalv3(derv, thisDerv);
|
||||
return equalv3(derv, thisDerv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), thisDerv, 1e-4)); //因为墙体为顺时针 轮廓为逆时针 所以这里相等=反向
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (cu.PtOnCurve(p)) {
|
||||
let derv = this._curve.GetFistDeriv(this._curve.GetParamAtPoint2(p)).normalize();
|
||||
if (this._IsLeft)
|
||||
derv.negate();
|
||||
return equalv3(derv, cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize());
|
||||
if (cu.PtOnCurve(p, 1e-5)) {
|
||||
let cuDerv = cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize();
|
||||
return equalv3(thisDerv, cuDerv, 1e-4) || (saveSyntropy && equalv3(cuDerv.negate(), thisDerv, 1e-4));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21386,8 +21395,9 @@ let RoomHolePolyline = class RoomHolePolyline extends RoomHoleBase {
|
||||
let endX = lid.Length * 1e-3;
|
||||
let startZ = 0;
|
||||
let endZ = this._Height * 1e-3;
|
||||
let parse = CreateGetCurveParam(lid);
|
||||
geo.faces.push(new Face3(startIndex, startIndex + 2, startIndex + 1, parse.LeftDir), new Face3(startIndex + 1, startIndex + 2, startIndex + 3, parse.LeftDir));
|
||||
let normal = p2.clone().sub(p1).normalize();
|
||||
LEFT_ROTATE_MTX2.applyVector(normal);
|
||||
geo.faces.push(new Face3(startIndex, startIndex + 2, startIndex + 1, normal), new Face3(startIndex + 1, startIndex + 2, startIndex + 3, normal));
|
||||
geo.faceVertexUvs[0].push([new Vector2$1(startX, startZ), new Vector2$1(startX, endZ), new Vector2$1(endX, startZ)], [new Vector2$1(endX, startZ), new Vector2$1(startX, endZ), new Vector2$1(endX, endZ)]);
|
||||
}
|
||||
if (this.Regions)
|
||||
@@ -22736,7 +22746,6 @@ let Light = Light_1 = class Light extends Entity {
|
||||
en.intensity = this.WebIntensity;
|
||||
en.color = this._LightColor;
|
||||
en.visible = this._OpenLight;
|
||||
en.castShadow = this.CaseShadow;
|
||||
}
|
||||
get Intensity() {
|
||||
return this._Intensity;
|
||||
@@ -22901,7 +22910,9 @@ let DirectionalLight = class DirectionalLight extends Light {
|
||||
InitDrawObject(renderType = RenderType.Wireframe) {
|
||||
let lightGroup = new Group();
|
||||
let light = new DirectionalLight$1(this._LightColor, this.WebIntensity);
|
||||
light.castShadow = HostApplicationServices.UseShadow;
|
||||
Object.defineProperty(light, "castShadow", {
|
||||
get: () => this.CaseShadow //HostApplicationServices.isShowLightShadow //太阳光无视这个配置!
|
||||
});
|
||||
light.shadow.camera.matrixAutoUpdate = true;
|
||||
light.shadow.camera.near = 1;
|
||||
light.shadow.camera.far = 100000;
|
||||
@@ -24329,7 +24340,7 @@ class CameraUpdate {
|
||||
}
|
||||
this.Update();
|
||||
}
|
||||
ZoomExtensBox3(box3) {
|
||||
ZoomExtentsBox3(box3) {
|
||||
if (!box3 || box3.isEmpty())
|
||||
return;
|
||||
this.Camera.updateMatrixWorld(false);
|
||||
@@ -24590,7 +24601,7 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
}
|
||||
if (box.isEmpty())
|
||||
box.set(new Vector3(), new Vector3(1000 * (this.Width / this.Height), 1000, 1000));
|
||||
this.camera.ZoomExtensBox3(box);
|
||||
this.camera.ZoomExtentsBox3(box);
|
||||
this.camera.Zoom(1.2);
|
||||
}
|
||||
ZoomtoEntitys(ens) {
|
||||
@@ -24598,7 +24609,7 @@ let ViewportEntity = ViewportEntity_1 = class ViewportEntity extends Entity {
|
||||
ens.reduce((b, e) => b.union(e.BoundingBox), box);
|
||||
if (box.isEmpty())
|
||||
return;
|
||||
this.camera.ZoomExtensBox3(box);
|
||||
this.camera.ZoomExtentsBox3(box);
|
||||
this.camera.Zoom(1.2);
|
||||
}
|
||||
get RenderType() {
|
||||
@@ -26906,7 +26917,7 @@ let PointLight = class PointLight extends Light {
|
||||
InitDrawObject(renderType = RenderType.Wireframe) {
|
||||
let lightGroup = new Group();
|
||||
let ptLight = new PointLight$1(this._LightColor, this.WebIntensity, this._Distance, this._Decay);
|
||||
ptLight.castShadow = HostApplicationServices.UseShadow;
|
||||
Object.defineProperty(ptLight, "castShadow", { get: () => HostApplicationServices.isShowLightShadow && this.CaseShadow });
|
||||
ptLight.shadow.camera.matrixAutoUpdate = true;
|
||||
ptLight.shadow.camera.far = 10000;
|
||||
//绘制灯光助手
|
||||
@@ -27535,7 +27546,7 @@ let SpotLight = class SpotLight extends Light {
|
||||
light.target.position.set(0, 0, -1);
|
||||
light.target.updateMatrix();
|
||||
light.add(light.target);
|
||||
light.castShadow = HostApplicationServices.UseShadow;
|
||||
Object.defineProperty(light, "castShadow", { get: () => HostApplicationServices.isShowLightShadow && this.CaseShadow });
|
||||
light.shadow.camera.matrixAutoUpdate = true;
|
||||
light.shadow.camera.far = this._Distance;
|
||||
group.add(light); //灯光
|
||||
@@ -28509,15 +28520,18 @@ let RoomWallArc = class RoomWallArc extends RoomWallBase {
|
||||
let startIndex = geo.vertices.length;
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, this._Height));
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, 0));
|
||||
if (HostApplicationServices.DrawWallBottomFace)
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, 0));
|
||||
for (let i = 0; i < faces.length; i++) {
|
||||
let [a, b, c] = faces[i];
|
||||
geo.faces.push(new Face3(startIndex + a, startIndex + b, startIndex + c, normal));
|
||||
let uvs = faces[i].map(index => pts[index].clone());
|
||||
geo.faceVertexUvs[0].push(uvs);
|
||||
geo.faces.push(new Face3(startIndex + pts.length + c, startIndex + pts.length + b, startIndex + pts.length + a, normaln));
|
||||
geo.faceVertexUvs[0].push(uvs.concat().reverse().map(v => v.clone()));
|
||||
if (HostApplicationServices.DrawWallBottomFace) {
|
||||
geo.faces.push(new Face3(startIndex + pts.length + c, startIndex + pts.length + b, startIndex + pts.length + a, normaln));
|
||||
geo.faceVertexUvs[0].push(uvs.concat().reverse().map(v => v.clone()));
|
||||
}
|
||||
}
|
||||
// //todo:为了优化显示 我们可以把侧面也画出来 (应该使用和酷家乐一样的技术 在视线对准时,隐藏整个墙)
|
||||
// let d = this._EndPoint.clone().sub(this._StartPoint).normalize();
|
||||
@@ -29094,7 +29108,7 @@ class FilletUtils {
|
||||
// offCu2.ColorIndex = 6;
|
||||
// JigUtils.Draw(offCu1.Clone());
|
||||
// JigUtils.Draw(offCu2.Clone());
|
||||
let center = offCu1.IntersectWith(offCu2, IntersectOption.OnBothOperands)
|
||||
let center = offCu1.IntersectWith(offCu2, IntersectOption.ExtendNone)
|
||||
.sort((p1, p2) => {
|
||||
return p1.distanceToSquared(iPt) - p2.distanceToSquared(iPt);
|
||||
})[0];
|
||||
@@ -33736,7 +33750,7 @@ class DrawObliqueWineRackTool extends DrawWineRackTool {
|
||||
let d = lData[i];
|
||||
let dists = [];
|
||||
for (let d2 of rData) {
|
||||
let intPts = d.pl.IntersectWith(d2.pl, IntersectOption.OnBothOperands);
|
||||
let intPts = d.pl.IntersectWith(d2.pl, IntersectOption.ExtendNone);
|
||||
if (intPts.length === 4) {
|
||||
dists.push(...intPts.map(p => {
|
||||
let p1 = p.applyMatrix4(d.matInv);
|
||||
@@ -34539,19 +34553,21 @@ let RoomWallLine = class RoomWallLine extends RoomWallBase {
|
||||
let pts = this.Region.MatrixAlignTo2(this.OCSNoClone).pts;
|
||||
this.Region.OCSNoClone.elements[14] = bakZ;
|
||||
let faces = ShapeUtils.triangulateShape(pts, []);
|
||||
//top
|
||||
let startIndex = geo.vertices.length;
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, this._Height));
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, 0));
|
||||
if (HostApplicationServices.DrawWallBottomFace)
|
||||
for (let p of pts)
|
||||
geo.vertices.push(new Vector3(p.x, p.y, 0));
|
||||
for (let i = 0; i < faces.length; i++) {
|
||||
let [a, b, c] = faces[i];
|
||||
geo.faces.push(new Face3(startIndex + a, startIndex + b, startIndex + c, normal));
|
||||
let uvs = faces[i].map(index => pts[index].clone());
|
||||
geo.faceVertexUvs[0].push(uvs);
|
||||
geo.faces.push(new Face3(startIndex + pts.length + c, startIndex + pts.length + b, startIndex + pts.length + a, normaln));
|
||||
geo.faceVertexUvs[0].push(uvs.concat().reverse().map(v => v.clone()));
|
||||
if (HostApplicationServices.DrawWallBottomFace) {
|
||||
geo.faces.push(new Face3(startIndex + pts.length + c, startIndex + pts.length + b, startIndex + pts.length + a, normaln));
|
||||
geo.faceVertexUvs[0].push(uvs.concat().reverse().map(v => v.clone()));
|
||||
}
|
||||
}
|
||||
// //todo:为了优化显示 我们可以把侧面也画出来 (应该使用和酷家乐一样的技术 在视线对准时,隐藏整个墙)
|
||||
// let d = this._EndPoint.clone().sub(this._StartPoint).normalize();
|
||||
@@ -35592,7 +35608,9 @@ class RoomRegionParse {
|
||||
for (let c of wall.LidCurves)
|
||||
curves.push(c);
|
||||
}
|
||||
let parse = new RegionParse(curves);
|
||||
const REGION_PARSE_NUM = 3;
|
||||
const POLYLINE_JOIN_FUZZ = Math.pow(10, -REGION_PARSE_NUM);
|
||||
let parse = new RegionParse(curves, REGION_PARSE_NUM);
|
||||
for (let [orgArc, arcs] of parse.ExpLineMap) {
|
||||
if (leftCurves.has(orgArc))
|
||||
for (let arc of arcs)
|
||||
@@ -35602,7 +35620,7 @@ class RoomRegionParse {
|
||||
let map = new Map();
|
||||
//分析内外墙1内2外
|
||||
for (let routes of parse.RegionsOutline) {
|
||||
let pl = Polyline.Combine(routes.map(r => r.curve), 1e-3);
|
||||
let pl = Polyline.Combine(routes.map(r => r.curve), POLYLINE_JOIN_FUZZ);
|
||||
// for (let i = 0; i < routes.length; i++)
|
||||
// {
|
||||
if (leftCurves.has(routes[0].curve))
|
||||
@@ -35625,6 +35643,7 @@ class RoomRegionParse {
|
||||
}
|
||||
let cons = regionPolylines.map(pl => new ContourTreeNode(Contour.CreateContour(pl, false)));
|
||||
ContourTreeNode.ParseContourTree(cons);
|
||||
let roofs = [];
|
||||
//解析 天花板区域 内空区域
|
||||
for (let con of cons) {
|
||||
let routes = map.get(con.contour.Curve);
|
||||
@@ -35636,7 +35655,9 @@ class RoomRegionParse {
|
||||
else
|
||||
for (let r of routes)
|
||||
r.curve[CURVE_FACE_TYPE_KEY] = WallFaceType.Outside;
|
||||
//未来我们需要返回这个轮廓,以便在ue中可以绘制真正的屋顶
|
||||
//我们需要返回这个轮廓,以便在ue中可以绘制真正的屋顶
|
||||
con.contour.Curve.Z = maxZ;
|
||||
roofs.push(con.contour.Curve);
|
||||
}
|
||||
else if (con.contour.Curve.ColorIndex === 1) //内空区域
|
||||
{
|
||||
@@ -35707,6 +35728,7 @@ class RoomRegionParse {
|
||||
// wall.RightCurves && arrayRemoveDuplicateBySort(wall.RightCurves, (cu1: Curve, cu2: Curve) => cu1.Join(cu2) === Status.True);
|
||||
wall.Update();
|
||||
}
|
||||
return roofs;
|
||||
}
|
||||
End() {
|
||||
if (this._UpdateDb) {
|
||||
@@ -35895,6 +35917,7 @@ class RoomWallParse {
|
||||
RoomWallParse._CacheWallNodePoints = [];
|
||||
RoomWallParse._CacheWallMaps = [];
|
||||
RoomWallParse._CacheCurveWallMaps = new Map();
|
||||
RoomWallParse._CacheRoofs = [];
|
||||
}
|
||||
let regionPrase = new RoomRegionParse(this._UpdateDb);
|
||||
const GroupWalls = (walls, fn) => {
|
||||
@@ -35914,7 +35937,9 @@ class RoomWallParse {
|
||||
let zgroupMap = GroupWalls(walls, w => Math.round(w.Z * 100));
|
||||
for (let [, walls] of zgroupMap) {
|
||||
this.PraseWallsFromSameFloor(walls, changeWalls);
|
||||
regionPrase.Do(walls);
|
||||
let roofs = regionPrase.Do(walls);
|
||||
if (this._IsCacheWallNodePoints)
|
||||
arrayPushArray(RoomWallParse._CacheRoofs, roofs);
|
||||
}
|
||||
regionPrase.End();
|
||||
}
|
||||
@@ -36091,7 +36116,7 @@ class RoomWallParse {
|
||||
else
|
||||
tempC.StartPoint = p;
|
||||
line = new Line(v.position.clone(), p);
|
||||
let ipts = line.IntersectWith(tempC, IntersectOption.OnBothOperands);
|
||||
let ipts = line.IntersectWith(tempC, IntersectOption.ExtendNone);
|
||||
if (ipts.length === 2)
|
||||
p = undefined;
|
||||
}
|
||||
@@ -36103,7 +36128,7 @@ class RoomWallParse {
|
||||
tempC.StartPoint = p;
|
||||
if (!line)
|
||||
line = new Line(v.position.clone(), p);
|
||||
let ipts = line.IntersectWith(tempC, IntersectOption.OnBothOperands);
|
||||
let ipts = line.IntersectWith(tempC, IntersectOption.ExtendNone);
|
||||
if (ipts.length === 2)
|
||||
p = undefined;
|
||||
}
|
||||
@@ -36123,8 +36148,9 @@ class RoomWallParse {
|
||||
nowCurve[SAVE_SP_KEY] = tp;
|
||||
}
|
||||
else {
|
||||
//如果两线平行 无交点时,应该只补厚墙的盖子
|
||||
if (iPts.length === 0) {
|
||||
//如果两线(直线)平行 无交点时,应该只补厚墙的盖子
|
||||
if (code === 1 && iPts.length === 0) //&& false 尽管是false 这里的代码还是成立的 没有禁用这个代码是因为能带来一丢丢性能提升
|
||||
{
|
||||
let w1 = curveWallMap.get(breakData._SplitCurve2OrgCurveMap.get(preR.curve));
|
||||
let w2 = curveWallMap.get(breakData._SplitCurve2OrgCurveMap.get(nowR.curve));
|
||||
let sp = preR.isReverse ? preCurve.EndPoint : preCurve.StartPoint;
|
||||
@@ -36286,6 +36312,7 @@ class RoomWallParse {
|
||||
pts.push(p4, p3);
|
||||
let pl = new Polyline(pts.map(p => { return { pt: AsVector2(p), bul: 0 }; }));
|
||||
pl.CloseMark = true;
|
||||
pl.Z = p1.z;
|
||||
let contour = Contour.CreateContour(pl, false);
|
||||
// let reg = Region.CreateFromCurves([contour.Curve]);
|
||||
// if (reg)
|
||||
@@ -36351,10 +36378,7 @@ class RoomWallParse {
|
||||
else if (type === CurveType.EndLid)
|
||||
dir = getParam.RightDir;
|
||||
if (!dir) {
|
||||
dir = offsetCurve.GetFistDeriv(0).normalize();
|
||||
LEFT_ROTATE_MTX2.applyVector(dir);
|
||||
if (type !== CurveType.Left)
|
||||
dir.negate();
|
||||
dir = offsetCurve.GetFistDeriv(0).normalize().negate();
|
||||
}
|
||||
trim = new CurveTrimLine(offsetCurve, dir);
|
||||
}
|
||||
@@ -36363,7 +36387,7 @@ class RoomWallParse {
|
||||
//需要更快的判断直线会不会被轮廓切割?
|
||||
this.fb.search(trim._Box.min.x - 1e-2, trim._Box.min.y - 1e-2, trim._Box.max.x + 1e-2, trim._Box.max.y + 1e-2, (id => {
|
||||
// if (id !== index) //裁剪的好处是有些细的盖子将会消失
|
||||
trim.TrimBy(trimContours[id], this.boxs[id]);
|
||||
trim.TrimBy(trimContours[id], this.boxs[id], index > id);
|
||||
return false;
|
||||
}));
|
||||
let curves = trim.Curves;
|
||||
@@ -36413,8 +36437,10 @@ class RoomWallParse {
|
||||
return;
|
||||
let fb = new Flatbush(trimContours.length);
|
||||
this.boxs = [];
|
||||
let v = new Vector3(1e-2, 1e-2);
|
||||
for (let con of trimContours) {
|
||||
let box = con.BoundingBox;
|
||||
box.expandByVector(v);
|
||||
fb.add(box.min.x, box.min.y, box.max.x, box.max.y);
|
||||
this.boxs.push(box);
|
||||
}
|
||||
@@ -36425,6 +36451,7 @@ class RoomWallParse {
|
||||
RoomWallParse._CacheWallNodePoints = [];
|
||||
RoomWallParse._CacheWallMaps = [];
|
||||
RoomWallParse._CacheCurveWallMaps = new Map();
|
||||
RoomWallParse._CacheRoofs = [];
|
||||
function UpdateStartEndPoint(curve) {
|
||||
let sp = curve[SAVE_SP_KEY];
|
||||
let ep = curve[SAVE_EP_KEY];
|
||||
@@ -36440,5 +36467,5 @@ function UpdateStartEndPoint(curve) {
|
||||
curve.EndPoint = ep;
|
||||
}
|
||||
|
||||
export { AlignedDimension, AllObjectData, AmbientLight, Arc, ArcDimension, AxisCS, BlockTable, BlockTableRecord, Board, BoxSolid, CADFactory, CADFiler, CURVE_FACE_TYPE_KEY, CURVE_MESH_NAMES, CameraSnapshootRecord, CameraType, CameraUpdate, Circle, CommandHistoryRecord, CompositeEntity, ContourTreeNode, ConverBoardTypeToSpaceType, CreateObjectData, Curve, CurveTapeShape, CylinderHole, Cylineder, Database, DepthType, DiameterDimension, Dimension, DirectionalLight, DisposeTextShapeCache, Ellipse, Entity, EntityColorHistoryRecord, EntityRef, EraseEntityData, ExtendType$1 as ExtendType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeHole, ExtrudeSolid, FaceEntity, Factory, FastDrillingEdgeGeometry, FastDrillingMeshGeometry, FastMeshGeometry, GangDrillType, GetBoxGeoBufferGeometry, Groove, GroupRecord, GroupTable, HardwareCompositeEntity, HardwareTopline, HemisphereLight, HistoricManage, HistorycRecord, Hole, InitClipperCpp, Light, Line, LineAngularDimension, LinearDimension, MaterialTableRecord, MaxDrawGrooveCount, ObjectAllDataHistoryRecord, ObjectCollection, PhysicalMaterialRecord, Point, PointLight, Polyline, Positioning, PositioningBoardSpace, PositioningClampSpace, PositioningTemporary, ProcessingGroupRecord, ProcessingGroupTable, RadiusDimension, RectAreaLight, Region, RemoveObjectData, RenderType, RevolveSolid, RoomBase, RoomFlatBase, RoomFlatFloor, RoomFlatTop, RoomHoleBase, RoomHoleLine, RoomHolePolyline, RoomRegion, RoomWallArc, RoomWallBase, RoomWallLine, RoomWallParse, Shape2, Spline, SpotLight, SubtractRange, SubtractRange2, SweepSolid, SymbolTable, Tape, TempPolyline$1 as TempPolyline, TempateDefaultParamCount, TempateThicknessAction, TemplateAction, TemplateBehindBoard, TemplateBoardRecord, TemplateFilletAction, TemplateLatticeRecord, TemplateLayerBoard, TemplateLeftRightBoardRecord, TemplateMoveAction, TemplateParam, TemplateRecord, TemplateSizeBoard, TemplateStretchGripAction, TemplateStretchScaleBoxAction, TemplateTable, TemplateTopBottomBoard, TemplateVerticalBoard, TemplateVisualSpace, TemplateWineRackRecord, Text, TextAligen, TextureTable, TextureTableRecord, ThicknessDirection, UVType, UpdateHoleFakerWallsAndUpdateDraw, UpdateRelevanceWallHole, UpdateTempPolyline, UpdateWallHolesDataAndUpdateDraw, ViewportEntity, ViewportEntity2, VisualSpaceBox, WallFaceType, applyMixins, boardUVGenerator, boardUVGenerator2, clipperCpp };
|
||||
export { AlignedDimension, AllObjectData, AmbientLight, Arc, ArcDimension, AxisCS, BlockTable, BlockTableRecord, Board, BoxSolid, CADFactory, CADFiler, CURVE_FACE_TYPE_KEY, CURVE_MESH_NAMES, CameraSnapshootRecord, CameraType, CameraUpdate, Circle, CommandHistoryRecord, CompositeEntity, ContourTreeNode, ConverBoardTypeToSpaceType, CreateObjectData, Curve, CurveTapeShape, CylinderHole, Cylineder, Database, DepthType, DiameterDimension, Dimension, DirectionalLight, DisposeTextShapeCache, Ellipse, Entity, EntityColorHistoryRecord, EntityRef, EraseEntityData, ExtendType$1 as ExtendType, ExtrudeBuildConfig, ExtrudeGeometryBuilder, ExtrudeHole, ExtrudeSolid, FaceEntity, Factory, FastDrillingEdgeGeometry, FastDrillingMeshGeometry, FastMeshGeometry, GangDrillType, GetBoxGeoBufferGeometry, Groove, GroupRecord, GroupTable, HardwareCompositeEntity, HardwareTopline, HemisphereLight, HistoricManage, HistorycRecord, Hole, InitClipperCpp, IsPhysical, Light, Line, LineAngularDimension, LinearDimension, MaterialTableRecord, MaxDrawGrooveCount, ObjectAllDataHistoryRecord, ObjectCollection, PhysicalMaterialRecord, Point, PointLight, Polyline, Positioning, PositioningBoardSpace, PositioningClampSpace, PositioningTemporary, ProcessingGroupRecord, ProcessingGroupTable, RadiusDimension, RectAreaLight, Region, RemoveObjectData, RenderType, RevolveSolid, RoomBase, RoomFlatBase, RoomFlatFloor, RoomFlatTop, RoomHoleBase, RoomHoleLine, RoomHolePolyline, RoomRegion, RoomWallArc, RoomWallBase, RoomWallLine, RoomWallParse, Shape2, Spline, SpotLight, SubtractRange, SubtractRange2, SweepSolid, SymbolTable, Tape, TempPolyline$1 as TempPolyline, TempateDefaultParamCount, TempateThicknessAction, TemplateAction, TemplateBehindBoard, TemplateBoardRecord, TemplateFilletAction, TemplateLatticeRecord, TemplateLayerBoard, TemplateLeftRightBoardRecord, TemplateMoveAction, TemplateParam, TemplateRecord, TemplateSizeBoard, TemplateStretchGripAction, TemplateStretchScaleBoxAction, TemplateTable, TemplateTopBottomBoard, TemplateVerticalBoard, TemplateVisualSpace, TemplateWineRackRecord, Text, TextAligen, TextureTable, TextureTableRecord, ThicknessDirection, UVType, UpdateHoleFakerWallsAndUpdateDraw, UpdateRelevanceWallHole, UpdateTempPolyline, UpdateWallHolesDataAndUpdateDraw, ViewportEntity, ViewportEntity2, VisualSpaceBox, WallFaceType, applyMixins, boardUVGenerator, boardUVGenerator2, clipperCpp };
|
||||
//# sourceMappingURL=api.esm.js.map
|
||||
|
Reference in New Issue
Block a user