indexing description: "[ A plotter that plots a 3d, colored box for each 2d-point in a sequence. ]" author: "" date: "$Date$" revision: "$Revision$" class EM_VIZ_BOX_PLOTTER inherit EM_VIZ_BAR_PLOTTER rename bar_width as box_width, bar_color as box_color, set_bar_width as set_box_width, set_bar_color as set_box_color redefine plot_value end create make feature {NONE} -- Rendering (Implementation) plot_value (v: EM_VECTOR2D) is -- Plot a single box made of 6 quads, one for each face local x1, x2, y1, y2, z1, z2: DOUBLE do x1 := v.x - 0.5 * box_width y1 := v.y.min (0.0) z1 := -1.0 x2 := x1 + box_width y2 := v.y.max (0.0) z2 := 0.0 box_faces (x1,y1,z1,x2,y2,z2) end box_faces (minx, miny, minz, maxx, maxy, maxz: DOUBLE) -- Push out vertices for each face local e000, e100, e010, e110, e001, e101, e011, e111: EM_VECTOR3D do -- Looks familiar? e000 := [minx, miny, minz] e100 := [maxx, miny, minz] e010 := [minx, maxy, minz] e001 := [minx, miny, maxz] e111 := [maxx, maxy, maxz] e011 := [minx, maxy, maxz] e101 := [maxx, miny, maxz] e110 := [maxx, maxy, minz] -- Front vz_normal3d (0, 0, -1) vz_vertex (e000) vz_vertex (e100) vz_vertex (e110) vz_vertex (e010) -- Back vz_normal3d (0, 0, 1) vz_vertex (e001) vz_vertex (e011) vz_vertex (e111) vz_vertex (e101) -- Left vz_normal3d (-1, 0, 0) vz_vertex (e000) vz_vertex (e010) vz_vertex (e011) vz_vertex (e001) -- Right vz_normal3d (1, 0, 0) vz_vertex (e100) vz_vertex (e101) vz_vertex (e111) vz_vertex (e110) -- Top vz_normal3d (0, -1, 0) vz_vertex (e000) vz_vertex (e001) vz_vertex (e101) vz_vertex (e100) -- Bottom vz_normal3d (0, 1, 0) vz_vertex (e010) vz_vertex (e110) vz_vertex (e111) vz_vertex (e011) end end