/** * ( begin auto-generated from PVector_cross.xml ) * * Calculates and returns a vector composed of the cross product between * two vectors. * * ( end auto-generated ) * * @webref pvector:method * @param v the vector to calculate the cross product * @brief Calculate and return the cross product */ public PVector cross(PVector v) { return cross(v, null); }
/** * ( begin auto-generated from PVector_cross.xml ) * * Calculates and returns a vector composed of the cross product between * two vectors. * * ( end auto-generated ) * * @webref pvector:method * @param v the vector to calculate the cross product * @brief Calculate and return the cross product */ public PVector cross(PVector v) { return cross(v, null); }
public void start( float posx, float posy, float posz, float dirx, float diry, float dirz, float upx, float upy, float upz) { this.pgl = app.beginPGL(); if (this.stereoType == StereoType.SIDE_BY_SIDE) { this.aspectRatio = (float) (width / 2.0f) / (float) height; } else { this.aspectRatio = (float) width / (float) height; } this.widthdiv2 = nearPlane * (float) Math.tan(this.fovy / 2); // aperture in radians this.posx = posx; this.posy = posy; this.posz = posz; this.dirx = dirx; this.diry = diry; this.dirz = dirz; this.upx = upx; this.upy = upy; this.upz = upz; PVector cdir = new PVector(this.dirx, this.diry, this.dirz); PVector cup = new PVector(this.upx, this.upy, this.upz); PVector cright = cdir.cross(cup); this.rightx = cright.x * eyeSeparation / 2.0f; this.righty = cright.y * eyeSeparation / 2.0f; this.rightz = cright.z * eyeSeparation / 2.0f; }
protected float computeRotation(Touch touch0, Touch touch1) { PVector currentDirection = PVector.sub(touch0.pposition, touch1.pposition); PVector previousDirection = PVector.sub(touch0.position, touch1.position); currentDirection.normalize(); previousDirection.normalize(); float cos = currentDirection.dot(previousDirection); float angle = acos(cos); PVector sin = currentDirection.cross(previousDirection); if (sin.z < 0) { angle = -angle; } return angle; }