Rename rotation{DegToRad, RadToDeg} to vector{DegToRad, RadToDeg}
This commit is contained in:
parent
1f806005aa
commit
a453c314bd
@ -8,7 +8,7 @@ function radToDeg(angle) {
|
||||
return angle * (180 / Math.PI);
|
||||
}
|
||||
|
||||
function rotationDegToRad(vector) {
|
||||
function vectorDegToRad(vector) {
|
||||
return new Vector3(
|
||||
degToRad(vector.x),
|
||||
degToRad(vector.y),
|
||||
@ -16,7 +16,7 @@ function rotationDegToRad(vector) {
|
||||
);
|
||||
}
|
||||
|
||||
function rotationRadToDeg(vector) {
|
||||
function vectorRadToDeg(vector) {
|
||||
return new Vector3(
|
||||
radToDeg(vector.x),
|
||||
radToDeg(vector.y),
|
||||
@ -45,8 +45,8 @@ function normalizeDegVector(vector) {
|
||||
const AngleHelper = {
|
||||
degToRad,
|
||||
radToDeg,
|
||||
rotationDegToRad,
|
||||
rotationRadToDeg,
|
||||
vectorDegToRad,
|
||||
vectorRadToDeg,
|
||||
normalizeDegAngle,
|
||||
normalizeDegVector
|
||||
}
|
||||
|
||||
@ -37,11 +37,11 @@ function calculateCurveEndStandard(radius, curveLength) {
|
||||
}
|
||||
|
||||
function transformStart(globalStart, globalRotationDeg, localStart, localRotationQuat) {
|
||||
const globalRotationRad = AngleHelper.rotationDegToRad(globalRotationDeg);
|
||||
const globalRotationRad = AngleHelper.vectorDegToRad(globalRotationDeg);
|
||||
const startPos = globalStart.add(localStart.rotate(globalRotationRad));
|
||||
const rotationQuat = Quaternion.fromEulerAnglesRad(globalRotationRad).multiply(localRotationQuat);
|
||||
const rotationRad = rotationQuat.toEulerAnglesRad();
|
||||
const rotationDeg = AngleHelper.rotationRadToDeg(rotationRad);
|
||||
const rotationDeg = AngleHelper.vectorRadToDeg(rotationRad);
|
||||
|
||||
return {
|
||||
startPos,
|
||||
|
||||
@ -24,7 +24,7 @@ export default class MiscGroup {
|
||||
|
||||
getQuaternion() {
|
||||
if (!this.quaternion) {
|
||||
const rotRad = AngleHelper.rotationDegToRad(this.rot);
|
||||
const rotRad = AngleHelper.vectorDegToRad(this.rot);
|
||||
this.quaternion = Quaternion.fromEulerAnglesRad(rotRad).normalize();
|
||||
}
|
||||
|
||||
|
||||
@ -49,7 +49,7 @@ export default class Misc extends SceneryObject {
|
||||
worldQuat = groupQuat.multiply(worldQuat).normalize();
|
||||
}
|
||||
|
||||
const worldRot = AngleHelper.rotationRadToDeg(worldQuat.toEulerAnglesRad());
|
||||
const worldRot = AngleHelper.vectorRadToDeg(worldQuat.toEulerAnglesRad());
|
||||
const yawData = worldQuat.getMiscYawData();
|
||||
|
||||
return [ worldPos, worldRot, yawData ];
|
||||
|
||||
@ -89,7 +89,7 @@ export default class Switch extends SceneryObject {
|
||||
this.tracks = tracks;
|
||||
this.def = def;
|
||||
|
||||
const rotRad = AngleHelper.rotationDegToRad(this.rot);
|
||||
const rotRad = AngleHelper.vectorDegToRad(this.rot);
|
||||
this.isolation_id_pos = this.pos.add(def.isolationLabelPos.rotate(rotRad));
|
||||
super.applyObject(scenery);
|
||||
}
|
||||
|
||||
@ -20,7 +20,7 @@ export default class StandardTrack extends Track {
|
||||
}
|
||||
|
||||
_transformPoint(point) {
|
||||
const rotRad = AngleHelper.rotationDegToRad(this.rot);
|
||||
const rotRad = AngleHelper.vectorDegToRad(this.rot);
|
||||
return point.rotate(rotRad).add(this.points.start);
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user