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

Extend 3c transforms #516

Merged
merged 8 commits into from
Feb 27, 2024
12 changes: 8 additions & 4 deletions cxx/src/lib/seismic/CoreSeismogram.cc
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,11 @@ void CoreSeismogram::rotate(const double nu[3])
/* simplified procedure to rotate only zonal angle by phi radians.
Similar to above but using only azimuth angle AND doing a simple
rotation in the horizontal plane. Efficient algorithm only
alters 0 and 1 components. */
alters 0 and 1 components.

Note sign is spherical coordinate form with phi positive anticlockwise.
Sign in rotate with spherical coordinate is different because phi is
converted to azimuth. Note that is just the sign of b in the code.*/
void CoreSeismogram::rotate(double phi)
{
if( (u.size()[1]<=0) || dead()) return; // do nothing in these situations
Expand All @@ -631,17 +635,17 @@ void CoreSeismogram::rotate(double phi)
b=sin(phi);
double tmnew[3][3];
tmnew[0][0] = a;
tmnew[1][0] = b;
tmnew[1][0] = -b;
tmnew[2][0] = 0.0;
tmnew[0][1] = -b;
tmnew[0][1] = b;
tmnew[1][1] = a;
tmnew[2][1] = 0.0;
tmnew[0][2] = 0.0;
tmnew[1][2] = 0.0;
tmnew[2][2] = 1.0;

/* Now multiply the data by this transformation matrix.
Not trick in this i only goes to 2 because 3 component
Note trick in this i only goes to 2 because 3 component
is an identity.*/
double *work[2];
for(i=0; i<2; ++i)work[i] = new double[nsamp];
Expand Down
2 changes: 1 addition & 1 deletion cxx/test/tcs/test_tcs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ int main(int argc, char **argv)
vt3[0]=0.0; vt3[1]=0.0; vt3[2]=1.0;
assert(is_close(s3.u,3,vt3));
cout << "Testing multiple, accumulated transformations" << endl;
s3.rotate(M_PI_4);
s3.rotate(-M_PI_4);
s3.transform(a);
cout << "Accumulated transformation matrix from double transformation"
<<endl;
Expand Down
Loading
Loading