User:Andrew Nikitin/plot3dview

From J Wiki
Jump to navigation Jump to search

Adjusts viewpoint, viewcenter, viewsize and viewup parameters of the currently open plot window. [{{#file: "plot3dview.ijs"}} Download script: plot3dview.ijs ]

NB. Adjust viewpoint for a 3d plot
NB. 2010-08-20 16:34:34

[{{#file: "plot3dview.ijs"}} Download script: plot3dview.ijs ]

require '~nsg/gui/adjust.ijs'

This script uses Parameter adjuster. This line should point to that script. [{{#file: "plot3dview.ijs"}} Download script: plot3dview.ijs ]

require 'plot'
once=: [: (smoutput@('Initialize '&,) [ ".)^:((('=:'&-:)@>@{: *. (0>4!:0)@{.)@(2 {. ;:)) ;._2 ,&LF

once 0 : 0
VCX=:0
VCY=:0
VCZ=:0
VPX=:1.6
VPY=:_2.4
VPZ=:1.5
VSX=:1
VSY=:1
VSZ=:0.5
VUX=:0
VUY=:0
VUZ=:1
)

NV3D=:'VCX VCY VCZ VPX VPY VPZ VSX VSY VSZ VUX VUY VUZ'

NB. replace plot option, or add if not present
spv=:4 : 0
  y=.":y
  i=.(<x) i:~ {."1 PCmd_jwplot_
  if. i>:#PCmd_jwplot_ do.
    pd x,' ',y
  else.
    PCmd_jwplot_=:(<y) (<i;1)} PCmd_jwplot_
  end.
)

NB. update current 3D view in plot
cv=:3 : 0
'viewcenter' spv VCX,VCY,VCZ
'viewpoint'  spv VPX,VPY,VPZ
'viewsize'   spv VSX,VSY,VSZ
'viewup'     spv VUX,VUY,VUZ
pd 'show'
)

Example:

'stick' plot ;/|: ?.15 3$10
PARPERCOL_jwadjust_=:12
quiet_jwadjust_=:'1'
'cv a:' adjust 'VCX VCY VCZ VPX VPY VPZ VSX VSY VSZ VUX VUY VUZ'
STEPS_jwadjust_=:0.1 (<(<a:),(<1)) } STEPS_jwadjust_

-- Andrew Nikitin <<DateTime(2010-08-20T17:02:16-0400)>>