;===================================================================== ; PV-WAVE ARL ; ; PV-Wave Advanced Rendering Library ; 11/90 D. Carr ; ; (c) Copyright Precision Visuals, Inc., 1990 ; Boulder, Colorado, U.S.A. ; ; All Rights Reserved. ; ; This software is confidential information which is proprietary to ; and a trade secret of Precision Visuals, Inc. Use, duplication or ; disclosure is subject to the terms of an appropriate license ; agreement. ; ------------------------------------------------------------------ ; Use, duplication, or disclosure by the Government is subject to ; restrictions set forth in paragraph (b)(3)(B) of the Rights in ; Technical Data and Computer Software clause in DAR 7-104.9(a). ; ; Contractor : Precision Visuals, Inc., Boulder, Colorado, U.S.A. ; ------------------------------------------------------------------- ; ; Program Overview : PROCEDURE Vol_Marker ; Vol_Marker displays colored markers scattered throughout a volume. ; The color of each marker is determined by the value of the volume ; data at the point where the marker is plotted. ; ; SEE ALSO : Vector_Field3 ; ; MANDATORY INPUTS : ; ; vol : A 3 dimensional volume of data to plot markers in. ; ; n_points : The number of markers to plot. ; ; OPTIONAL INPUTS : ; ; axis_color : The color to use when plotting the axis. To ; suppress the axis, set axis_color to -1 . ; ; mark_symbol : A number specifying the marker symbol to use. ; The number should be between 1 and 7. The ; default is 2 (asterisk). ; ; mark_size : The maximum marker size. ; ; mark_thick : The maximum line thickness to use when plotting ; markers. Typically, this will be an integer ; between 1 and 7 . ; ;===================================================================== ; PRO Vol_Marker, vol, n_points, axis_color=axis_color, $ mark_symbol=mark_symbol, mark_size=mark_size, $ mark_thick=mark_thick sv = Size(vol) IF (sv(0) NE 3) THEN BEGIN Print, "Volume array not 3 dimensional." STOP ENDIF IF (((sv(1) LT 2) OR (sv(2) LT 2)) OR (sv(3) LT 2)) THEN BEGIN Print, "Volume dimensions must be >= 2" STOP ENDIF vol = Bytscl(vol, Top=(!D.N_Colors - 1)) n_points = Long(n_points(0)) > Long(1) points = Fltarr(3, n_points) px = Fix(Randomu(s, n_points) * sv(1)) < (sv(1) - 1) py = Fix(Randomu(s, n_points) * sv(2)) < (sv(2) - 1) pz = Fix(Randomu(s, n_points) * sv(3)) < (sv(3) - 1) vecx = Invert(!P.T) # [1.0, 0.0, 0.0, 1.0] vecy = Invert(!P.T) # [0.0, 1.0, 0.0, 1.0] vecz = Invert(!P.T) # [0.0, 0.0, 1.0, 1.0] h_error = 1000.0 vecx = (vecx * h_error) / ABS(vecx(3) * h_error) vecy = (vecy * h_error) / ABS(vecy(3) * h_error) vecz = (vecz * h_error) / ABS(vecz(3) * h_error) veye = [vecx(2), vecy(2), vecz(2)] mv = Max(ABS(veye)) dir_sort = Where(ABS(veye) GE mv) IF (veye(dir_sort(0)) GE 0.0) THEN BEGIN CASE dir_sort(0) OF 0: px = px(Sort(px)) 1: py = py(Sort(py)) 2: pz = pz(Sort(pz)) ENDCASE ENDIF ELSE BEGIN CASE dir_sort(0) OF 0: px = Max(px) - px(Sort(px)) 1: py = Max(py) - py(Sort(py)) 2: pz = Max(pz) - pz(Sort(pz)) ENDCASE ENDELSE points(0, *) = Float(px(*)) points(1, *) = Float(py(*)) points(2, *) = Float(pz(*)) axis_col = !D.N_Colors - 1 IF (N_Elements(axis_color) GT 0) THEN BEGIN axis_color = Fix(axis_color(0)) axis_col = axis_color ENDIF dn = Float(Max([sv(1), sv(2), sv(3)]) - 1) dn2 = dn / 2.0 xmid = Float(sv(1) - 1) / 2.0 ymid = Float(sv(2) - 1) / 2.0 zmid = Float(sv(3) - 1) / 2.0 !X.S = [(dn2 - xmid), 1.0] / dn !Y.S = [(dn2 - ymid), 1.0] / dn !Z.S = [(dn2 - zmid), 1.0] / dn !X.Window = [0.0, Float(sv(1) - 1) / dn] + !X.S(0) !Y.Window = [0.0, Float(sv(2) - 1) / dn] + !Y.S(0) !Z.Window = [0.0, Float(sv(3) - 1) / dn] + !Z.S(0) !X.Range = [0.0, (sv(1) - 1)] !Y.Range = [0.0, (sv(2) - 1)] !Z.Range = [0.0, (sv(3) - 1)] xpos = 0.0 ypos = 0.0 zpos = 0.0 IF (vecx(2) LT 0.0) THEN xpos = Float(sv(1) - 1) IF (vecy(2) LT 0.0) THEN ypos = Float(sv(2) - 1) IF (vecz(2) LT 0.0) THEN zpos = Float(sv(3) - 1) IF (axis_col GE 0) THEN BEGIN Axis, xpos, ypos, zpos, /Xaxis, Color=axis_col, /T3d Axis, xpos, ypos, zpos, /Yaxis, Color=axis_col, /T3d Axis, xpos, ypos, zpos, /Zaxis, Color=axis_col, /T3d Erase Axis, xpos, ypos, zpos, /Xaxis, Color=axis_col, /T3d Axis, xpos, ypos, zpos, /Yaxis, Color=axis_col, /T3d Axis, xpos, ypos, zpos, /Zaxis, Color=axis_col, /T3d Empty ENDIF mark_sym = 2 IF (N_Elements(mark_symbol) GT 0) THEN BEGIN mark_symbol = Fix(mark_symbol(0)) IF ((mark_symbol LT 1) OR (mark_symbol GT 7)) THEN BEGIN Print, "Marker symbol must be >= 1 and <= 7" STOP ENDIF mark_sym = mark_symbol ENDIF mark_sz = 1.0 IF (N_Elements(mark_size) GT 0) THEN BEGIN mark_size = Float(mark_size(0)) > 0.0 mark_sz = mark_size ENDIF mark_tk = 1 IF (N_Elements(mark_thick) GT 0) THEN BEGIN mark_thick = Fix(mark_thick(0)) > 0 mark_tk = mark_thick ENDIF mtk = Float(mark_tk) / Float(Max(vol)) msz = Float(mark_sz) / Float(Max(vol)) points = Poly_Norm(points) points = Poly_Trans(points, !P.T) FOR i=0, (n_points - 1) DO $ Plots, points(0, i), points(1, i), points(2, i), $ Color=vol(px(i), py(i), pz(i)), Psym=mark_sym, /Normal, $ Symsize=(Float(vol(px(i), py(i), pz(i))) * msz), $ Thick=(Fix(Float(vol(px(i), py(i), pz(i))) * mtk)), T3d=0 END