comp.lang.idl-pvwave archive - RDF feed
type: channel
description: Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado
items: 3D heart

3D heart
type: item
description: Dear all, Here goes a funny stuff you might be interested. There is a 3D heart object could be used for the coming Valentine's day. Cheers, R.D. ------------------------------------------------------------ Pro HeartShape forward_function oHeart oHeart = Heart3D() oModel = obj_new('IDLgrModel') ;oModel -> Rotate, [0,0,1], 20 ;oModel -> Rotate, [1,0,0], -30 oText = obj_new('IDLgrText', 'Happy Valentine''s Day!! ', $ COLOR=[255,250,250], location=[-1.5,-1.3, 0.8], char_dim=[0.26,0.26], $ updir=[0,0,1], baseline=[1,0, -0.5]) oGreeting = obj_new('IDLgrText', 'Dear All,', $ COLOR=[255,250,250], location=[-1.5, 1.3, 0.8], char_dim=[0.26,0.26], $ updir=[0,0,1], baseline=[1,0, -0.5]) oName = obj_new('IDLgrText', 'R.D.', $ COLOR=[255,250,250], location=[0.5, -1.3, -1.2], char_dim=[0.26,0.26], $ updir=[0,0,1], baseline=[1,0, -0.5]) oModel -> Add, oHeart oModel -> Add, oText oModel -> Add, oGreeting oModel -> Add, oName xobjview, oModel, background=[255, 170, 170], $ Title='Happy Valentine''s Day!! <:o)', scale=0.72 for i=0, 50 do $ XOBJVIEW_ROTATE, [1,0,-0.5], -1 ;, /PREMULTIPLY return End Function Heart3D ; This heart shape curve is referring to the following URL: ; http://www.mathematische-basteleien.de/heart.htm ; Threedimensional curve, source: Gabriel Taubin [for example MathWorld] ; (X^2+(9./4.)*Y^2+Z^2-1.)^3 - X^2*Z^3 - (9./80.)*Y^2*Z^3 = 0. NX = 250 ;resolution NY = 8 For j=0, NY do begin Y = 2./3.*1.1*(-1+ 1./NY*j) for i=0, NX do begin X = -1.5 + 3.0/NX*i a = 1.0 b = (X^2+9./80.*Y^2)^(1./3.) c = (X^2+9.*Y^2/4.-1.0) det = b^2 - 4.*a*c if(det ge 0.0) then $ if(N_ELEMENTS(rVert1) le 1) then $ rVert1 = [X, -(-b+sqrt(det))/(2.*a), Y ] $ else begin rVert1 = [[rVert1], [X, -(-b+sqrt(det))/(2.*a), Y]] rVert1 = [[X, -(-b-sqrt(det))/(2.*a), Y], [rVert1]] endelse Endfor if (N_ELEMENTS(rVert1) ge 3) then begin if (N_ELEMENTS(oROI) eq 0) then $ oROI = obj_new('IDLgrROI', rVert1) $ else $ oROI = [oROI, obj_new('IDLgrROI', rVert1)] endif rVert1 = 0 endfor oROIGROUP = obj_new('IDLgrR…
creator: rensheu
date: 2005-02-09T17:30:15-00:00