Le 10/11/2011 19:58, Jan Kotek a écrit :
> Hi,

Hi Jan,

> 
> I am working on an astronomical image library which stitches spherical
> images together.
> Basically it involves lot of 3D vector rotation and other transforms.
> 
> I can not afford to create new Vector3D instance for each pixel, as it
> severely degrades performance.
> So I am reusing double[3] arrays to represent vectors.
> 
> So please could you add this method to Rotation class?

Done in subversion repository as of r1200545.

> 
> 
> *  /** Apply the rotation to a vector stored in an array.*
> *   * It is more efficient, **as new instance does not have to be created
> for each rotation*
> *   **
> *   * @param in an array with three items which stores vector to rotate*
> *   * @param out an array with three items to put result to*
> *   */*
> *  public void applyTo(double[] in, double[] out) {*
> *
> *
> *    double x = in[0];*
> *    double y = in[1];*
> *    double z = in[2];*
> *
> *
> *    double s = q1 * x + q2 * y + q3 * z;*
> *
> *
> *    out[0] = 2 * (q0 * (x * q0 - (q2 * z - q3 * y)) + s * q1) - x;*
> *    out[1] = 2 * (q0 * (y * q0 - (q3 * x - q1 * z)) + s * q2) - y;*
> *    out[2] = 2 * (q0 * (z * q0 - (q1 * y - q2 * x)) + s * q3) - z;*
> *  }*
> 
> 
> Also it would be nice to have method '.toArray' and static '.fromArray' on
> Vector3D

Done in subversion repository as of r1200546, with a slight change:
instead of a static fromArray method, I have set up a constructor.
Similar constructor/getter have also been added to Vector2D.

Thanks for the suggestions.
Luc

> 
> Regards,
> Jan
> 
> http://github.com/jankotek/asterope
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to