Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add argument to rotate to allow user to decide rotation direction #41

Closed
NicolasRannou opened this issue May 24, 2016 · 0 comments
Closed

Comments

@NicolasRannou
Copy link
Member

https://github.com/FNNDSC/ami/blob/master/src/cameras/cameras.orthographic.js

camera.rotate(); // clockwise
camera.rotate(-1); // counter clock-wise

in cameras.ortho

  rotate( clockwise=1) {
    this.center();

    // Pi/2 rotation if camera is positions at the front of the volume
    // else -Pi/2 rotation
    let invertClock = 1;
    if(this.position.distanceTo(this._back) < this.position.distanceTo(this._front)){
      invertClock = -1;
    }

    // Rotate the up vector around the "zCosine"
    let rotation = new THREE.Matrix4().makeRotationAxis(
      this._zCosine, 
      clockwise * invertClock * Math.PI/2);
    this.up.applyMatrix4(rotation);

    this._updateMatrices();
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant