diff --git a/src/potential/gmtgravmag3d.c b/src/potential/gmtgravmag3d.c index fabd64a7e9a..36124ab9e6b 100644 --- a/src/potential/gmtgravmag3d.c +++ b/src/potential/gmtgravmag3d.c @@ -333,7 +333,7 @@ static int parse(struct GMT_CTRL *GMT, struct GMTGRAVMAG3D_CTRL *Ctrl, struct GM if (n_par < 8) Ctrl->M.params[BELL][nBELL][7] = Ctrl->npts_circ; if (n_par < 9) Ctrl->M.params[BELL][nBELL][8] = Ctrl->n_slices; if (Ctrl->M.params[BELL][nBELL][6] || Ctrl->M.params[SPHERE][nSPHERE][7] <= 0 || Ctrl->M.params[SPHERE][nSPHERE][8] <= 0) { - GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'bell' body. Please, RTFM (read the manual)."); + GMT_Report(API, GMT_MSG_ERROR, "Bad parameters for the 'bell' body. Please, read the manual."); return GMT_PARSE_ERROR; } Ctrl->M.type[BELL][nBELL] = BELL; @@ -344,7 +344,7 @@ static int parse(struct GMT_CTRL *GMT, struct GMTGRAVMAG3D_CTRL *Ctrl, struct GM if (n_par < 3) err_npar = 1; if (n_par < 6) Ctrl->M.params[CYLINDER][nCIL][5] = Ctrl->npts_circ; if (Ctrl->M.params[SPHERE][nSPHERE][5] <= 0) { - GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'cylinder' body. Please, RTFM (read the manual)."); + GMT_Report(API, GMT_MSG_ERROR, "Bad parameters for the 'cylinder' body. Please, read the manual."); return GMT_PARSE_ERROR; } Ctrl->M.type[CYLINDER][nCIL] = CYLINDER; @@ -362,8 +362,8 @@ static int parse(struct GMT_CTRL *GMT, struct GMTGRAVMAG3D_CTRL *Ctrl, struct GM if (n_par < 4) err_npar = 1; if (n_par < 7) Ctrl->M.params[ELLIPSOID][nELL][6] = Ctrl->npts_circ; if (n_par < 8) Ctrl->M.params[ELLIPSOID][nELL][7] = Ctrl->n_slices; - if (Ctrl->M.params[SPHERE][nSPHERE][6] <= 0 || Ctrl->M.params[SPHERE][nSPHERE][7] <= 0) { - GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'ellipsoid' body. Please, RTFM (read the manual)."); + if (Ctrl->M.params[ELLIPSOID][nELL][6] <= 0 || Ctrl->M.params[ELLIPSOID][nELL][7] <= 0) { + GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'ellipsoid' body. Please, read the manual."); return GMT_PARSE_ERROR; } Ctrl->M.type[ELLIPSOID][nELL] = ELLIPSOID; @@ -387,7 +387,7 @@ static int parse(struct GMT_CTRL *GMT, struct GMTGRAVMAG3D_CTRL *Ctrl, struct GM if (n_par < 5) Ctrl->M.params[SPHERE][nSPHERE][4] = Ctrl->npts_circ; if (n_par < 6) Ctrl->M.params[SPHERE][nSPHERE][5] = Ctrl->n_slices; if (Ctrl->M.params[SPHERE][nSPHERE][4] <= 0 || Ctrl->M.params[SPHERE][nSPHERE][5] <= 0) { - GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'sphere' body. Please, RTFM (read the manual)."); + GMT_Report (API, GMT_MSG_ERROR, "Bad parameters for the 'sphere' body. Please, read the manual."); return GMT_PARSE_ERROR; } Ctrl->M.type[SPHERE][nSPHERE] = SPHERE; diff --git a/src/potential/solids.c b/src/potential/solids.c index fb9537ae5ba..4a2f43b6fbb 100644 --- a/src/potential/solids.c +++ b/src/potential/solids.c @@ -143,6 +143,14 @@ int five_psoid(struct GMT_CTRL *GMT, struct GMTGRAVMAG3D_CTRL *Ctrl, int body_ty a = Ctrl->M.params[body_type][nb][0]; b = Ctrl->M.params[body_type][nb][1]; c = Ctrl->M.params[body_type][nb][2]; z_c = Ctrl->M.params[body_type][nb][3]; x0 = Ctrl->M.params[body_type][nb][4]; y0 = Ctrl->M.params[body_type][nb][5]; + if (body_type == SPHERE) { /* This has less parameters so the above is wrong. */ + b = c = a; z_c = Ctrl->M.params[body_type][nb][1]; + x0 = Ctrl->M.params[body_type][nb][2]; y0 = Ctrl->M.params[body_type][nb][3]; + } + if (body_type == BELL) { + a = b; b = c; c = Ctrl->M.params[body_type][nb][0]; + } + z_top = z_c + c; z_bot = z_c; n_tri = (hemi) ? 2 * npts_circ * n_slices : 2 * (npts_circ * (n_slices*2 - 1));