Monday, 15 September 2014

actionscript 3 - Could someone explain me w.r.t. coordinates -



actionscript 3 - Could someone explain me w.r.t. coordinates -

could please explain me w.r.t. coordinates? or @ to the lowest degree direct me place explains are? i've beingness searching 2 days or , found tutorials on how used not or wrt stand for.

these tutorials take assumption know stressful because i've never heard of them.

i'm working in as3 trying parametric surfaces using pixel particles , understand these kind of useful while moving particles around.

this relevant function used u,v , w, p single particle contains xyz values not beingness modified.

function onenter(evt:event):void { dphi = 0.015*math.cos(gettimer()*0.000132); dtheta = 0.017*math.cos(gettimer()*0.000244); phi = (phi + dphi) % pi2; theta = (theta + dtheta) % pi2; cost = math.cos(theta); sint = math.sin(theta); cosp = math.cos(phi); sinp = math.sin(phi); //we calculate of rotation matrix entries here increased efficiency: m11 = cost*sinp; m12 = sint*sinp; m31 = -cost*cosp; m32 = -sint*cosp; p = firstparticle; //////// redrawing //////// displaybitmapdata.lock(); //apply filters pre-update displaybitmapdata.colortransform(displaybitmapdata.rect,darken); displaybitmapdata.applyfilter(displaybitmapdata, displaybitmapdata.rect, origin, blur); p = firstparticle; { //calculate rotated coordinates p.u = m11*p.x + m12*p.y + cosp*p.z; p.v = -sint*p.x + cost*p.y; p.w = m31*p.x + m32*p.y + sinp*p.z; //calculate viewplane projection coordinates m = flen/(flen - p.u); p.projx = p.v*m + projcenterx; p.projy = p.w*m + projcentery; if ((p.projx > displaywidth)||(p.projx<0)||(p.projy<0)||(p.projy>displayheight)||(p.u>umax)) { p.onscreen = false; } else { p.onscreen = true; } if (p.onscreen) { //we read color in position place particle: readcolor = displaybitmapdata.getpixel(p.projx, p.projy); //we take bluish value of color represent current brightness in position, //then increment brightness levelinc. level = (readcolor & 0xff)+levelinc; //we create sure 'level' stays smaller 255: level = (level > 255) ? 255 : level; /* create lite bluish pixels trick: reddish component zero, bluish component 'level', , greenish component 50% of bluish value. split 'level' in half using fast technique: bit-shift operation of shifting downwards 1 bit accomplishes same thing dividing 2 (for integer output). */ //dcolor = ((level>>1) << 8) | level; dcolor = (level << 16) | (level << 8) | level; displaybitmapdata.setpixel(p.projx, p.projy, dcolor); } p = p.next; } while (p != null) displaybitmapdata.unlock();

}

this illustration i'm using http://www.flashandmath.com/flashcs4/light/ kinda understand how used don't why.

thanks in advance.

pd: kind of surprised there not tag related it.

in particle3d.as class linked, have:

//coords wrt viewpoint axes public var u:number; public var v:number; public var w:number;

from code illustration posted question becomes clear coords wrt viewpoint axes means coordinates respect viewpoint axes, since code doing .

what doing camera (or viewing) transformation, particle's world coordinates (x,y,z) transformed world coordinate scheme coordinates in photographic camera (or view) coordinate scheme (u,v,w).

(x,y,z) coordinates of particle in world coordinate system

(u,v,w) coordinates of particle in camera coordinate system

for example, world coordinate scheme might have origin @ (0,0,0) photographic camera positioned @ (5,3,6) lookat vector of (1,0,0) , vector of (0,1,0).

actionscript-3 coordinates

No comments:

Post a Comment