# window transformation (connect points from window 1 and windows 2) in other window 3

halo (someone can help me)

Try to explain what I want to do.

What transformation I need to do this.

divide screen two parts:equal parts

upper window: screen #1

-------------

first part : set window xmin1,xmax1,ymin1,ymax1

In this window is projection 3 dimensional "point (x,y,z)" display this point

on the screen with the transformation.

u1=y-x/2 -> x direction

v1=z-x/2 -> y direction

lower window: screen #2

-------------

second part : set window xmin2,xmax2,ymin2,ymax2

In this window is projection 3 dimensional "point (x,y,z)" display this point

on the screen with the transformation.

u2=y-x/2 -> x direction

v2=z-x/2 -> y direction

2e) I close both screen #1 and screen #2

I use default window .

set window xmin,xmax,ymin,ymax

3e) I want to connect same point from screen #1 by line to same point from screen #2

by example:

I explain suppose point with coordinates p(xa,ya,za)

first point of the line:

u1=ya-xa/2

v1=za-xa/2

second point of the line :

u2=ya-xa/2

v2=za-xa/2

set window xmin,xmax,ymin,ymax

what mathematical transformation must be here ?????????????????????????

(I think it is linear transformation to do this)

unew1=f(u1,v1)

vnew1=f(u1,v1)

unew2=f(u2,v2)

vnew2=f(u2,v2)

plot lines : unew1,vnew1;unew2,vnew2

Best regards

Peter (Belgium)

## Comments

## re: transformations

No one has replied, probably because no one really understands what you are trying to do.

1) In your EXAMPLE it seems that u1 = u2 and v1 = v2 so you have only one point--not two, since you start with only p(xa,ya,za). ???

2) Why aren't the two points from windows 1 and 2 just plotted initially in the same final window? What is the point of having three windows here? (see 3)

3) Are the scales in the first two windows different? Say the points represent a position in space measured in meters. Window one might be 1 meter per pixel while window 2 might be 10 meters per pixel and the third window 5 meters per pixel. If that is the case, then it is simple enough to scale window one by multiplying be 5 and window two by .5 to plot the points in window 3 and connect them with a line.

4) Maybe a numerical example would help you explain. Let the point in window 1 be at (1,2,3) in which case your transformation gives a 2d point at (1.5,2.5). If the window 2 point is (4,5,6) then that plots as (3,4). Is this correct? What is different about window3?

The scales of windows 1 and 2 could be different and the orientation of the axes could be different--although your transformations imply they are the same. If different, then the rotational angles of the axes from horizontal, vertical, and into/out of the screen become important and the 2-d projections depend on the sines and cosines of those angles.

So--bottom line here is that it is really not clear what you are doing and why?

rwt

## halo, info more (connect points window 1 to window 2)

I have function in 3d z=f(x,y)

window 1: z=x*x+y*y -> u1=y-x/2,v1=z-x/2 to project them in window.

window 2: I have function that makes projection (at z=0)

u2=y-x/2,v2=-x/2

(the contour level for different values of z)

window 3 : go to default window ,I want to connect line from function z=f(x,y) and corresponding points

on the contours with line.

Best regards

Peter

## re: connect points

Sorry, but I'm still confused. You probably need a math person here, but I'm a physicist and keep trying to visualize the 3-D nature of your windows. Let's use an example--x = 1 and y = 1 so z = 2. So the 3-D point is (1,1,2). Other points might be (0,0,0) and (2,2,8). Using (1,1,2) then your Window one projection is at (.5,1.5) assuming u is the horizontal coordinate and v is the vertical. The orientation of the axes to the window is then strange but one could figure it out. Window 2 is where I have trouble. You want a z = 0 contour, but you use a value of z = 0 in the projection. Using your f(x,y) the only way z = 0 is if x and y both = 0. So I'm not able to project the (1,1,2) point using your u2,v2 since v2 assumes z = 0. I also can't visualize the axes orientation here relative to the window because if I just use your projection the (u2,v2) = (.5,-.5) but again only (0,0,0) would give z = 0 according to z = f(x,y) = x*x + y*y. If you want all of window 2 to be at z = 0 then you are looking at the xy plane (although I guess the axes could be other than vertical and horizontal. If they are horizontal and vertical then the projection should be just (1,1) for the 3D (1,1,2) since the z = 2 would be out of the window but perpendicular to the window. Anyway, if the whole plane of the window is z = 0, then I can't make sense of the (.5,-.5) projection of (1,1,2).

I may be confusing what Window 2 really is here, but it seems to me that Window 1 and Window 2 have two very different axes orientations relative to their respective windows if I just go by you projection formulae. You don't specify what Window 3's orientation is. Is it just the u,v plane (axes vertical and horizontal)? If the projections in Window 1 and Window 2 are of the same 3D point, then I would think they have to map to a single point in Window 3--no line.

I suspect I still don't understand what you are doing here, but maybe these comments would help you clarify.

rwt

## halo my program z=f(x,y)

halo

I send you version of the program below , I want connect points from z=f(x,y) with point on contours with line.

point x=x1,y=y1 from z1=f(x1,y1)=x1*x2+y1*y2 there exit point in contour plane who corresponding with point

on the surface. I want connect both point with a line. I want show this for example to understand with I mean

when take lowest point x=0,y=0 then must be connect to the center of cross in yellow (this cross in the

contour plane).

program here

option nolet

! author: peter vlasschaert

! contact:peter.vlasschaert@gmail.com

!*********************************

! Draw z=f(x,y) wireframe models

! + contour

!*********************************

! correction for aspect ratio

!*********************************

ask pixels hpix,vpix

pratio=hpix/vpix

pl=8

vr=pl

hr=pl*pratio

set window -hr/2,hr/2,-vr/2,vr/2

!*********************************

! draw axes 2D

!*********************************

xmax=hr/2

xmin=-xmax

ymax=vr/2

ymin=-ymax

! step value

xstep=.2

ystep=.2

!color

z1$="blue" ! color of axes

set color z1$

plot xmin,0;xmax,0

plot 0,ymin;0,ymax

!*******************************

! z=f(x,y)

! draw 3d in 2D

! U=y-x/2

! V=z-x/2

!*******************************

! z-> zmin,zmax

!*******************************

zmin=-10

zmax=80

umin=ymin-xmax/2

umax=ymax-xmin/2

set window umin,umax,zmin,zmax

z2$="green" !color

set color z2$

declare function f

function f(x,y)=x*x+y*y

for x=xmin to xmax step xstep

for y=ymin to ymax step ystep

plot y-x/2,f(x,y)-x/2;

next y

plot

next x

z2$="black" !color

!set color z2$

for y=ymin to ymax step ystep

for x=xmin to xmax step xstep

plot y-x/2,f(x,y)-x/2;

next x

plot

next y

!*************************************

!*************************************

!* draw contours z=f(x,y) *

!*************************************

!z=height values with different colors

!*************************************

!*************************************

declare function shade

! different color

function shade(c)=c/10

for u=umin to umax step .02

for z=zmin to zmax step .02

set color shade(f(u,z))

plot u,z

next z

next u

!*****************

! axes on contour*

!*****************

z3$="yellow" ! color of axes

set color z3$

plot umin,0;umax,0

plot 0,-15;0,15

!********************************

! points on contour (box circle)*

!********************************

z4$="black" ! color of point represent by circle

set color z4$

box circle -7,-7+.4,-7,-7+.4

end

## Not sure if this is what you

Not sure if this is what you want, but place this at the end of the program. You will need to redraw the circle based on u,v. This gives a vertical line which is what I think should happen, that is, the z projection will be directly under the x,y,z point.

!choose x,y in the function range for example

x = 2

y = -3

! if u = y - x/2 and v = -x/2 then

let u = y-x/2

let v = -x/2

set color "red"

plot y-x/2,f(x,y)-x/2

plot u,v

plot lines: y-x/2,f(x,y)-x/2; u,v

rwt

## halo ,thanks a lot rtarara

halo ,thanks a lot rtarara