Re: [Pipmak-Users] Autocubic: my reply to C.Walther
Status: Alpha
Brought to you by:
cwalther
From: Andrea V. <and...@gm...> - 2007-04-10 15:45:32
|
Hi Christian, > If you'd like to help make this happen, could you propose a > specification of how you'd imagine this to work? What methods or > parameters would be added, and what would they exactly do? I've tried to image how could be the methods that could permit to collocate corners of a patch in the space and also rotate it So we I have make this theory: 1) We have to put 4 points (everyone with 3 coordinates) in a 3D space. 2) These points must lie on the same plane arbitrary oriented in the space, otherwise patch will be deformed in a not-plane surface that I think become difficult to manage. 3) The point 0,0,0 is collocated at center of the cube and in this point is collocated the view point (my eyes...) 4) Where is it placed the face number 1 of my cube? (I'm refer to figure 2 on page 10 of your doc) face 1 (azimuth=0) : x0=-k/2,y0=+k/2,z0=+k/2 x1=+k/2,y1=+k/2,z1=+k/2 x2=-k/2,y2=+k/2,z2=-k/2 x3=+k/2,y3=+k/2,z3=-k/2 but which is the value of k? I cannot determine this value...if I use an image that covers completely the face 1, and this patch has dimensions 512x512, k could be 512, but if I use an image 300x300, k could be 300.... Therefore, or I set the value of "k", or I have to normalize the coordinates respect k which is the dimension of my cube. Now you use azimuth/elevation/width/height to specify some area (like handle), we could add the zenith to specify points and area in the 3D space, but I think this would be a little complex to manage from the Users point of view, I think that would be more simplex to use the normalized coordinates. Using normalized coordinates, the method that could permit to place a patch in the 3D space would be something like: patch { nx=nx ny=ny nz=nz nw=nw nh=nh thetax=tx thetaz=tz angle=angle image=image [visible=visible] .... } where nx,ny,nz are the normalized coordinates of the location in the space of the upper-left corner of the image and this is the starting point of the drawing of the patch. nw,nh are the normalized dimensions of the image (respect k) thetax,thetaz are the angles of the plane on which the patch lies along axis x,z and respect axis z,x (are sufficient 2 angles), these angles are expressed in radiants angle is the rotation angle (expressed in radiants) of the patch respect the line orthogonal to the plane on which the four corners lie and centered in the normalized point specified with nx,ny,nz (upper-left corner) so if nx0,ny0,nz0 is the point of the upper-left corner of the patch and nx1,ny1,nz1 is the point of lower-right corner of the patch: nx1=nx0+nw*cos(thetaz) ny1=ny0+nw*sin(thetaz)-nh*sin(thetax) nz1=nz0-nh*cos(thetax) (I have set angle=0 in this formula, because the full formula is more complex...) some cases: nx=1 identified the plane which lie the face1 of the cube nx=-1 identified the plane which lie the face3 of the cube ny=1 identified the plane which lie the face2 of the cube ny=-1 identified the plane which lie the face4 of the cube nz=1 identified the plane which lie the face5 of the cube nz=-1 identified the plane which lie the face6 of the cube some example: patch { nx=-0.5,ny=0.5,nz=0.5, nw=1,nh=1, thetax=0,thetaz=0, image=f.png } this put an image that fully cover face1 notice that nw=1 and nh=1 stretch the image to full cover the cube face nw=0.5 and nh=0.5 will put an image that cover just one quadrant of the face. the lower-right corner is placed on nx=0.5,ny=0.5,nz=-0.5 patch { nx=0.5,ny=0.5,nz=-0.5, nw=1,nh=1, thetax=0,thetaz=0, angle=pi, image=f.png } this put the same image turned upside down notice that the upper-left corner of the patch is placed on the lower-right corner of the face1 patch { nx=-0.5,ny=1,nz=0.5, nw=1,nh=1, thetax=0, thetaz=0, image=f.png } this put an image centered in the middle of the face1 which is the projection of a square parallel to face1 but double distant. patch { nx=-0.5,ny=-0.5,nz=0.5, nw=1,nh=1, thetax=0,thetaz=pi/2, image=f.png } this put an image that fully cover the face6 patch { nx=-0.5,ny=0.5,nz=0.5, nw=1,nh=1, thetax=0,thetaz=pi/2, image=f.png } this put a patch parallel to face6, but I can see his projection on face1 as a trapezium of course I could have also the method: patch:moveto(nx,ny,nz, thetax,thetaz, angle) so patch:moveto(0,0,0,0,0,pi/2) rotate the image of 90° respect the upper-left corner if you want rotate a patch placed on face1 respect his center, I have to rotate and translate the patch patch:moveto(0,0,-nh,0,0,pi/2). I'm not analize all the aspect of these methods, I'm little perplexed about normalization of w and h, but we could use original size (in pixels) of the patch if we don't know the dimension in pixel of the cube (which could be whichever value because it's a projection) I don't know if this is the best and the simplex method to do this, but it's a starting point to start a discussion about it. What do you think about? Bye. Andrea |