修正板件因为多段线闭合的问题导致的拉伸夹点(中点)错误

pull/164/head
ChenX 6 years ago
parent a5dcd143df
commit 9c598e56d8

@ -1,7 +1,7 @@
import * as THREE from 'three';
import { ExtrudeGeometry, Matrix4, Mesh, MeshNormalMaterial, Object3D, Vector3 } from 'three';
import { ExtrudeGeometry, Matrix4, Mesh, MeshNormalMaterial, Object3D, Vector2, Vector3 } from 'three';
import { Box3Ext } from '../Geometry/Box';
import { rotatePoint, equaln } from '../Geometry/GeUtils';
import { equaln, rotatePoint } from '../Geometry/GeUtils';
import { RenderType } from '../GraphicsSystem/Enum';
import { BoardProcessOption } from '../UI/Store/BoardInterface';
import { Factory } from './CADFactory';
@ -9,9 +9,9 @@ import { CADFile } from './CADFile';
import { Circle } from './Circle';
import { Contour } from './Contour';
import { Entity } from './Entity';
import { Line } from './Line';
import { ObjectId } from './ObjectId';
import { DbPhysicalMaterial } from './PhysicalMaterial';
import { Polyline } from './Polyline';
import { Shape } from './Shape';
export enum BoardType
@ -76,19 +76,14 @@ export class Board extends Entity
this.m_Width = width;
this.m_Thickness = thickness;
let p1 = new Vector3();
let p2 = new Vector3(width, 0);
let p3 = new Vector3(width, length);
let p4 = new Vector3(0, length);
let l1 = new Line(p1, p2);
let l2 = new Line(p2, p3);
let l3 = new Line(p3, p4);
let l4 = new Line(p4, p1);
this.m_Shape = new Shape(
Contour.CreateContour([l1, l2, l3, l4])
)
let pl = new Polyline([
{ pt: new Vector2(), bul: 0 },
{ pt: new Vector2(width, 0), bul: 0 },
{ pt: new Vector2(width, length), bul: 0 },
{ pt: new Vector2(0, length), bul: 0 },
]);
pl.CloseMark = true;
this.m_Shape = new Shape(Contour.CreateContour([pl]));
}
static CreateBoard(length: number, width: number, thickness: number, boardType: BoardType = BoardType.Layer)
{

@ -17,8 +17,11 @@ export class Contour
let closeCurve = Contour.Combine(cus) as Polyline | Circle;
if (closeCurve && closeCurve.IsClose)
{
if (closeCurve instanceof Polyline)
if (closeCurve instanceof Polyline && closeCurve.CloseMark === false)
{
closeCurve.CloseMark = true;
closeCurve.RemoveVertexAt(closeCurve.NumberOfVertices - 1);
}
let c = new Contour();
c.m_Curve = closeCurve;

Loading…
Cancel
Save