GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
857 stars 359 forks source link

PS file size not so "reasonable" with plot3d #6838

Open joa-quim opened 2 years ago

joa-quim commented 2 years ago

Those guys that wanted Laz in GMT lead me to find this about ps file sizes when doing plot3d. In the case of the laz file (~2e^6 points) the plotd3 ps was about 411 MB. Quite big.

With a synthetic case these two have a bout the same size (~25 kB) but curiously with 2e^6 points the plot3d ps had ~50 Mb whilst the plot had ~70 Mb

julia> plot(rand(100,100,3), zsize=5, marker=:point, show=1, Vd=1)
        psxy  -JX14c/9.5c -Baf -BWSen -JZ5 -R0/1/0/1 -Sp2p -P -K > C:\TEMP\GMTjl_tmp.ps

julia> plot3d(rand(100,100,3), zsize=5, view=(180,90), marker=:point, show=1, Vd=1)
        psxyz  -JX14c/9.5c -Baf -Bza -JZ5 -p181/90 -R-0.04/1.04/0.02/1/0.00287271009298/0.988599253628 -Sp2p -P -K 

but the big difference comes when use perspective other then vertical. It only take to change view=(181,80) to view=(181,90) and the file size grows to 41.5 kB (with the 2e^6 points it was 411 MB).

The reason seems to be that now each point is plotted with what seems a kindof rotation matrix that uses 12 decimal places and where all but the last coefficient is repeated thru out the file

PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 390.130368759] concat
/PSL_setview matrix currentmatrix def
17 2925 881 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 78.4282268572] concat
/PSL_setview matrix currentmatrix def
17 5502 830 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 386.108559274] concat
/PSL_setview matrix currentmatrix def
17 1689 895 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 345.888450474] concat
/PSL_setview matrix currentmatrix def
17 2782 861 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 191.841944072] concat
/PSL_setview matrix currentmatrix def
17 306 893 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 56.3854549359] concat
/PSL_setview matrix currentmatrix def
17 2307 850 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 325.698711504] concat
/PSL_setview matrix currentmatrix def
17 2265 846 Sp
PSL_GPP setmatrix [0.999847695156 0.0171872651682 -0.0174524064373 0.984657762021 78.3296981831 51.9332934717] concat
/PSL_setview matrix currentmatrix def
17 3013 833 Sp
PaulWessel commented 2 years ago

Yep that is a bit crazy. Cannot recall why any of that is necessary for a point (-Sp) though. But even if it is, we could probably