발전 시뮬레이션 각도 계산 수정
This commit is contained in:
parent
3ab5aec767
commit
9c54c135b7
@ -807,59 +807,57 @@ export const useTrestle = () => {
|
|||||||
const getAzimuth = (parent) => {
|
const getAzimuth = (parent) => {
|
||||||
const { moduleCompass, surfaceCompass, direction } = parent
|
const { moduleCompass, surfaceCompass, direction } = parent
|
||||||
|
|
||||||
|
if(surfaceCompass) {
|
||||||
|
return -surfaceCompass
|
||||||
|
}
|
||||||
|
|
||||||
let resultAzimuth = surfaceCompass || moduleCompass
|
let resultAzimuth = surfaceCompass || moduleCompass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
case 'south': {
|
case 'south': {
|
||||||
if (resultAzimuth < 0) {
|
return resultAzimuth
|
||||||
return -1 * resultAzimuth
|
|
||||||
} else if (resultAzimuth === 0) {
|
|
||||||
return 0
|
|
||||||
} else if (resultAzimuth < 180) {
|
|
||||||
return -1 * resultAzimuth
|
|
||||||
} else if (resultAzimuth === 180) {
|
|
||||||
return 180
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
case 'north': {
|
case 'north': {
|
||||||
if (resultAzimuth < 0) {
|
if (resultAzimuth < 0) {
|
||||||
return -1 * (180 + resultAzimuth)
|
return 180 + resultAzimuth
|
||||||
} else if (resultAzimuth === 0) {
|
} else if (resultAzimuth === 0) {
|
||||||
return 180
|
return 180
|
||||||
} else if (resultAzimuth < 180) {
|
} else if (resultAzimuth < 180) {
|
||||||
return 180 - resultAzimuth
|
return resultAzimuth - 180
|
||||||
} else if (resultAzimuth === 180) {
|
} else if (resultAzimuth === 180) {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
case 'west': {
|
case 'west': {
|
||||||
if (resultAzimuth > -180 && resultAzimuth < 0) {
|
if (resultAzimuth > -180 && resultAzimuth < 0) {
|
||||||
return -1 * (90 + resultAzimuth)
|
return 90 + resultAzimuth
|
||||||
} else if (resultAzimuth === 0) {
|
} else if (resultAzimuth === 0) {
|
||||||
return -180 + (90 - resultAzimuth)
|
return 90 - resultAzimuth
|
||||||
} else if (resultAzimuth < 180) {
|
} else if (resultAzimuth < 180) {
|
||||||
if (resultAzimuth > 90) {
|
if (resultAzimuth > 90) {
|
||||||
return 180 + (90 - resultAzimuth)
|
return -180 + (resultAzimuth - 90)
|
||||||
}
|
}
|
||||||
return -180 + (90 - resultAzimuth)
|
|
||||||
} else if (resultAzimuth === 180) {
|
|
||||||
return 180 + (90 - resultAzimuth)
|
return 180 + (90 - resultAzimuth)
|
||||||
|
} else if (resultAzimuth === 180) {
|
||||||
|
return -180 + (resultAzimuth - 90)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'east': {
|
case 'east': {
|
||||||
if (resultAzimuth === 0) {
|
if (resultAzimuth === 0) {
|
||||||
return 90 - resultAzimuth
|
return -180 + (90 - resultAzimuth)
|
||||||
} else if (resultAzimuth > 0 && resultAzimuth < 180) {
|
} else if (resultAzimuth > 0 && resultAzimuth < 180) {
|
||||||
return 90 - resultAzimuth
|
return resultAzimuth - 90
|
||||||
} else if (resultAzimuth === 180) {
|
} else if (resultAzimuth === 180) {
|
||||||
return 90 - resultAzimuth
|
return resultAzimuth - 90
|
||||||
} else if (resultAzimuth > -180 && resultAzimuth < 0) {
|
} else if (resultAzimuth > -180 && resultAzimuth < 0) {
|
||||||
if (resultAzimuth < -90) {
|
if (resultAzimuth <= -90) {
|
||||||
return -180 - (90 + resultAzimuth)
|
return 180 + (90 + resultAzimuth)
|
||||||
}
|
}
|
||||||
return 180 - (90 + resultAzimuth)
|
return -180 + (90 + resultAzimuth)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user