diff --git a/__test__/Geometry/ellipse.test.ts b/__test__/Geometry/ellipse.test.ts index 93d65c0dd..33cf03120 100644 --- a/__test__/Geometry/ellipse.test.ts +++ b/__test__/Geometry/ellipse.test.ts @@ -60,14 +60,14 @@ describe('完整椭圆', () => }); test("GetFistDeriv", () => { - expect(equalv3(el.GetFistDeriv(0), new Vector3(0, 1))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.5), new Vector3(0, -1))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.25), new Vector3(-1))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.75), new Vector3(1))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.1), new Vector3(-1, 0.5505527681884694))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.3), new Vector3(-1, -0.1299678784931625))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.6), new Vector3(1, -0.5505527681884692))).toBeTruthy(); - expect(equalv3(el.GetFistDeriv(0.8), new Vector3(1, 0.12996787849316255))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0), new Vector3(0, 1))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.5), new Vector3(0, -1))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.25), new Vector3(-1))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.75), new Vector3(1))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.1), new Vector3(-1, 0.5505527681884694))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.3), new Vector3(-1, -0.1299678784931625))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.6), new Vector3(1, -0.5505527681884692))).toBeTruthy(); + expect(equalv3(el.GetFirstDeriv(0.8), new Vector3(1, 0.12996787849316255))).toBeTruthy(); }); test("GetClosestPointTo", () => { @@ -244,14 +244,14 @@ describe("非完整椭圆", () => let data = { "file": [1, "Ellipse", 3, 2, 131, false, 1, 7, 0, [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 2910.330625096328, 62.245373351688414, 0, 1], 1, 418.15520838547974, 225.54490978414745, -0.69713252541264, 3.934994981148553, 1.3332220725861395], "basePt": { "x": 3893.631897322025, "y": -235.90267753572692, "z": 0 } }; let el = LoadCurvesFromFileData(data)[0] as Ellipse; - let derv = el.GetFistDeriv(p); + let derv = el.GetFirstDeriv(p); expect(derv.x < 0).toBeTruthy(); expect(derv.y > 0).toBeTruthy(); - derv = el.GetFistDeriv(0.2); + derv = el.GetFirstDeriv(0.2); expect(derv.x > 0).toBeTruthy(); expect(derv.y < 0).toBeTruthy(); - derv = el.GetFistDeriv(0.5); + derv = el.GetFirstDeriv(0.5); expect(derv.x > 0).toBeTruthy(); expect(derv.y > 0).toBeTruthy(); diff --git a/__test__/Polyline/PolylineGetPointAtParam.test.ts b/__test__/Polyline/PolylineGetPointAtParam.test.ts index 6fde181c4..a37e2ae8b 100644 --- a/__test__/Polyline/PolylineGetPointAtParam.test.ts +++ b/__test__/Polyline/PolylineGetPointAtParam.test.ts @@ -52,7 +52,7 @@ test('获得点,来自参数', () => } } //测试一阶导数 - let deriv = pl.GetFistDeriv(p); + let deriv = pl.GetFirstDeriv(p); expect(deriv).toMatchSnapshot(); expect(pt).toMatchSnapshot(); } @@ -78,7 +78,7 @@ test('获得点,来自参数', () => } //测试一阶导数 - let deriv = pl.GetFistDeriv(p); + let deriv = pl.GetFirstDeriv(p); expect(deriv).toMatchSnapshot(); expect(pt).toMatchSnapshot(); } diff --git a/__test__/Room/RoomParse.test.ts b/__test__/Room/RoomParse.test.ts index ed007b6a4..e38dd8ed0 100644 --- a/__test__/Room/RoomParse.test.ts +++ b/__test__/Room/RoomParse.test.ts @@ -20,7 +20,7 @@ function TestLidDir(w: RoomWallBase) { for (let lid of w.LidCurves) { - let derv = lid.GetFistDeriv(0); + let derv = lid.GetFirstDeriv(0); expect(derv.toArray()).toMatchSnapshot(); } } @@ -70,7 +70,7 @@ test('共线墙盖子方向正确性', () => function TestCurveDerv(c: Curve) { - let derv = c.GetFistDeriv(0); + let derv = c.GetFirstDeriv(0); expect(derv.toArray()).toMatchSnapshot(); } function TestWallCurveParse(walls: RoomWallBase[]) diff --git a/src/Add-on/BoardEditor/Board2Regions.ts b/src/Add-on/BoardEditor/Board2Regions.ts index fec5d554e..e80618529 100644 --- a/src/Add-on/BoardEditor/Board2Regions.ts +++ b/src/Add-on/BoardEditor/Board2Regions.ts @@ -39,7 +39,7 @@ export function Board2Regions(br: Board): Region[] if (!reg) continue; let p = l.StartPoint.applyMatrix4(ocs); - let x = l.GetFistDeriv(0).transformDirection(ocs); + let x = l.GetFirstDeriv(0).transformDirection(ocs); let y = br.Normal; let z = new Vector3().crossVectors(x, y); diff --git a/src/Add-on/CommandFeeding.ts b/src/Add-on/CommandFeeding.ts index 420d14838..e31f194f9 100644 --- a/src/Add-on/CommandFeeding.ts +++ b/src/Add-on/CommandFeeding.ts @@ -88,7 +88,7 @@ export class FeedingCommand implements Command //写出封边文字 for (let i = 0; i < info.sealing.length; i++) { - let der = originContour.GetFistDeriv(i + 0.5); + let der = originContour.GetFirstDeriv(i + 0.5); rotatePoint(der, Math.PI / 2).normalize().multiplyScalar(-35); let pos = originContour.GetPointAtParam(i + 0.5).add(der); let text = new Text(pos, info.sealing[i].size.toString()); diff --git a/src/Add-on/DrawDim/DimBoards.ts b/src/Add-on/DrawDim/DimBoards.ts index 88d214f4b..affcff43b 100644 --- a/src/Add-on/DrawDim/DimBoards.ts +++ b/src/Add-on/DrawDim/DimBoards.ts @@ -245,7 +245,7 @@ export class DimBoards let dir = Math.sign(pl.Area2); for (let c of pl.Explode()) { - let derv = c.GetFistDeriv(0).multiplyScalar(dir); + let derv = c.GetFirstDeriv(0).multiplyScalar(dir); if (Math.abs(derv.x) > Math.abs(derv.y)) { @@ -279,7 +279,7 @@ export class DimBoards let dirBrs: Board[] = [];//该方向上有交集的板 for (let c of cus) { - let _x = c.GetFistDeriv(0).normalize(); + let _x = c.GetFirstDeriv(0).normalize(); let _z = ZAxis; let _y = new Vector3().crossVectors(_z, _x); let ocs = new Matrix4().makeBasis(_x, _y, _z).setPosition(c.StartPoint.setZ(-5000)) @@ -405,7 +405,7 @@ export class DimBoards { if (cu instanceof Arc) continue; - let derv = cu.GetFistDeriv(0).normalize(); + let derv = cu.GetFirstDeriv(0).normalize(); if (equaln(derv.x, 1))//down { diff --git a/src/Add-on/DrawDim/Draw2LineAngularDim.ts b/src/Add-on/DrawDim/Draw2LineAngularDim.ts index 85b92ab9d..2d104abe9 100644 --- a/src/Add-on/DrawDim/Draw2LineAngularDim.ts +++ b/src/Add-on/DrawDim/Draw2LineAngularDim.ts @@ -127,8 +127,8 @@ export class Command_Draw2LineAngularDim private async BuildDim(l1: Line, l2: Line, dimPt: Vector3) { //ocs - let derv1 = l1.GetFistDeriv(0).normalize(); - let derv2 = l2.GetFistDeriv(0).normalize(); + let derv1 = l1.GetFirstDeriv(0).normalize(); + let derv2 = l2.GetFirstDeriv(0).normalize(); if (isParallelTo(derv1, derv2)) { app.Editor.Prompt("两直线平行!", LogType.Error, [l1, l2]); diff --git a/src/Add-on/DrawDrilling/HoleUtils.ts b/src/Add-on/DrawDrilling/HoleUtils.ts index 7135f4f14..d8857d46e 100644 --- a/src/Add-on/DrawDrilling/HoleUtils.ts +++ b/src/Add-on/DrawDrilling/HoleUtils.ts @@ -167,7 +167,7 @@ export function ParseBoardRectHoleType(br: Board, outBrRectHoleType: IBoardRectH for (let i = 0; i < cus.length; i++) { let c = cus[i]; - let derv = c.GetFistDeriv(0).multiplyScalar(dir); + let derv = c.GetFirstDeriv(0).multiplyScalar(dir); if (Math.abs(derv.x) > Math.abs(derv.y)) { @@ -217,7 +217,7 @@ export function SetBrHighHoleTypeFromRectHoleType(br: Board, brRectHoleType: IBo for (let i = 0; i < cus.length; i++) { let c = cus[i]; - let derv = c.GetFistDeriv(0).multiplyScalar(dir); + let derv = c.GetFirstDeriv(0).multiplyScalar(dir); if (Math.abs(derv.x) > Math.abs(derv.y)) { diff --git a/src/Add-on/DrawPolyline.ts b/src/Add-on/DrawPolyline.ts index 738336b9b..f2de73d76 100644 --- a/src/Add-on/DrawPolyline.ts +++ b/src/Add-on/DrawPolyline.ts @@ -158,7 +158,7 @@ export class DrawPolyline //切线 let tangent: Vector3; if (ptCount > 2) - tangent = pl.GetCurveAtIndex(ptCount - 3).GetFistDeriv(1).applyMatrix4(plOcsInv); + tangent = pl.GetCurveAtIndex(ptCount - 3).GetFirstDeriv(1).applyMatrix4(plOcsInv); else tangent = XAxis; diff --git a/src/Add-on/DrawRevolve.ts b/src/Add-on/DrawRevolve.ts index d3e3920ef..c6ac155d0 100644 --- a/src/Add-on/DrawRevolve.ts +++ b/src/Add-on/DrawRevolve.ts @@ -37,7 +37,7 @@ export class Command_DrawRevolve implements Command if (enRes.Status !== PromptStatus.OK) return; let axis = enRes.Entity as Line; let rs = new RevolveSolid( - axis.GetFistDeriv(0).normalize(), + axis.GetFirstDeriv(0).normalize(), axis.StartPoint, pl, 0, 0 diff --git a/src/Add-on/FilletUtils.ts b/src/Add-on/FilletUtils.ts index 43723cbdd..f2f5a2be0 100644 --- a/src/Add-on/FilletUtils.ts +++ b/src/Add-on/FilletUtils.ts @@ -9,7 +9,7 @@ import { Line } from "../DatabaseServices/Entity/Line"; import { Polyline } from "../DatabaseServices/Entity/Polyline"; import { Spline } from "../DatabaseServices/Spline"; import { PromptEntityResult, PromptPointResult } from "../Editor/PromptResult"; -import { angle, AsVector2, equaln, equalv3, isIntersect2, isParallelTo, midPoint } from "../Geometry/GeUtils"; +import { AsVector2, angle, equaln, equalv3, isIntersect2, isParallelTo, midPoint } from "../Geometry/GeUtils"; import { Orbit } from "../Geometry/Orbit"; import { IntersectOption } from "../GraphicsSystem/IntersectWith"; @@ -223,7 +223,7 @@ export class FilletUtils let c1 = pl.GetCurveAtParam(param1); let c2 = pl.GetCurveAtParam(param2); - if (equalv3(c1.GetFistDeriv(1).normalize(), c2.GetFistDeriv(0).normalize())) + if (equalv3(c1.GetFirstDeriv(1).normalize(), c2.GetFirstDeriv(0).normalize())) return; let es1 = new PromptEntityResult(); @@ -463,7 +463,7 @@ export class FilletUtils if (!c2) break; - if (equalv3(c1.GetFistDeriv(1).normalize(), c2.GetFistDeriv(0).normalize())) + if (equalv3(c1.GetFirstDeriv(1).normalize(), c2.GetFirstDeriv(0).normalize())) continue; let es1 = new PromptEntityResult(); @@ -557,8 +557,8 @@ export class FilletUtils let l1 = enRes1.Entity as Line; let l2 = enRes2.Entity as Line; - let l1Derv = l1.GetFistDeriv(0); - if (!isParallelTo(l1Derv, l2.GetFistDeriv(0))) + let l1Derv = l1.GetFirstDeriv(0); + if (!isParallelTo(l1Derv, l2.GetFirstDeriv(0))) return; let vec = l2.StartPoint.sub(l1.StartPoint); @@ -686,11 +686,11 @@ export class FilletUtils let a1Param = a1.GetParamAtPoint(narcP1); let a2Param = a2.GetParamAtPoint(narcP2); - let a1Derv = a1.GetFistDeriv(a1Param).normalize(); - let a2Derv = a2.GetFistDeriv(a2Param).normalize(); + let a1Derv = a1.GetFirstDeriv(a1Param).normalize(); + let a2Derv = a2.GetFirstDeriv(a2Param).normalize(); - let narcDerv0 = narc.GetFistDeriv(0).normalize(); - let narcDerv1 = narc.GetFistDeriv(1).normalize(); + let narcDerv0 = narc.GetFirstDeriv(0).normalize(); + let narcDerv1 = narc.GetFirstDeriv(1).normalize(); //裁剪圆弧 if (equalv3(a1Derv, narcDerv0)) @@ -779,8 +779,8 @@ export class FilletUtils //裁剪圆弧 let arcParam = arc.GetParamAtPoint(arcP2); - let arcDerv = arc.GetFistDeriv(arcParam).normalize(); - let narcDerv = narc.GetFistDeriv(1).normalize(); + let arcDerv = arc.GetFirstDeriv(arcParam).normalize(); + let narcDerv = narc.GetFirstDeriv(1).normalize(); let arcExtend: ExtendType; if (equalv3(arcDerv, narcDerv)) @@ -852,12 +852,12 @@ export class FilletUtils let cu = cuRes.Curve; if (cuRes.ExtType === ExtendType.Start) { - derv = cu.GetFistDeriv(0).normalize(); + derv = cu.GetFirstDeriv(0).normalize(); dervSum.add(derv); } else { - derv = cu.GetFistDeriv(cu.EndParam).normalize(); + derv = cu.GetFirstDeriv(cu.EndParam).normalize(); dervSum.add(derv.clone().negate()); } return derv; diff --git a/src/Add-on/LatticeDrawer/LatticeDrawerTool.ts b/src/Add-on/LatticeDrawer/LatticeDrawerTool.ts index 0406a63cd..b28a49fea 100644 --- a/src/Add-on/LatticeDrawer/LatticeDrawerTool.ts +++ b/src/Add-on/LatticeDrawer/LatticeDrawerTool.ts @@ -7,7 +7,7 @@ import { Arc } from "../../DatabaseServices/Entity/Arc"; import { Board } from "../../DatabaseServices/Entity/Board"; import { BoardType } from "../../DatabaseServices/Entity/BoardInterface"; import { Polyline } from "../../DatabaseServices/Entity/Polyline"; -import { AsVector2, equalv3, isParallelTo, XAxis, YAxis } from "../../Geometry/GeUtils"; +import { AsVector2, XAxis, YAxis, equalv3, isParallelTo } from "../../Geometry/GeUtils"; import { ISpaceParse } from "../../Geometry/SpaceParse/ISpaceParse"; import { ELatticeArrayType, ILatticeOption } from "../../UI/Store/LatticeInterface"; import { IHighSealedItem } from "../../UI/Store/OptionInterface/IHighSealedItem"; @@ -336,7 +336,7 @@ export class DrawLatticeDrawerTool extends Singleton let c = cu.GetCurveAtIndex(i); if (c instanceof Arc) break; - let derv = c.GetFistDeriv(0).normalize(); + let derv = c.GetFirstDeriv(0).normalize(); if (equalv3(derv, YAxis)) highSeals.push(rigthSeal); else if (isParallelTo(derv, XAxis)) diff --git a/src/Add-on/Offset.ts b/src/Add-on/Offset.ts index ce96a64d9..f9c3093bf 100644 --- a/src/Add-on/Offset.ts +++ b/src/Add-on/Offset.ts @@ -79,7 +79,7 @@ export class Command_Offset implements Command let cu = enRes.Entity as Curve; if (cu instanceof Line || cu.constructor.name === "RoomWallLine") { - if (isParallelTo(cu.GetFistDeriv(0), cu.Normal)) + if (isParallelTo(cu.GetFirstDeriv(0), cu.Normal)) { let nor = new Vector3().setFromMatrixColumn(oldUCS, 2); if (isParallelTo(nor, cu.Normal)) diff --git a/src/Add-on/Room/DrawWall.ts b/src/Add-on/Room/DrawWall.ts index da81f9f81..427d9ddcc 100644 --- a/src/Add-on/Room/DrawWall.ts +++ b/src/Add-on/Room/DrawWall.ts @@ -493,7 +493,7 @@ export class Command_DrawWallInside implements Command //切线 let tangent: Vector3; if (ptCount > 2) - tangent = pl.GetCurveAtIndex(ptCount - 3).GetFistDeriv(1).applyMatrix4(plOcsInv); + tangent = pl.GetCurveAtIndex(ptCount - 3).GetFirstDeriv(1).applyMatrix4(plOcsInv); else tangent = new Vector3(1, 0, 0); diff --git a/src/Add-on/closetest.ts b/src/Add-on/closetest.ts index b81c34487..1f6aecbfb 100644 --- a/src/Add-on/closetest.ts +++ b/src/Add-on/closetest.ts @@ -45,7 +45,7 @@ export class Command_ClosePt implements Command line.EndPoint = cu.GetClosestPointTo(p, extend); derLine.StartPoint = line.EndPoint; - derLine.EndPoint = line.EndPoint.add(cu.GetFistDeriv(line.EndPoint).multiplyScalar(100)); + derLine.EndPoint = line.EndPoint.add(cu.GetFirstDeriv(line.EndPoint).multiplyScalar(100)); closeCir.Visible = false; if (cu instanceof Arc) diff --git a/src/Add-on/polytest.ts b/src/Add-on/polytest.ts index 2cc63deca..f1dd925c8 100644 --- a/src/Add-on/polytest.ts +++ b/src/Add-on/polytest.ts @@ -4,11 +4,11 @@ import { app } from '../ApplicationServices/Application'; import { Circle } from '../DatabaseServices/Entity/Circle'; import { ExtendType } from '../DatabaseServices/Entity/Curve'; import { Line } from '../DatabaseServices/Entity/Line'; +import { Point } from '../DatabaseServices/Entity/Point'; import { Polyline } from '../DatabaseServices/Entity/Polyline'; import { Command } from '../Editor/CommandMachine'; import { polar } from '../Geometry/GeUtils'; import { IntersectOption } from '../GraphicsSystem/IntersectWith'; -import { Point } from '../DatabaseServices/Entity/Point'; export class Command_PLTest implements Command @@ -244,7 +244,7 @@ export class Command_PLTest implements Command let c = 0; - let v = pl.GetFistDeriv(7); + let v = pl.GetFirstDeriv(7); console.log(v); @@ -265,7 +265,7 @@ export class Command_PLTest implements Command c++; cir.ColorIndex = c % 7 + 1; app.Database.ModelSpace.Append(cir); - let d = pl.GetFistDeriv(p); + let d = pl.GetFirstDeriv(p); let line = new Line(pt, pt.clone().add(d)); diff --git a/src/Add-on/twoD2threeD/Polyline2Board.ts b/src/Add-on/twoD2threeD/Polyline2Board.ts index 456d3a7ff..6a6f6d7c2 100644 --- a/src/Add-on/twoD2threeD/Polyline2Board.ts +++ b/src/Add-on/twoD2threeD/Polyline2Board.ts @@ -922,7 +922,7 @@ export class Polyline2Board implements Command */ private ParsePolyline(pl: Polyline) { - let firstDev = pl.GetFistDeriv(0).normalize(); + let firstDev = pl.GetFirstDeriv(0).normalize(); let size: Vector3; let box: Box3; pl.TempData = undefined;//clear(保证这个临时数据是纯粹的) diff --git a/src/Add-on/twoD2threeD/Rect2Board.ts b/src/Add-on/twoD2threeD/Rect2Board.ts index e22780f3e..4cd5ecb8b 100644 --- a/src/Add-on/twoD2threeD/Rect2Board.ts +++ b/src/Add-on/twoD2threeD/Rect2Board.ts @@ -126,7 +126,7 @@ class Rect2BoardTool2 */ private ParsePolyline(pl: Polyline) { - let firstDev = pl.GetFistDeriv(0).normalize(); + let firstDev = pl.GetFirstDeriv(0).normalize(); let size: Vector3; let box: Box3; pl.TempData = undefined;//清理数据 保证这个数据纯粹(RectInfo) diff --git a/src/Common/CurveUtils.ts b/src/Common/CurveUtils.ts index dab5c3267..ea07b6a75 100644 --- a/src/Common/CurveUtils.ts +++ b/src/Common/CurveUtils.ts @@ -286,7 +286,7 @@ export function GetPointAtCurveDir(cu: Curve, pt: Vector3): number let cp = cu.GetClosestPointTo(pt, false); if (equalv3(cp, pt, 1e-6)) return 0; //最近点的切线 - let deriv = cu.GetFistDeriv(cu.GetParamAtPoint(cp)); + let deriv = cu.GetFirstDeriv(cu.GetParamAtPoint(cp)); let vec2 = pt.clone().sub(cp); let cross = deriv.cross(vec2).applyMatrix4(cu.OCSInv.setPosition(0, 0, 0)); return -Math.sign(cross.z); @@ -415,7 +415,7 @@ export function CircleOuterTangentLines(circle0: Circle, circle1: Circle): Line[ else if (equaln(circle0.Radius, circle1.Radius)) { let cp = circle0.GetClosestPointTo(c1, true); - let derv = circle0.GetFistDeriv(cp).multiplyScalar(circle0.Radius); + let derv = circle0.GetFirstDeriv(cp).multiplyScalar(circle0.Radius); let dervn = derv.clone().negate(); let c0p0 = c0.clone().add(derv); @@ -711,7 +711,7 @@ export function ComputerCurvesNormalOCS(curves: Curve[], allowAutoCalc: boolean } else if (firstV) { - let v = c.GetFistDeriv(0); + let v = c.GetFirstDeriv(0); if (IsNorZeroVector(v)) { v.normalize().cross(firstV); @@ -728,7 +728,7 @@ export function ComputerCurvesNormalOCS(curves: Curve[], allowAutoCalc: boolean let ocs = ComputerCurvesNormalOCS(cus, false); if (ocs) return ocs; - let fv = c.GetFistDeriv(0); + let fv = c.GetFirstDeriv(0); if (IsNorZeroVector(fv))//先判断零向量 firstV = fv.normalize();//再归一化 } @@ -797,7 +797,7 @@ export function PolylineSpliteRect(outline: Polyline): Polyline[] if (!outline.IsClose || IsRect(outline)) return [outline]; - let firstDerv = outline.GetFistDeriv(0).normalize(); + let firstDerv = outline.GetFirstDeriv(0).normalize(); if (!isParallelTo(firstDerv, XAxis, PolylineSpliteRectFuzz) && !isParallelTo(firstDerv, YAxis, PolylineSpliteRectFuzz)) return [outline]; @@ -807,7 +807,7 @@ export function PolylineSpliteRect(outline: Polyline): Polyline[] for (let c of cus) { if (c instanceof Arc) return [outline]; - let derv = c.GetFistDeriv(0).normalize(); + let derv = c.GetFirstDeriv(0).normalize(); if (isParallelTo(derv, YAxis, PolylineSpliteRectFuzz)) yCus.push(c); else @@ -856,7 +856,7 @@ export function PolylineSpliteRect(outline: Polyline): Polyline[] for (let par of pars) { let c = outline.GetCurveAtParam(par); - let derv = c.GetFistDeriv(0).normalize(); + let derv = c.GetFirstDeriv(0).normalize(); if (isParallelTo(derv, XAxis, PolylineSpliteRectFuzz)) { let x3 = c.StartPoint.x; diff --git a/src/DatabaseServices/3DSolid/ExtrudeHole.ts b/src/DatabaseServices/3DSolid/ExtrudeHole.ts index d46c0bc0c..cbb73aa7d 100644 --- a/src/DatabaseServices/3DSolid/ExtrudeHole.ts +++ b/src/DatabaseServices/3DSolid/ExtrudeHole.ts @@ -320,7 +320,7 @@ export class ExtrudeHole extends Hole let param = indexList[0] / 2; if (this.ContourCurve.GetBulgeAt(Math.floor(param)) === 0) { - let der = this.ContourCurve.GetFistDeriv(param).normalize(); + let der = this.ContourCurve.GetFirstDeriv(param).normalize(); [der.x, der.y] = [der.y, -der.x]; let d = localVec.dot(der); localVec.copy(der).multiplyScalar(d); diff --git a/src/DatabaseServices/3DSolid/SweepSolid.ts b/src/DatabaseServices/3DSolid/SweepSolid.ts index 53838da3c..cc9c67914 100644 --- a/src/DatabaseServices/3DSolid/SweepSolid.ts +++ b/src/DatabaseServices/3DSolid/SweepSolid.ts @@ -107,7 +107,7 @@ export class SweepSolid extends Entity if (equalv3(this._Contour.Normal, ZAxis)) return; - let fDir = this._PathCurve.GetFistDeriv(0); + let fDir = this._PathCurve.GetFirstDeriv(0); if (isParallelTo(fDir, this._Contour.Normal)) { //构建回家的矩阵 @@ -133,7 +133,7 @@ export class SweepSolid extends Entity this._Contour.ApplyMatrix(toWcsMat4Inv); } - let lDir = this._PathCurve.GetFistDeriv(this._PathCurve.EndParam); + let lDir = this._PathCurve.GetFirstDeriv(this._PathCurve.EndParam); if (isParallelTo(lDir, this._Contour.Normal)) { //再次构建回家的矩阵 @@ -574,7 +574,7 @@ export class SweepSolid extends Entity for (let i = 0.5; i < path.EndParam; i++) { let pos = path.GetPointAtParam(i); - let dir = path.GetFistDeriv(i).normalize(); + let dir = path.GetFirstDeriv(i).normalize(); let y = path.Normal; let roMat = new Matrix4().extractRotation(this.OCS); let z = dir.applyMatrix4(roMat); diff --git a/src/DatabaseServices/Contour.ts b/src/DatabaseServices/Contour.ts index 55f948ada..18ee846e3 100644 --- a/src/DatabaseServices/Contour.ts +++ b/src/DatabaseServices/Contour.ts @@ -283,7 +283,7 @@ export class Contour { //方向相同 if ( - equalv3(cu.GetFistDeriv(cu.EndParam * 0.5).normalize(), pl.GetFistDeriv(pl.EndParam * 0.5).normalize(), 1e-3) + equalv3(cu.GetFirstDeriv(cu.EndParam * 0.5).normalize(), pl.GetFirstDeriv(pl.EndParam * 0.5).normalize(), 1e-3) === isEqualNormal ) { @@ -350,14 +350,14 @@ export class Contour for (let pl of sourceCus) { let plMidParam = pl.MidParam; - let plDir = pl.GetFistDeriv(plMidParam).normalize(); + let plDir = pl.GetFirstDeriv(plMidParam).normalize(); let index = targetCus.findIndex(cu => fastEqualCurve(cu, pl)); if (index !== -1) { let cu = targetCus[index]; let cuMidParam = cu.MidParam; - let cuDir = cu.GetFistDeriv(cuMidParam).normalize(); + let cuDir = cu.GetFirstDeriv(cuMidParam).normalize(); if (isEqualNormal === !equalv3(cuDir, plDir, 1e-3))//不同向 subtractList.push(pl); @@ -476,14 +476,14 @@ export class Contour for (let sourceSplitcu of sourceSplitCurves) { - let sourceDir = sourceSplitcu.GetFistDeriv(sourceSplitcu.MidParam).normalize(); + let sourceDir = sourceSplitcu.GetFirstDeriv(sourceSplitcu.MidParam).normalize(); let index = targetSplitCurves.findIndex(cu => fastEqualCurve(cu, sourceSplitcu, 0.05)); if (index !== -1) { let targetSplitcu = targetSplitCurves[index]; let isEqualNormal = equalv3(sourceOutline.Normal, targetSplitCurve_CurvesMap.get(targetSplitcu).Normal, 1e-3); - let targetDir = targetSplitcu.GetFistDeriv(targetSplitcu.MidParam).normalize(); + let targetDir = targetSplitcu.GetFirstDeriv(targetSplitcu.MidParam).normalize(); if (isEqualNormal === !equalv3(targetDir, sourceDir, 1e-3))//不同向 subtractList.push(sourceSplitcu); diff --git a/src/DatabaseServices/Entity/Arc.ts b/src/DatabaseServices/Entity/Arc.ts index 09888f036..734123c41 100644 --- a/src/DatabaseServices/Entity/Arc.ts +++ b/src/DatabaseServices/Entity/Arc.ts @@ -1,10 +1,10 @@ import { Box3, Matrix3, Matrix4, Vector2, Vector3 } from 'three'; -import { getArcOrCirNearPts, getCircleCenter, GetTanPtsOnArcOrCircle } from '../../Common/CurveUtils'; -import { reviseMirrorMatrix, SetMtxVector, TransformVector } from '../../Common/Matrix4Utils'; +import { GetTanPtsOnArcOrCircle, getArcOrCirNearPts, getCircleCenter } from '../../Common/CurveUtils'; +import { SetMtxVector, TransformVector, reviseMirrorMatrix } from '../../Common/Matrix4Utils'; import { Status } from '../../Common/Status'; import { ObjectSnapMode } from '../../Editor/ObjectSnapMode'; import { Box3Ext } from '../../Geometry/Box'; -import { angle, AsVector3, clampRad, equaln, equalv2, equalv3, MoveMatrix, polar, ZeroVec } from '../../Geometry/GeUtils'; +import { AsVector3, MoveMatrix, ZeroVec, angle, clampRad, equaln, equalv2, equalv3, polar } from '../../Geometry/GeUtils'; import { Orbit } from '../../Geometry/Orbit'; import { IntersectArcAndArc, IntersectCircleAndArc, IntersectEllipseAndCircleOrArc, IntersectLineAndArc, IntersectOption, IntersectPolylineAndCurve, IntersectResult, reverseIntersectOption } from '../../GraphicsSystem/IntersectWith'; import { Factory } from '../CADFactory'; @@ -761,7 +761,7 @@ export class Arc extends Curve { return d / this.Length; } - GetFistDeriv(pt: number | Vector3) + GetFirstDeriv(pt: number | Vector3) { let an: number; if (typeof pt === "number") diff --git a/src/DatabaseServices/Entity/Circle.ts b/src/DatabaseServices/Entity/Circle.ts index f4f62b209..0ecd4d105 100644 --- a/src/DatabaseServices/Entity/Circle.ts +++ b/src/DatabaseServices/Entity/Circle.ts @@ -1,15 +1,15 @@ -import { BufferGeometry, EllipseCurve, Line as TLine, Material, Matrix3, Matrix4, Object3D, Vector3 } from 'three'; +import { BufferGeometry, EllipseCurve, Material, Matrix3, Matrix4, Object3D, Line as TLine, Vector3 } from 'three'; import { Line2 } from 'three/examples/jsm/lines/Line2'; import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry'; import { arrayLast, arrayRemoveDuplicateBySort } from '../../Common/ArrayExt'; import { ColorMaterial } from '../../Common/ColorPalette'; -import { getArcOrCirNearPts, GetTanPtsOnArcOrCircle } from '../../Common/CurveUtils'; +import { GetTanPtsOnArcOrCircle, getArcOrCirNearPts } from '../../Common/CurveUtils'; import { reviseMirrorMatrix } from '../../Common/Matrix4Utils'; import { clamp } from '../../Common/Utils'; import { ObjectSnapMode } from '../../Editor/ObjectSnapMode'; import { Box3Ext } from '../../Geometry/Box'; import { BufferGeometryUtils } from '../../Geometry/BufferGeometryUtils'; -import { angle, AsVector3, equaln, equalv2, MoveMatrix, polar, ZeroVec } from '../../Geometry/GeUtils'; +import { AsVector3, MoveMatrix, ZeroVec, angle, equaln, equalv2, polar } from '../../Geometry/GeUtils'; import { Orbit } from '../../Geometry/Orbit'; import { IntersectCircleAndArc, IntersectCircleAndCircle, IntersectEllipseAndCircleOrArc, IntersectLineAndCircle, IntersectOption, IntersectPolylineAndCurve, IntersectResult, reverseIntersectOption } from '../../GraphicsSystem/IntersectWith'; import { RenderType } from '../../GraphicsSystem/RenderType'; @@ -391,7 +391,7 @@ export class Circle extends Curve this.ApplyMatrix(mat); } } - GetFistDeriv(pt: number | Vector3) + GetFirstDeriv(pt: number | Vector3) { if (typeof pt === "number") pt = this.GetPointAtParam(pt); diff --git a/src/DatabaseServices/Entity/Curve.ts b/src/DatabaseServices/Entity/Curve.ts index c5791e817..56897f701 100644 --- a/src/DatabaseServices/Entity/Curve.ts +++ b/src/DatabaseServices/Entity/Curve.ts @@ -1,4 +1,4 @@ -import { BufferGeometry, Curve as TCurve, Line, Line as TLine, Material, Object3D, Vector3 } from 'three'; +import { BufferGeometry, Line, Material, Object3D, Curve as TCurve, Line as TLine, Vector3 } from 'three'; import { Line2 } from 'three/examples/jsm/lines/Line2'; import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry'; import { arrayRemoveDuplicateBySort, arraySortByNumber } from '../../Common/ArrayExt'; @@ -94,10 +94,10 @@ export abstract class Curve extends Entity * 返回曲线在指定位置的一阶导数(在wcs内) * @param {(number | Vector3)} param */ - GetFistDeriv(param: number | Vector3): Vector3 { return; } + GetFirstDeriv(param: number | Vector3): Vector3 { return; } GetFistDerivAngle(param: number | Vector3): number { - let d = this.GetFistDeriv(param); + let d = this.GetFirstDeriv(param); return Math.atan2(d.y, d.x); } diff --git a/src/DatabaseServices/Entity/Ellipse.ts b/src/DatabaseServices/Entity/Ellipse.ts index 028483ff1..4c7d88d80 100644 --- a/src/DatabaseServices/Entity/Ellipse.ts +++ b/src/DatabaseServices/Entity/Ellipse.ts @@ -1,9 +1,9 @@ import { MathUtils, Matrix3, Matrix4, Shape, Vector3 } from 'three'; import { arrayLast, arrayRemoveDuplicateBySort } from '../../Common/ArrayExt'; -import { getArcOrCirNearPts, getDeterminantFor2V, getTanPtsOnEllipse, Pts2Polyline } from '../../Common/CurveUtils'; +import { Pts2Polyline, getArcOrCirNearPts, getDeterminantFor2V, getTanPtsOnEllipse } from '../../Common/CurveUtils'; import { Status } from '../../Common/Status'; import { ObjectSnapMode } from '../../Editor/ObjectSnapMode'; -import { angle, angleTo, AsVector2, equaln, equalv3, MoveMatrix, rotatePoint } from '../../Geometry/GeUtils'; +import { AsVector2, MoveMatrix, angle, angleTo, equaln, equalv3, rotatePoint } from '../../Geometry/GeUtils'; import { Matrix2 } from '../../Geometry/Matrix2'; import { IntersectEllipse, IntersectEllipseAndCircleOrArc, IntersectEllipseAndLine, IntersectOption, IntersectPolylineAndCurve, reverseIntersectOption } from '../../GraphicsSystem/IntersectWith'; import { Factory } from '../CADFactory'; @@ -264,7 +264,7 @@ export class Ellipse extends Curve return an; } - GetFistDeriv(pt: number | Vector3) + GetFirstDeriv(pt: number | Vector3) { if (typeof pt === "number") pt = this.GetPointAtParam(pt); diff --git a/src/DatabaseServices/Entity/Extrude.ts b/src/DatabaseServices/Entity/Extrude.ts index 09d2ce3e8..845b72b91 100644 --- a/src/DatabaseServices/Entity/Extrude.ts +++ b/src/DatabaseServices/Entity/Extrude.ts @@ -1025,7 +1025,7 @@ export class ExtrudeSolid extends Entity let param = indexList[0] / 2; if (this.ContourCurve.GetBulgeAt(Math.floor(param)) === 0) { - let der = this.ContourCurve.GetFistDeriv(param).normalize(); + let der = this.ContourCurve.GetFirstDeriv(param).normalize(); [der.x, der.y] = [der.y, -der.x]; let d = localVec.dot(der); localVec.copy(der).multiplyScalar(d); diff --git a/src/DatabaseServices/Entity/Line.ts b/src/DatabaseServices/Entity/Line.ts index e7101cbcd..faa4a6dd8 100644 --- a/src/DatabaseServices/Entity/Line.ts +++ b/src/DatabaseServices/Entity/Line.ts @@ -127,7 +127,7 @@ export class Line extends Curve return [this.GetPointAtParam(0.5)]; case ObjectSnapMode.Nea: { - let derv = this.GetFistDeriv(0).normalize(); + let derv = this.GetFirstDeriv(0).normalize(); let viewNormal = new Vector3().fromArray(viewXform.elements, 2 * 3); //平行不捕捉 @@ -194,7 +194,7 @@ export class Line extends Curve } } - GetFistDeriv(param: number | Vector3): Vector3 + GetFirstDeriv(param: number | Vector3): Vector3 { return this.EndPoint.sub(this.StartPoint); } @@ -235,7 +235,7 @@ export class Line extends Curve //Param GetPointAtParam(param: number): Vector3 { - return this.StartPoint.add(this.GetFistDeriv(0).multiplyScalar(param)); + return this.StartPoint.add(this.GetFirstDeriv(0).multiplyScalar(param)); } override GetParamAtPoint(pt: Vector3, fuzz = 1e-5): number { @@ -303,7 +303,7 @@ export class Line extends Curve else if (equalv3(pt, ep, 1e-8)) return { closestPt: ep, param: 1 }; - let direction = this.GetFistDeriv(0); + let direction = this.GetFirstDeriv(0); let length = direction.length(); if (length === 0) @@ -364,7 +364,7 @@ export class Line extends Curve if (cu instanceof Line || cu.constructor.name === "RoomWallLine") { //平行 - if (!isParallelTo(this.GetFistDeriv(0).normalize(), cu.GetFistDeriv(0).normalize())) + if (!isParallelTo(this.GetFirstDeriv(0).normalize(), cu.GetFirstDeriv(0).normalize())) return Status.False; let sp = cu.StartPoint; diff --git a/src/DatabaseServices/Entity/Polyline.ts b/src/DatabaseServices/Entity/Polyline.ts index 10f4ef73c..a3933d9fb 100644 --- a/src/DatabaseServices/Entity/Polyline.ts +++ b/src/DatabaseServices/Entity/Polyline.ts @@ -632,7 +632,7 @@ export class Polyline extends Curve * @returns {Vector3} * @memberof Polyline */ - GetFistDeriv(param: number | Vector3): Vector3 + GetFirstDeriv(param: number | Vector3): Vector3 { if (param instanceof Vector3) param = this.GetParamAtPoint(param); @@ -644,7 +644,7 @@ export class Polyline extends Curve if (!cu) return undefined; - return cu.GetFistDeriv(this.GetCurveParamAtParam(param)); + return cu.GetFirstDeriv(this.GetCurveParamAtParam(param)); } GetSplitCurves(param: number[] | number): Array { @@ -1352,13 +1352,13 @@ export class Polyline extends Curve { let c1 = cus[i]; let c1IsLine = c1 instanceof Line; - let d1 = c1.GetFistDeriv(c1IsLine ? 0 : 1).normalize(); + let d1 = c1.GetFirstDeriv(c1IsLine ? 0 : 1).normalize(); for (let j = i + 1; j < cus.length; j++) { let c2 = cus[j]; let c2IsLine = c2 instanceof Line; - let d2 = c2.GetFistDeriv(0).normalize(); + let d2 = c2.GetFirstDeriv(0).normalize(); if (j === i + 1) { if (c1IsLine === c2IsLine) diff --git a/src/DatabaseServices/Hardware/HardwareTopline.ts b/src/DatabaseServices/Hardware/HardwareTopline.ts index 9495f17f8..ed5af45d5 100644 --- a/src/DatabaseServices/Hardware/HardwareTopline.ts +++ b/src/DatabaseServices/Hardware/HardwareTopline.ts @@ -83,7 +83,7 @@ export class HardwareTopline extends SweepSolid let nextPath = pathCurves[FixIndex(i + 1, pathCurves)]; let preP: Vector3; if (path instanceof Line) - preP = ep.clone().sub(path.GetFistDeriv(1).normalize()); + preP = ep.clone().sub(path.GetFirstDeriv(1).normalize()); else { let pts = path.Shape.getPoints(4); @@ -91,7 +91,7 @@ export class HardwareTopline extends SweepSolid } let nextP: Vector3; if (nextPath instanceof Line) - nextP = ep.clone().add(nextPath.GetFistDeriv(0).normalize()); + nextP = ep.clone().add(nextPath.GetFirstDeriv(0).normalize()); else { let pts = nextPath.Shape.getPoints(4); @@ -108,7 +108,7 @@ export class HardwareTopline extends SweepSolid if (path instanceof Arc) { let mp = path.GetPointAtParam(0.5); - let arcPts = ProjectionToPlane(contourPts, path.Normal, mp, mp.clone().sub(path.GetFistDeriv(0.5).normalize())); + let arcPts = ProjectionToPlane(contourPts, path.Normal, mp, mp.clone().sub(path.GetFirstDeriv(0.5).normalize())); let r = radiusMap.get(path); let ocsInv = path.OCSInv; diff --git a/src/DatabaseServices/PointInPolyline.ts b/src/DatabaseServices/PointInPolyline.ts index a728d1a01..0f3048805 100644 --- a/src/DatabaseServices/PointInPolyline.ts +++ b/src/DatabaseServices/PointInPolyline.ts @@ -148,13 +148,13 @@ export function IsPointInPolyLine(pl: Polyline, pt: Vector3): boolean } if (equaln(sp.x, pt.x) && sp.y > pt.y) { - let der = arc.GetFistDeriv(0).normalize(); + let der = arc.GetFirstDeriv(0).normalize(); if (der.x < -1e-5) crossings++; } if (equaln(ep.x, pt.x) && ep.y > pt.y) { - let der = arc.GetFistDeriv(1).normalize(); + let der = arc.GetFirstDeriv(1).normalize(); if (der.x > 1e-5) crossings++; } diff --git a/src/DatabaseServices/Room/Entity/Wall/RoomWallLine.ts b/src/DatabaseServices/Room/Entity/Wall/RoomWallLine.ts index 5b293e9ca..a1571df2c 100644 --- a/src/DatabaseServices/Room/Entity/Wall/RoomWallLine.ts +++ b/src/DatabaseServices/Room/Entity/Wall/RoomWallLine.ts @@ -41,7 +41,7 @@ export class RoomWallLine extends RoomWallBase let sp = this.StartPoint; let ep = this.EndPoint; - let x = this.GetFistDeriv(0).normalize(); + let x = this.GetFirstDeriv(0).normalize(); let z = ZAxis; let y = z.clone().cross(x).normalize(); this._Matrix.makeBasis(x, y, z).setPosition(sp); diff --git a/src/DatabaseServices/Room/ParseService/CurveTrim.ts b/src/DatabaseServices/Room/ParseService/CurveTrim.ts index 37b3ac307..3805b0d8d 100644 --- a/src/DatabaseServices/Room/ParseService/CurveTrim.ts +++ b/src/DatabaseServices/Room/ParseService/CurveTrim.ts @@ -99,7 +99,7 @@ export class CurveTrimLine extends CurveTrim constructor(curve: Line, private derv: Vector3, private _Sp = curve.StartPoint, - private _Fd = curve.GetFistDeriv(0)) + private _Fd = curve.GetFirstDeriv(0)) { super(curve); } @@ -122,7 +122,7 @@ export class CurveTrimLine extends CurveTrim let d = cu.GetClosestAtPoint(p, true); if (cu.ParamOnCurve(d.param) && equalv3(d.closestPt, p, 1e-5))//点在线上 { - let derv = cu.GetFistDeriv(d.param).normalize(); + let derv = cu.GetFirstDeriv(d.param).normalize(); return equalv3(derv, this.derv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), this.derv, 1e-4));//因为墙体为顺时针 轮廓为逆时针 所以这里相等=反向 } } @@ -130,7 +130,7 @@ export class CurveTrimLine extends CurveTrim { if (cu.PtOnCurve(p, 1e-5)) { - let derv = cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize(); + let derv = cu.GetFirstDeriv(cu.GetParamAtPoint2(p)).normalize(); return equalv3(this.derv, derv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), this.derv, 1e-4)); } } @@ -178,7 +178,7 @@ export class CurveTrimArc extends CurveTrim if (!contourBox.containsPoint(p)) return false; let pl = contour.Curve as Polyline; - let thisDerv = this._curve.GetFistDeriv(p).normalize(); + let thisDerv = this._curve.GetFirstDeriv(p).normalize(); if (this._IsLeft) thisDerv.negate(); for (let i = 0; i < pl.EndParam; i++) @@ -189,7 +189,7 @@ export class CurveTrimArc extends CurveTrim let d = cu.GetClosestAtPoint(p, true); if (cu.ParamOnCurve(d.param) && equalv3(d.closestPt, p, 1e-5))//点在线上 //这个代码似乎是错误的,因为直线和圆弧不可能重合 { - let derv = cu.GetFistDeriv(d.param).normalize(); + let derv = cu.GetFirstDeriv(d.param).normalize(); return equalv3(derv, thisDerv, 1e-4) || (saveSyntropy && equalv3(derv.negate(), thisDerv, 1e-4));//因为墙体为顺时针 轮廓为逆时针 所以这里相等=反向 } } @@ -197,7 +197,7 @@ export class CurveTrimArc extends CurveTrim { if (cu.PtOnCurve(p, 1e-5)) { - let cuDerv = cu.GetFistDeriv(cu.GetParamAtPoint2(p)).normalize(); + let cuDerv = cu.GetFirstDeriv(cu.GetParamAtPoint2(p)).normalize(); return equalv3(thisDerv, cuDerv, 1e-4) || (saveSyntropy && equalv3(cuDerv.negate(), thisDerv, 1e-4)); } } diff --git a/src/DatabaseServices/Room/ParseService/GetCurveParam.ts b/src/DatabaseServices/Room/ParseService/GetCurveParam.ts index 92f59ce0d..d7186f2a7 100644 --- a/src/DatabaseServices/Room/ParseService/GetCurveParam.ts +++ b/src/DatabaseServices/Room/ParseService/GetCurveParam.ts @@ -38,7 +38,7 @@ export class GetLineParam private _StartPoint: Vector3; constructor(line: Line) { - this.Direction = line.GetFistDeriv(0); + this.Direction = line.GetFirstDeriv(0); this.Length = this.Direction.length(); this.Direction.divideScalar(this.Length); this._StartPoint = line.StartPoint; diff --git a/src/DatabaseServices/Room/ParseService/RoomWallParse.ts b/src/DatabaseServices/Room/ParseService/RoomWallParse.ts index 730afed96..7e7aa426e 100644 --- a/src/DatabaseServices/Room/ParseService/RoomWallParse.ts +++ b/src/DatabaseServices/Room/ParseService/RoomWallParse.ts @@ -696,7 +696,7 @@ export class RoomWallParse if (!dir) { - dir = offsetCurve.GetFistDeriv(0).normalize().negate(); + dir = offsetCurve.GetFirstDeriv(0).normalize().negate(); } trim = new CurveTrimLine(offsetCurve, dir); diff --git a/src/DatabaseServices/Template/ProgramTempate/TemplateWindowRecord.ts b/src/DatabaseServices/Template/ProgramTempate/TemplateWindowRecord.ts index 712595c1b..039363091 100644 --- a/src/DatabaseServices/Template/ProgramTempate/TemplateWindowRecord.ts +++ b/src/DatabaseServices/Template/ProgramTempate/TemplateWindowRecord.ts @@ -297,7 +297,7 @@ export class TemplateWindowRecord extends TemplateRecord templateIndex++; let sp = hole.LidCurves[0].StartPoint.setZ(hole.Z); - let x = hole.LidCurves[0].GetFistDeriv(0).normalize().negate(); + let x = hole.LidCurves[0].GetFirstDeriv(0).normalize().negate(); let z = ZAxis; let y = new Vector3().crossVectors(ZAxis, x); @@ -317,7 +317,7 @@ export class TemplateWindowRecord extends TemplateRecord if (!tr) return; let sp = c.StartPoint; - let x = c.GetFistDeriv(0).normalize(); + let x = c.GetFirstDeriv(0).normalize(); let z = ZAxis; let y = new Vector3().crossVectors(ZAxis, x); diff --git a/src/Editor/BoardMoveTool.ts b/src/Editor/BoardMoveTool.ts index 34aefd940..76ffd33b1 100644 --- a/src/Editor/BoardMoveTool.ts +++ b/src/Editor/BoardMoveTool.ts @@ -141,7 +141,7 @@ export class BoardMoveTool for (let i = 0.5; i < pl.EndParam; i++) { let p = pl.GetPointAtParam(i); - let derv = pl.GetFistDeriv(i).normalize(); + let derv = pl.GetFirstDeriv(i).normalize(); rotatePoint(derv, Math.PI * -0.5 * d); derv.applyMatrix4(brRot); p.setZ(br.Thickness * 0.5); diff --git a/src/Editor/SnapServices.ts b/src/Editor/SnapServices.ts index 6f947fc3d..c8ca7e784 100644 --- a/src/Editor/SnapServices.ts +++ b/src/Editor/SnapServices.ts @@ -122,7 +122,7 @@ export class SnapServices for (let c of cirs) if (c.PtOnCurve(prompt.BasePoint)) { - let derv = c.GetFistDeriv(prompt.BasePoint); + let derv = c.GetFirstDeriv(prompt.BasePoint); let tanLine = new DbLine(prompt.BasePoint, prompt.BasePoint.clone().add(derv)); ents.push({ Entity: tanLine, Mode: ObjectSnapMode.Tan }); } diff --git a/src/Geometry/DrillParse/BoardGetFace.ts b/src/Geometry/DrillParse/BoardGetFace.ts index c651156f9..3d6e27e51 100644 --- a/src/Geometry/DrillParse/BoardGetFace.ts +++ b/src/Geometry/DrillParse/BoardGetFace.ts @@ -160,7 +160,7 @@ export function MatrixIsCoplane2(matrixFrom: Matrix4, matrixTo: Matrix4, zFuzz: } export function GetSideFaceMtx(cu: Curve, inverseZ = false): Matrix4 { - let x = cu.GetFistDeriv(0).normalize(); + let x = cu.GetFirstDeriv(0).normalize(); let y = ZAxis; let z = x.clone().cross(y); if (inverseZ) z.negate(); diff --git a/src/GraphicsSystem/CalcEdgeSealing.ts b/src/GraphicsSystem/CalcEdgeSealing.ts index 22df7ea35..d5cfd6825 100644 --- a/src/GraphicsSystem/CalcEdgeSealing.ts +++ b/src/GraphicsSystem/CalcEdgeSealing.ts @@ -48,12 +48,12 @@ export function SubsectionCurvesOfHightSeal(in_out_curves: Curve[]): CurveGroups { if (isBack) { - if (!isParallelTo(curCurve.GetFistDeriv(0), nextCurve.GetFistDeriv(0))) + if (!isParallelTo(curCurve.GetFirstDeriv(0), nextCurve.GetFirstDeriv(0))) return false; } else { - if (!isParallelTo(curCurve.GetFistDeriv(0), nextCurve.GetFistDeriv(1))) + if (!isParallelTo(curCurve.GetFirstDeriv(0), nextCurve.GetFirstDeriv(1))) return false; } } @@ -62,12 +62,12 @@ export function SubsectionCurvesOfHightSeal(in_out_curves: Curve[]): CurveGroups { if (isBack) { - if (!isParallelTo(curCurve.GetFistDeriv(1), nextCurve.GetFistDeriv(0))) + if (!isParallelTo(curCurve.GetFirstDeriv(1), nextCurve.GetFirstDeriv(0))) return false; } else { - if (!isParallelTo(curCurve.GetFistDeriv(0), nextCurve.GetFistDeriv(0))) + if (!isParallelTo(curCurve.GetFirstDeriv(0), nextCurve.GetFirstDeriv(0))) return false; } } @@ -75,7 +75,7 @@ export function SubsectionCurvesOfHightSeal(in_out_curves: Curve[]): CurveGroups else if (nextIsLine)//都是直线 { //共线且相连的直线分为一组 #I11T1Z - if (!isParallelTo(nextCurve.GetFistDeriv(0).normalize(), curCurve.GetFistDeriv(0).normalize())) + if (!isParallelTo(nextCurve.GetFirstDeriv(0).normalize(), curCurve.GetFirstDeriv(0).normalize())) return false; let pts = [curCurve.StartPoint, curCurve.EndPoint]; @@ -178,7 +178,7 @@ export function GetBoardHighSeal(br: Board, sealcus: Curve[]): IHighSealedItem[] let dir = Math.sign(br.ContourCurve.Area2); for (let c of sealcus) { - let derv = c.GetFistDeriv(0).multiplyScalar(dir); + let derv = c.GetFirstDeriv(0).multiplyScalar(dir); if (Math.abs(derv.x) > Math.abs(derv.y)) { @@ -205,8 +205,8 @@ export function OffsetOutlineSpNotChange(oldcu: Curve, newCu: Curve) { if (!newCu) return false; if (oldcu.EndParam !== newCu.EndParam) return false; - let sDerv = oldcu.GetFistDeriv(0).normalize(); - let eDerv = oldcu.GetFistDeriv(oldcu.EndParam).normalize().negate(); + let sDerv = oldcu.GetFirstDeriv(0).normalize(); + let eDerv = oldcu.GetFirstDeriv(oldcu.EndParam).normalize().negate(); sDerv.add(eDerv).normalize(); let mDerv = newCu.StartPoint.sub(oldcu.StartPoint).normalize(); return isParallelTo(mDerv, sDerv); @@ -522,7 +522,7 @@ export function SetBoardTopDownLeftRightSealData(br: Board, sealDatas: IHighSeal { for (let i = 0; i < 4; i++) { - let derv = sealCurves[i].GetFistDeriv(0).normalize(); + let derv = sealCurves[i].GetFirstDeriv(0).normalize(); if (isParallelTo(derv, XAxis, 1e-4)) { if (derv.x * dir > 0) diff --git a/src/GraphicsSystem/OffsetPolyline.ts b/src/GraphicsSystem/OffsetPolyline.ts index ee2e8a2e1..168add4ab 100644 --- a/src/GraphicsSystem/OffsetPolyline.ts +++ b/src/GraphicsSystem/OffsetPolyline.ts @@ -438,8 +438,8 @@ export class OffsetPolyline */ private IsSharpCorner(curveResNow: IOffsetResult, curveResNext: IOffsetResult): boolean { - let v1 = this._SubCurves[curveResNow.index].GetFistDeriv(1); - let v2 = this._SubCurves[curveResNext.index].GetFistDeriv(0); + let v1 = this._SubCurves[curveResNow.index].GetFirstDeriv(1); + let v2 = this._SubCurves[curveResNext.index].GetFirstDeriv(0); v1.cross(v2); return Math.sign(v1.z) === this._OffsetDistSign; } @@ -869,7 +869,7 @@ export class OffsetPolyline let preIndex = FixIndex(minIndex - 1, this._SubCurves); let preCurve = this._SubCurves[preIndex]; - if (!equalv3(c.GetFistDeriv(0).normalize(), preCurve.GetFistDeriv(1).normalize())) + if (!equalv3(c.GetFirstDeriv(0).normalize(), preCurve.GetFirstDeriv(1).normalize())) { let p = c.StartPoint; let l1 = c.Length; @@ -899,7 +899,7 @@ export class OffsetPolyline let nextIndex = FixIndex(minIndex + 1, this._SubCurves); let nextCurve = this._SubCurves[nextIndex]; - if (!equalv3(c.GetFistDeriv(1).normalize(), nextCurve.GetFistDeriv(0).normalize())) + if (!equalv3(c.GetFirstDeriv(1).normalize(), nextCurve.GetFirstDeriv(0).normalize())) { let p = c.EndPoint; @@ -926,7 +926,7 @@ export class OffsetPolyline } } - let dri = c.GetFistDeriv(param); + let dri = c.GetFirstDeriv(param); let cross = dri.cross(pt.clone().sub(minCp)); return -Math.sign(cross.z); } diff --git a/src/GraphicsSystem/ToolPath/FeedingToolPath.ts b/src/GraphicsSystem/ToolPath/FeedingToolPath.ts index 6b4f273a8..80b5f7999 100644 --- a/src/GraphicsSystem/ToolPath/FeedingToolPath.ts +++ b/src/GraphicsSystem/ToolPath/FeedingToolPath.ts @@ -607,7 +607,7 @@ export function GetModelingFromCustomDrill(br: Board) let thickness = line.StartPoint.distanceTo(pt); let shape = en.Shape.ApplyMatrix(en.OCS).ApplyMatrix(br.OCSInv); - let vec = line.GetFistDeriv(0).normalize().multiplyScalar(thickness); + let vec = line.GetFirstDeriv(0).normalize().multiplyScalar(thickness); shape.Position = shape.Position.add(vec); //侧面造型仅在多段线直线上 diff --git a/src/GraphicsSystem/ToolPath/VKnifToolPath.ts b/src/GraphicsSystem/ToolPath/VKnifToolPath.ts index e04ec0b06..6b3f5e25c 100644 --- a/src/GraphicsSystem/ToolPath/VKnifToolPath.ts +++ b/src/GraphicsSystem/ToolPath/VKnifToolPath.ts @@ -38,10 +38,10 @@ export function VKnifToolPath(polyline: Polyline, feedingDepth: number, knifAngl if (c1 instanceof Arc) { d.bul = c1.Bul; - c1 = new Line(curP.clone().sub(c1.GetFistDeriv(1).multiplyScalar(100)), curP.clone()); + c1 = new Line(curP.clone().sub(c1.GetFirstDeriv(1).multiplyScalar(100)), curP.clone()); } if (c2 instanceof Arc) - c2 = new Line(curP.clone(), curP.clone().add(c2.GetFistDeriv(0).multiplyScalar(100))); + c2 = new Line(curP.clone(), curP.clone().add(c2.GetFirstDeriv(0).multiplyScalar(100))); ptsbul.push(d); @@ -52,12 +52,12 @@ export function VKnifToolPath(polyline: Polyline, feedingDepth: number, knifAngl } //圆弧与直线相切,此时不要提刀 - if (isParallelTo(c1.GetFistDeriv(0), c2.GetFistDeriv(0))) continue; + if (isParallelTo(c1.GetFirstDeriv(0), c2.GetFirstDeriv(0))) continue; //计算提刀部分: //向量与平分线,参照倒角代码 - let derv1 = c1.GetFistDeriv(0).normalize(); - let derv2 = c2.GetFistDeriv(0).normalize(); + let derv1 = c1.GetFirstDeriv(0).normalize(); + let derv2 = c2.GetFirstDeriv(0).normalize(); let bisectorVec = derv1.clone().negate().add(derv2).multiplyScalar(0.5); let co1 = c1.GetOffsetCurves(x * Math.sign(derv1.cross(bisectorVec).z))[0];