|  |  |  | 
|---|
|  |  |  | // row | 
|---|
|  |  |  | import * as Common from '@/utils/common'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // row | 
|---|
|  |  |  | const shelfRowOffset = 1000; | 
|---|
|  |  |  | const realRowPos = [0 - shelfRowOffset, 0 + shelfRowOffset, 2420 - shelfRowOffset, 2420 + shelfRowOffset]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // bay | 
|---|
|  |  |  | const realBayPos = [1589, 3540, 5491, 7442, 9393, 11344]; | 
|---|
|  |  |  | const mapBayMaxAbs = 500; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const calBayMapPos = (realPosition, minRealPosition = Math.min(...realBayPos), maxRealPosition = Math.max(...realBayPos), maxMapPosition = mapBayMaxAbs) => { | 
|---|
|  |  |  | return ((realPosition - minRealPosition) / (maxRealPosition - minRealPosition)) * (2 * maxMapPosition) - maxMapPosition; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | console.log(Math.max(...realBayPos)); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | const shelfData = [ | 
|---|
|  |  |  | // row 1 -------------------------------------------------------------------------- | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '1-1-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[5]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '1-4-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[4]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '1-7-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[3]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '1-10-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[2]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '1-13-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[1]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '1-16-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[0], 0, realBayPos[0]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // row 2 -------------------------------------------------------------------------- | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '2-1-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[5]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '2-4-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[4]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '2-7-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[3]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '2-10-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[2]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '2-13-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[1]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '2-16-1', | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[1], 0, realBayPos[0]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // row 3 -------------------------------------------------------------------------- | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-1-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[5])], | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[5]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-4-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[4])], | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[4]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-7-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[3])], | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | // { | 
|---|
|  |  |  | //   no: '3-7-1', | 
|---|
|  |  |  | //   position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[3]]), | 
|---|
|  |  |  | //   rotationY: Math.PI / 2, | 
|---|
|  |  |  | // }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-10-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[2])], | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[2]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-13-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[1])], | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[1]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  | { | 
|---|
|  |  |  | no: '3-16-1', | 
|---|
|  |  |  | position: [0, 0, calBayMapPos(realBayPos[0])], | 
|---|
|  |  |  | position: Common.calculateMappedPosition([realRowPos[2], 0, realBayPos[0]]), | 
|---|
|  |  |  | rotationY: Math.PI / 2, | 
|---|
|  |  |  | }, | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ]; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | export default shelfData; | 
|---|