Re: Viewpoint Scaling
- To: mathgroup at smc.vnet.net
- Subject: [mg16717] Re: Viewpoint Scaling
- From: "Allan Hayes" <hay at haystack.demon.co.uk>
- Date: Mon, 22 Mar 1999 22:33:41 -0500
- References: <7ct71g$8aa@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Naum Phleger <naum at condor.physics.ucsb.edu> wrote in message news:7ct71g$8aa at smc.vnet.net... > I have received lots of help, but what I really want to know is the > algorithm that is used to scale the points in the ViewPoint option for 3D > graphics. Here is a simple example that illustrates the problem. Here are > the points that I want to view my globe from (in {x,y,z} form). > > {1,0,0} {sqrt 2, sqrt 2,0} {1,0,0} {-sqrt 2,sqrt 2, 0} {-1,0,0}, ... > > or in {r,theta,fi} form > > {1,0,0} {1,0,pi/4} {1,0,pi/2} {1,0,3pi/4} {1,0,pi} ... > > The problem I have is that with this list, the odd points give a smaller > image back, and it is of set because the box is oriented differently. > > What I want to do is enter my view points in such a way that the only > difference between successive images is a rotation, no translation or > scaling. Where can I find the algorithm that Viewpoints uses? Thank you > for any help. > -- > > Naum Phleger > > Gwinn Group: Naum's House: > University of California 6735 Trigo Rd. Apt. A > Santa Barbara, CA 93106 Isla Vista, CA 93117 > Phone: (805) 893-8656 Phone: (805) 961-8282 > > naum at condor.physics.ucsb.edu > > Naum, With BoxRatios = br PlotRange = pr If we have ViewPoint -> vp (in scaled coordinates) then position of the view point in user coordinates is given by UVP[br_,pr_, vp_]:=pr.{1,1}/2+pr.{-1,1} Max[br]/br vp; And if we have ViewPoint at uvp in user coordinates then view point in scaled coordinates is given by SVP[br_,pr_,uvp_]:=(uvp-pr.{1,1}/2)br/Max[br]/pr.{-1,1}; Take a default plot sgr=Plot3D[x^2-y^2, {x,-1,1},{y,-1,1}]; We get the view point in user coordinates: First the values of br, pr and vp actually used in the preceding. {br,pr,vp}=FullOptions[sgr, {BoxRatios,PlotRange,ViewPoint}] {{1.,1.,0.4},{{-1.,1.},{-1.,1.},{-1.05,1.05}},{1.3,-2.4,2.}} Now we have uvp = UVP[br,pr, vp] {2.6,-4.8,10.5} We can set the view point by user coordinates (but because the plot range may be affected by the view point I'll make this explicit) First a check that we can get the original picture Show[sgr, PlotRange\[Rule]pr, ViewPoint \[Rule] SVP[br,pr,uvp]] Now try put the view point at user coordinates {1.5,0,3} Show[sgr, PlotRange\[Rule]pr, ViewPoint \[Rule] SVP[br,pr,{1.5,0,3}]] Allan --------------------- Allan Hayes Mathematica Training and Consulting Leicester UK www.haystack.demon.co.uk hay at haystack.demon.co.uk Voice: +44 (0)116 271 4198 Fax: +44 (0)870 164 0565