16 jun 2009

3d plot

Contents

  1. Order
  2. Color
This is comment on Plot 3D. See there the verbs plotcubes and view3d.

Order

In Plot 3D the cubes are plotted in the order of the last coordinate of the items. This is done by (/: {:"1) .

  'STDCLR'plotcubes 0 0 0,: 0 2 0
  'STDCLR'plotcubes 0 0 0,:~ 0 2 0

plot3d1.png plot3d2.png
As can be seen from this example, the grading should be done by (/: (* VIEWPOINT_jzplot_)*"1 ]) .
Also ^:(-.'STDCLR'-:x) seems superfluous to me. So the first improvement of plotcubes is

plotcubesB=: 3 : 0
  'GRAYSCALE' plotcubesB y
:
  d=. |:_6<\ &> cubes (/: (* VIEWPOINT_jzplot_)*"1 ]) y
  MYCOLOR_jzplot_=: c{~6#<.(<:#c=.(x,'_jzplot_')~)*(i.%<:)#d
  pd 'new;type poly;edgecolor gray;color MYCOLOR'
  pd"1 d
  pd'show'
)

Color

Contrary to what is said here, 3D shading, the ideas about 3D shading were a bit different, as can be seen in Jforum 3d plot.
The idea was Jforum to have cubes "with same colour on same side". As can be seen in picture, this was not realised.

So plotcubesB have to be altered again such that we have three colors, each for every side, and a black edgecolor.

plotcubesB=: 3 : 0
  d=. |:_6<\ &> cubes (/: (* VIEWPOINT_jzplot_)*"1 ]) y
  pd 'new;type poly;edgecolor black;color lightgray,gray,darkgray'
  pd"1 d
  pd'show'
)
   plotcubesB 0 0 0,: 0 2 0

plot3d3.png
Now things can be finished by

view3dB=: [: plotcubesB $ #: I.@,
   view3dB 3 BP 3
   view3dB 3 BP 2

plot3d4.png plot3d5.png
 3 BP y is the binary representation of the 3d Hilbert curve of order y .

RE Boss/J-blog/3d plot (last edited 2009-06-17 17:59:24 by RE Boss)