Author Topic: ViewChange{} Odd Behavior  (Read 1300 times)

bdeck

  • Hero Member
  • *****
  • Posts: 780
ViewChange{} Odd Behavior
« on: April 29, 2014, 09:28:31 AM »
When ViewChange{} is used to change the absolute zoom factor, it also appears to change the view center or viewer location.

Here's a demo.
First set the view center to a location centered on the screen. Then run the macro setting various f values. The view center appears to move.


Code: [Select]
'Demonstration of Odd Behavior in ViewChange{}

print "Initial values ax, ay, az, view distance", sys(205), sys(206), sys(207), sys(208),"

Hit any key to change zoom levels"
anykey
f=.5
do while f<>0
>ViewChange

{
<Zoomfactor [f]  'assign an absolute zoom level
}

print "ax, ay, az, view distance", sys(205), sys(206), sys(207), sys(208)

prompt$= "zoom factor =",f," Enter new zoom factor  (zero to quit)"
sys(130)=0   ' move input window to top left corner
sys(131)=0
input [prompt$], f$
if f$="" then end
f=val(f$)

loop

« Last Edit: April 29, 2014, 10:08:03 AM by bdeck »

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: ViewChange{} Odd Behavior
« Reply #1 on: April 29, 2014, 10:12:09 AM »
Bdeck,

We probably need to define some terms.

View Center:  x,y,z coordinate location in 3d model space about which the camera will orbit in a particular window view.

Screen View Center:  dead center (middle) pixel location of the 2d window view frame when looking at either at 2d model space or 3d model space.

The View Center and Screen View Center aren't always the same.  Is this what you mean?

bdeck

  • Hero Member
  • *****
  • Posts: 780
Re: ViewChange{} Odd Behavior
« Reply #2 on: April 29, 2014, 10:38:54 AM »
The View Center and Screen View Center aren't always the same.  Is this what you mean?

Hi, Prl
After setting the view center with  SetViewerPoints{}, and setting the viewer location (either in SetViewerPoints{} or using sys(205-208) values for angle and radius from view center, the view center should be centered in the view window. It should stay there unless explicitly moved, for example by panning or scrolling. (the Zoom{} command does not move the view center,  but ViewChange{} does.)

EDIT -- removed meaningless drivel here.

BD




« Last Edit: April 29, 2014, 10:57:05 AM by bdeck »

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: ViewChange{} Odd Behavior
« Reply #3 on: April 29, 2014, 10:42:56 AM »
Bd,

I guess the other thing I've noticed playing with your routine is that we can't determine the initial zoom factor either.  Am I correct? Or did I just miss it in the sys() functions.

bdeck

  • Hero Member
  • *****
  • Posts: 780
Re: ViewChange{} Odd Behavior
« Reply #4 on: April 29, 2014, 10:56:03 AM »
Hi prl,

Yes, we can't.

It would be helpful for DC to expose the viewcenter or the camera location, along with the zoomlevel (to avoid confusion with zoomfactor in the zoom command).

I have no problem using the command without using the zoom parameter.  Used it here just to get a feel for typical zoom levels.

(I edited out a prior comment about too many parameters. Must have been thinking of another command.)

Regards
BD

prl

  • Hero Member
  • *****
  • Posts: 3389
  • A Bézier Extrusion
Re: ViewChange{} Odd Behavior
« Reply #5 on: April 29, 2014, 11:19:51 AM »
I have no problem using the command without using the zoom parameter.  Used it here just to get a feel for typical zoom levels.

OK, I see what you are exploring.  I agree that <ViewChange is odd.  Not sure what it is focused on.

bdeck

  • Hero Member
  • *****
  • Posts: 780
Re: ViewChange{} Odd Behavior
« Reply #6 on: April 29, 2014, 01:30:05 PM »
Quote
I have no problem using the command without using the zoom parameter.

Poor choice of words. What i meant to say is that I am comfortable programming 3d views without knowing the present values of all the parameters, so long as the function is well behaved. I would steer clear of the ViewChanve{} command simply because I am not sure what it is supposed to do.

The command is apparently intended to ignore the existing view center and calculate a new one for its own internal use.  But the center it calculates for itself differs from what one would calculate using simple trigonometry.

In the following code  viewchange{} moves the view center to a new (apparently incorrect) location, even though the code tells it implicitly to keep the view center at the origin. ( Presuming the  view center was originally set on the origin)

After running the code, go into vdd and move about to see how much the view center has changed.

Code: [Select]
f=.5

d= sys(208)

print "ax, ay, az, view distance", ax, ay, az, d
anykey

do while f>0

>ViewChange

{
<Type 0
<Angle 0,0,0
<Zoomfactor [f]
<VRP 0, 0, [-d]
<PRP 0, 0, [-d]
}

print "ax, ay, az, view distance", sys(205), sys(206), sys(207), sys(208)

prompt$= " zoom factor = ",f,"  Enter new zoom factor  (zero to quit) "

sys(130)=0
sys(131)=0
input [prompt$], f

d=.75*d   ' change viewer position on each iteration

loop
« Last Edit: May 03, 2014, 10:47:11 AM by bdeck »