优化板件夹点拉伸,清理代码

pull/93/MERGE
Zoe 6 years ago
parent eb9b4c16e7
commit 6bb7c1b4dc

@ -11,7 +11,6 @@ import { Entity } from './Entity';
import { Line } from './Line';
import { DbPhysicalMaterial } from './PhysicalMaterial';
import { Shape } from './Shape';
import { app } from '../ApplicationServices/Application';
export enum BoardType
{
@ -173,9 +172,13 @@ export class Board extends Entity
{
return this.m_Name;
}
Explode()
{
return this.m_Shape.Explode().map(cu => cu.ApplyMatrix(this.OCS));
}
GetSnapPoints(): Array<THREE.Vector3>
{
let pts = this.m_Shape.GetSnapPoints();
let pts = this.m_Shape.Outline.Curve.GetSnapPoints();
pts = pts.concat(pts.map(p =>
{
let vec = this.Normal.applyMatrix4(new Matrix4().extractRotation(this.OCSInv)).multiplyScalar(-this.m_Thickness);
@ -197,26 +200,26 @@ export class Board extends Entity
return i;
})
let cur = this.m_Shape.Outline.Curve;
let vl = vec.clone();
vl.applyMatrix4(new Matrix4().extractRotation(this.OCSInv));
let refAxis = new Vector3(1);
let derv = this.m_Shape.Outline.Curve.GetFistDeriv(pts[indexList[0]]);
let derv = cur.GetFistDeriv(pts[indexList[0]]);
if (vl.angleTo(refAxis) < Math.PI / 4 || vl.angleTo(refAxis) > Math.PI * 3 / 4)
vl.setY(0);
else
vl.setX(0);
if (indexList[0] & 1)
if ((indexList[0] & 1) &&
!equaln(vl.angleTo(derv), Math.PI / 2))
{
if (!equaln(vl.angleTo(derv), Math.PI / 2))
{
return;
}
return;
}
this.m_Shape.MoveSnapPoints([indexList[0]], vl);
cur.MoveSnapPoints(indexList.slice(0, indexList.length / 2), vl);
this.Update();
}

@ -413,13 +413,6 @@ export class Polyline extends Curve
return cu.GetFistDeriv(this.GetCurveParamAtParam(param));
}
private copyPolyline(plData: PolylineProps[]): Polyline
{
let pl = this.Clone() as Polyline;
pl.LineData = plData;
return pl;
}
GetSplitCurves(param: number[] | number): Array<Polyline>
{
//参数需要转化为参数数组

@ -4,7 +4,6 @@ import { CADFile } from './CADFile';
import { Contour } from './Contour';
import { Curve } from './Curve';
import { Polyline } from './Polyline';
import { Vector3 } from 'three';
export class Shape
{
@ -49,15 +48,6 @@ export class Shape
this.UpdateShape();
return this.m_Shape;
}
GetSnapPoints(): Array<THREE.Vector3>
{
return this.Outline.Curve.GetSnapPoints();
}
MoveSnapPoints(indexList: Array<number>, vec: Vector3)
{
this.m_Outline.Curve.MoveSnapPoints(indexList, vec);
this.UpdateShape();
}
Explode()
{
let cus: Curve[] = [];

Loading…
Cancel
Save