diff --git a/ts/world/Event.ts b/ts/world/Event.ts index a627e56..090ebc3 100644 --- a/ts/world/Event.ts +++ b/ts/world/Event.ts @@ -186,7 +186,7 @@ const EventModule = { var pIntersect = pickResult[0]; var pCamera = camera.getPosition(); var legnth2Intersect = MathUtils.getLengthFromVerticeToVertice(pCamera, pIntersect); - var mat = camera.matrix.copy(); + var mat = camera.matrix.clone(); mat.setColumnTrans(pIntersect.x, pIntersect.y, pIntersect.z); var DELTA_RADIAN = MathUtils.degreeToRadian(DELTA_PITCH); mat.localRotateX(DELTA_RADIAN); diff --git a/ts/world/Line.ts b/ts/world/Line.ts index 641f00c..5862957 100644 --- a/ts/world/Line.ts +++ b/ts/world/Line.ts @@ -7,23 +7,23 @@ class Line{ public vector: Vector; constructor(position: Vertice, direction: Vector){ - this.vertice = position.getCopy(); - this.vector = direction.getCopy(); + this.vertice = position.clone(); + this.vector = direction.clone(); this.vector.normalize(); } setVertice(position: Vertice): Line { - this.vertice = position.getCopy(); + this.vertice = position.clone(); return this; } setVector(direction: Vector): Line { - this.vector = direction.getCopy(); + this.vector = direction.clone(); this.vector.normalize(); return this; } - getCopy(): Line { + clone(): Line { var lineCopy = new Line(this.vertice, this.vector); return lineCopy; } diff --git a/ts/world/Math.ts b/ts/world/Math.ts index db90449..f15c81f 100644 --- a/ts/world/Math.ts +++ b/ts/world/Math.ts @@ -80,9 +80,9 @@ const MathUtils = { * 计算三角形的面积 */ getTriangleArea(v1: Vertice, v2: Vertice, v3: Vertice){ - var v1Copy = v1.getCopy(); - var v2Copy = v2.getCopy(); - var v3Copy = v3.getCopy(); + var v1Copy = v1.clone(); + var v2Copy = v2.clone(); + var v3Copy = v3.clone(); var direction = Vector.verticeMinusVertice(v3Copy, v2Copy); var line = new Line(v2Copy,direction); var h = this.getLengthFromVerticeToLine(v1Copy,line); @@ -98,8 +98,8 @@ const MathUtils = { * @return {Number} */ getLengthFromVerticeToVertice(vertice1: Vertice, vertice2: Vertice){ - var vertice1Copy = vertice1.getCopy(); - var vertice2Copy = vertice2.getCopy(); + var vertice1Copy = vertice1.clone(); + var vertice2Copy = vertice2.clone(); var length2 = Math.pow(vertice1Copy.x-vertice2Copy.x,2) + Math.pow(vertice1Copy.y-vertice2Copy.y,2) + Math.pow(vertice1Copy.z-vertice2Copy.z,2); var length = Math.sqrt(length2); return length; @@ -113,8 +113,8 @@ const MathUtils = { * @return {Number} */ getLengthFromVerticeToLine : function(vertice: Vertice, line: Line){ - var verticeCopy = vertice.getCopy(); - var lineCopy = line.getCopy(); + var verticeCopy = vertice.clone(); + var lineCopy = line.clone(); var x0 = verticeCopy.x; var y0 = verticeCopy.y; var z0 = verticeCopy.z; @@ -141,8 +141,8 @@ const MathUtils = { * @return {Number} */ getLengthFromVerticeToPlan(vertice: Vertice, plan: Plan){ - var verticeCopy = vertice.getCopy(); - var planCopy = plan.getCopy(); + var verticeCopy = vertice.clone(); + var planCopy = plan.clone(); var x = verticeCopy.x; var y = verticeCopy.y; var z = verticeCopy.z; @@ -164,8 +164,8 @@ const MathUtils = { * @return {World.Vertice} */ getVerticeVerticalIntersectPointWidthPlan(vertice: Vertice, plan: Plan){ - var verticeCopy = vertice.getCopy(); - var planCopy = plan.getCopy(); + var verticeCopy = vertice.clone(); + var planCopy = plan.clone(); var x0 = verticeCopy.x; var y0 = verticeCopy.y; var z0 = verticeCopy.z; @@ -184,8 +184,8 @@ const MathUtils = { }, getIntersectPointByLineAdPlan(line: Line, plan: Plan){ - var lineCopy = line.getCopy(); - var planCopy = plan.getCopy(); + var lineCopy = line.clone(); + var planCopy = plan.clone(); lineCopy.vector.normalize(); var A = planCopy.A; var B = planCopy.B; @@ -213,7 +213,7 @@ const MathUtils = { */ getLineIntersectPointWithEarth(line: Line): Vertice[]{ var result:Vertice[] = []; - var lineCopy = line.getCopy(); + var lineCopy = line.clone(); var vertice = lineCopy.vertice; var direction = lineCopy.vector; direction.normalize(); @@ -280,8 +280,8 @@ const MathUtils = { * @return {Object} World.Plan 返回平面表达式中Ax+By+Cz+D=0的A、B、C、D的信息 */ getCrossPlaneByLine(vertice: Vertice, direction: Vector): Plan{ - var verticeCopy = vertice.getCopy(); - var directionCopy = direction.getCopy(); + var verticeCopy = vertice.clone(); + var directionCopy = direction.clone(); directionCopy.normalize(); var a = directionCopy.x; var b = directionCopy.y; @@ -361,7 +361,7 @@ const MathUtils = { * @return {Array} */ cartesianCoordToGeographic(vertice: Vertice): number[]{ - var verticeCopy = vertice.getCopy(); + var verticeCopy = vertice.clone(); var x = verticeCopy.x; var y = verticeCopy.y; var z = verticeCopy.z; diff --git a/ts/world/Matrix.ts b/ts/world/Matrix.ts index b4eaafa..455be11 100644 --- a/ts/world/Matrix.ts +++ b/ts/world/Matrix.ts @@ -226,7 +226,7 @@ class Matrix{ return true; } - copy(): Matrix { + clone(): Matrix { return new Matrix( this.elements[0], this.elements[4], this.elements[8], this.elements[12], this.elements[1], this.elements[5], this.elements[9], this.elements[13], diff --git a/ts/world/PerspectiveCamera.ts b/ts/world/PerspectiveCamera.ts index 29a7011..546eb4f 100644 --- a/ts/world/PerspectiveCamera.ts +++ b/ts/world/PerspectiveCamera.ts @@ -104,9 +104,9 @@ class PerspectiveCamera extends Object3D{ } look(cameraPnt: Vertice, targetPnt: Vertice, upDirection: Vector = new Vector(0, 1, 0)): void { - var cameraPntCopy = cameraPnt.getCopy(); - var targetPntCopy = targetPnt.getCopy(); - var up = upDirection.getCopy(); + var cameraPntCopy = cameraPnt.clone(); + var targetPntCopy = targetPnt.clone(); + var up = upDirection.clone(); var transX = cameraPntCopy.x; var transY = cameraPntCopy.y; var transZ = cameraPntCopy.z; @@ -128,7 +128,7 @@ class PerspectiveCamera extends Object3D{ } lookAt(targetPnt: Vertice, upDirection?: Vector): void { - var targetPntCopy = targetPnt.getCopy(); + var targetPntCopy = targetPnt.clone(); var position = this.getPosition(); this.look(position, targetPntCopy, upDirection); } @@ -173,7 +173,7 @@ class PerspectiveCamera extends Object3D{ if (!(viewMatrix instanceof Matrix)) { viewMatrix = this.getViewMatrix(); } - var verticeInCameraCopy = verticeInCamera.getCopy(); + var verticeInCameraCopy = verticeInCamera.clone(); var inverseMatrix = viewMatrix.getInverseMatrix(); var column = [verticeInCameraCopy.x, verticeInCameraCopy.y, verticeInCameraCopy.z, 1]; var column2 = inverseMatrix.multiplyColumn(column); @@ -189,7 +189,7 @@ class PerspectiveCamera extends Object3D{ if (!(viewMatrix instanceof Matrix)) { viewMatrix = this.getViewMatrix(); } - var vectorInCameraCopy = vectorInCamera.getCopy(); + var vectorInCameraCopy = vectorInCamera.clone(); var verticeInCamera = vectorInCameraCopy.getVertice(); var verticeInWorld = this.convertVerticeFromCameraToWorld(verticeInCamera, viewMatrix); var originInWorld = this.getPosition(); diff --git a/ts/world/Plan.ts b/ts/world/Plan.ts index d443f88..51f6b8c 100644 --- a/ts/world/Plan.ts +++ b/ts/world/Plan.ts @@ -3,7 +3,7 @@ class Plan{ constructor(public A: number, public B: number, public C: number, public D: number){ } - getCopy(): Plan{ + clone(): Plan{ var planCopy = new Plan(this.A, this.B, this.C, this.D); return planCopy; } diff --git a/ts/world/Ray.ts b/ts/world/Ray.ts index eff4f7f..e79c12f 100644 --- a/ts/world/Ray.ts +++ b/ts/world/Ray.ts @@ -12,23 +12,23 @@ class Ray{ * @constructor */ constructor(position: Vertice, direction: Vector){ - this.vertice = position.getCopy(); - this.vector = direction.getCopy(); + this.vertice = position.clone(); + this.vector = direction.clone(); this.vector.normalize(); } setVertice(position: Vertice): Ray { - this.vertice = position.getCopy(); + this.vertice = position.clone(); return this; } setVector(direction: Vector): Ray { - this.vector = direction.getCopy(); + this.vector = direction.clone(); this.vector.normalize(); return this; } - getCopy(): Ray { + clone(): Ray { var rayCopy = new Ray(this.vertice, this.vector); return rayCopy; } diff --git a/ts/world/Vector.ts b/ts/world/Vector.ts index ede387e..6c366a6 100644 --- a/ts/world/Vector.ts +++ b/ts/world/Vector.ts @@ -24,7 +24,7 @@ class Vector{ return [this.x, this.y, this.z]; } - getCopy(): Vector { + clone(): Vector { return new Vector(this.x, this.y, this.z); } diff --git a/ts/world/Vertice.ts b/ts/world/Vertice.ts index 369f273..c1b6cf7 100644 --- a/ts/world/Vertice.ts +++ b/ts/world/Vertice.ts @@ -25,7 +25,7 @@ class Vertice{ return [this.x, this.y, this.z]; } - getCopy(): Vertice { + clone(): Vertice { return new Vertice(this.x, this.y, this.z); }