Problem in gp_Dir Rotated

I am writing my app in Java and using opencascade through JNI. When I call gp_Dir::Rotated in the following code, the application get crashed:

// find axis of rotation by finding the cross product of surfaceNormal and otherSurfaceNormal
// alternativly it would be a vector along the common edge of both faces

//a x b = (a2b3 - a3b2) i + (a3b1 - a1b3) j + (a1b2 - a2b1) k
// Crossed was crashing so doing a manual cross product
double[] rotationAxisDoubles = new double[3];//surfaceNormal.Crossed(otherSurfaceNormalDoubles);

rotationAxisDoubles[0] = (surfaceNormalDoubles[1]*otherSurfaceNormalDoubles[2]) -
(surfaceNormalDoubles[2]*otherSurfaceNormalDoubles[1]);

rotationAxisDoubles[1] = (surfaceNormalDoubles[2]*otherSurfaceNormalDoubles[0]) -
(surfaceNormalDoubles[0]*otherSurfaceNormalDoubles[2]);

rotationAxisDoubles[2] = (surfaceNormalDoubles[0]*otherSurfaceNormalDoubles[1]) -
(surfaceNormalDoubles[1]*otherSurfaceNormalDoubles[0]);

// rotate surfaceNormal and otherSurfaceNormal on the above found axis of rotation by 90 degrees
// store the result into rotatedSurfaceNormal1 and rotatedOtherSurfaceNormal1
double PI = 3.1415926535897932384626433832795;

double[] rotatedSurfaceNormal1 = surfaceNormal.Rotated(rotationAxisDoubles, PI/2);

Any idea what is going wrong?

yasir.ibrahim's picture

Sorry, my mistake, converting gp_Ax1 in java replace it with and double[6] where I was using a double[3].

Sorry for inconvenience guys. :)