拉伸实体轮廓应用时优化CloseMark

pull/265/MERGE
ChenX 6 years ago
parent c5ebf34824
commit 8fd81e4cfa

@ -1,5 +1,5 @@
import { Box3, ExtrudeGeometry, ExtrudeGeometryOptions, Geometry, LineSegments, Matrix3, Matrix4, Mesh, MeshStandardMaterial, Object3D, Vector3 } from "three";
import { arrayClone, arrayRemoveIf, arraySortByNumber } from "../Common/ArrayExt";
import { arrayClone, arrayLast, arrayRemoveIf, arraySortByNumber } from "../Common/ArrayExt";
import { ColorMaterial } from "../Common/ColorPalette";
import { equalCurve } from "../Common/CurveUtils";
import { DisposeThreeObj } from "../Common/Dispose";
@ -8,7 +8,7 @@ import { ObjectSnapMode } from "../Editor/ObjectSnapMode";
import { boardUVGenerator } from "../Geometry/BoardUVGenerator";
import { BSPGroupParse } from "../Geometry/BSPGroupParse";
import { EdgesGeometry2 } from "../Geometry/EdgeGeometry";
import { cZeroVec, equaln, equalv3, isIntersect, isParallelTo, MoveMatrix } from "../Geometry/GeUtils";
import { cZeroVec, equaln, equalv2, equalv3, isIntersect, isParallelTo, MoveMatrix } from "../Geometry/GeUtils";
import { CSG } from "../Geometry/ThreeCSG";
import { GraphicsConfig } from "../GraphicsSystem/Config";
import { RenderType } from "../GraphicsSystem/RenderType";
@ -240,10 +240,18 @@ export class ExtureSolid extends Entity
*/
SetContourCurve(curve: ExtureContourCurve)
{
if (!curve.IsClose) return;
if (curve instanceof Polyline)
{
curve.CloseMark = true;
let pts = curve.LineData;
if (equalv2(pts[0].pt, arrayLast(pts).pt))
pts.pop();
}
this.WriteAllObjectRecord();
this.contourCurve = curve;
if (this.contourCurve instanceof Polyline)
this.contourCurve.CloseMark = true;
this.CheckContourCurve();
this.Update();
}

Loading…
Cancel
Save