-
Notifications
You must be signed in to change notification settings - Fork 348
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
3D slice at incorrect position #708
Comments
👋 Thanks for opening your first issue here! Please make sure you filled out the template with as much detail as possible. We appreciate that you took the time to contribute! Please make sure you read our Contributing Guide and abide by our Code of Conduct. |
I will take time to read the Contributing Guid and Code of Conduct, and will make a "pull request" for this issue. Here I attach the key part of code to solve this issue. GMT_LOCAL int map_init_three_D (struct GMT_CTRL *GMT) {
//...
//...
if (easy) {
double xx[4], yy[4];
xx[0] = xx[3] = GMT->current.proj.rect[XLO]; xx[1] = xx[2] = GMT->current.proj.rect[XHI];
yy[0] = yy[1] = GMT->current.proj.rect[YLO]; yy[2] = yy[3] = GMT->current.proj.rect[YHI];
// which plane in 3d projection
int plane = GMT->current.proj.z_project.view_plane;
// the offset coefficenece of transformation matrix: e and e should be keep consistent with the case of GMT_Z
switch (plane % 3) {
case GMT_X:
// -Rymin/ymax/zmin/zmax/xmin/xmax
xx[0] = xx[3] = GMT->current.proj.zmin; xx[1] = xx[2] = GMT->current.proj.zmax;
yy[0] = yy[1] = GMT->current.proj.rect[XLO]; yy[2] = yy[3] = GMT->current.proj.rect[XHI];
break;
case GMT_Y:
// -Rxmin/xmax/zmin/zmax/ymin/ymax
xx[0] = xx[3] = GMT->current.proj.rect[XLO]; xx[1] = xx[2] = GMT->current.proj.rect[XHI];
yy[0] = yy[1] = GMT->current.proj.zmin; yy[2] = yy[3] = GMT->current.proj.zmax;
break;
case GMT_Z:
// -Rxmin/xmax/ymin/ymax/zmin/zmax
xx[0] = xx[3] = GMT->current.proj.rect[XLO]; xx[1] = xx[2] = GMT->current.proj.rect[XHI];
yy[0] = yy[1] = GMT->current.proj.rect[YLO]; yy[2] = yy[3] = GMT->current.proj.rect[YHI];
break;
}
for (i = 0; i < 4; i++) {
gmt_xy_to_geo (GMT, &GMT->current.proj.z_project.corner_x[i], &GMT->current.proj.z_project.corner_y[i], xx[i], yy[i]);
gmt_xyz_to_xy (GMT, xx[i], yy[i], gmt_z_to_zz(GMT, GMT->common.R.wesn[ZLO]), &x, &y);
GMT->current.proj.z_project.xmin = MIN (GMT->current.proj.z_project.xmin, x);
GMT->current.proj.z_project.xmax = MAX (GMT->current.proj.z_project.xmax, x);
GMT->current.proj.z_project.ymin = MIN (GMT->current.proj.z_project.ymin, y);
GMT->current.proj.z_project.ymax = MAX (GMT->current.proj.z_project.ymax, y);
gmt_xyz_to_xy (GMT, xx[i], yy[i], gmt_z_to_zz(GMT, GMT->common.R.wesn[ZHI]), &x, &y);
GMT->current.proj.z_project.xmin = MIN (GMT->current.proj.z_project.xmin, x);
GMT->current.proj.z_project.xmax = MAX (GMT->current.proj.z_project.xmax, x);
GMT->current.proj.z_project.ymin = MIN (GMT->current.proj.z_project.ymin, y);
GMT->current.proj.z_project.ymax = MAX (GMT->current.proj.z_project.ymax, y);
}
}
//...
} |
What you say, @remkos ? |
This looks like a duplicate of issue #529. |
It's a complicated test (for me) to reproduce. Is it still buggy (there changes in this regard) or can we close it? |
Description of the problem
System information
The text was updated successfully, but these errors were encountered: