nickcam / AnimatedEnvironmentLayer

A custom arcgis js api layer to display GRIB data formatted as json as animated particles on a canvas
https://animatedenvironmentlayer.azurewebsites.net/index.html
44 stars 10 forks source link

I found the reason why the artboard is not full screen but there is a new bug #16

Open wy201707 opened 1 year ago

wy201707 commented 1 year ago

Hello author, I'm sorry to bother you, I also found the problem of "the drawing area is smaller than the screen" mentioned before, I found part of the reason but encountered a new bug. Find that the size of the drawing board is related to window.devicePixelRatio, so adjust the drawing board passed into layerview (this.context.canvas.width = cwidth*window.devicePixelRatio when resizing) But the strange thing is that when window.devicePixelRatio is not an integer, the particle animation is directly messed up. chatGPT prompts: it may be that infinity values appear when some places are multiplied by decimals and then passed through values or rounded off. But I can't really find where is the error

nickcam commented 1 year ago

Try the latest changes I've just committed - they could fix this. I've only tested with integer DPR's, but I think it should still work ok.

wy201707 commented 1 year ago

Thank you very much for adding new features, I tried the latest code (my DPR=1.35), and provided feedback and guesses about bugs Now when DPR is not an integer, the particle animation of global wind and gobal wind2 is wrong (fig1-fig2), and the style of Australian swell is strange (fig3) From Figure 3, it can be seen that the horizontal position seems credible and the vertical position is extremely large, Use debugging, found that there will be a huge difference between the x value and y value in the project function (Figure 4), chatGPT prompts "The calculation of horizontal and vertical positions depends on the small offsets hLon and hLat of longitude and latitude, and these offsets The offset is a very small value. If the screen resolution is not an integer, it may cause the pixels to be rounded or rounded down in the calculation, thus introducing some errors", I guess it has something to do with the rounding/calculation exceeding the precision, But it doesn't seem to be due to the hlon in the distortion function. May I ask where could go wrong? ① VelocityScale may work? I suspect project and desort now, the parameters passed in these two functions are only velocityScale related to DPR (start guessing) ② Why do you need to convert radians and angles multiple times? (Sorry, I lack GIS-related knowledge, and I can't understand project and invert so that I can't troubleshoot)

fig 1 chrome (local)

fig2 edge  global-wind2 (your url link)

fig 3 some bug

fig 4 debug find  function project may due to bug?

王愿 @.***

 

------------------ 原始邮件 ------------------ 发件人: "nickcam/AnimatedEnvironmentLayer" @.>; 发送时间: 2023年3月29日(星期三) 上午9:52 @.>; @.**@.>; 主题: Re: [nickcam/AnimatedEnvironmentLayer] I found the reason why the artboard is not full screen but there is a new bug (Issue #16)

Try the latest changes I've just committed - they could fix this. I've only tested with integer DPR's, but I think it should still work ok.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>