Skip to content

Commit

Permalink
Fold pscale into per-primitive files
Browse files Browse the repository at this point in the history
  • Loading branch information
starseeker committed Jan 3, 2025
1 parent 524760a commit 6dfd26e
Show file tree
Hide file tree
Showing 31 changed files with 475 additions and 269 deletions.
190 changes: 0 additions & 190 deletions src/mged/edsol.c
Original file line number Diff line number Diff line change
Expand Up @@ -453,189 +453,6 @@ get_file_name(struct mged_state *s, char *str)
return (char *)NULL;
}



/*
* Partial scaling of a solid.
*/
void
pscale(struct mged_state *s)
{
switch (es_menu) {

case MENU_VOL_CSIZE:
menu_vol_csize(s);
break;
case MENU_TGC_SCALE_H:
menu_tgc_scale_h(s);
break;
case MENU_TGC_SCALE_H_V:
menu_tgc_scale_h_v(s);
break;
case MENU_TGC_SCALE_H_CD:
menu_tgc_scale_h_cd(s);
break;
case MENU_TGC_SCALE_H_V_AB:
menu_tgc_scale_h_v_ab(s);
break;
case MENU_TOR_R1:
menu_tor_r1(s);
break;
case MENU_TOR_R2:
menu_tor_r2(s);
break;
case MENU_ETO_R:
menu_eto_r(s);
break;
case MENU_ETO_RD:
menu_eto_rd(s);
break;
case MENU_ETO_SCALE_C:
menu_eto_scale_c(s);
break;
case MENU_RPC_B:
menu_rpc_b(s);
break;
case MENU_RPC_H:
menu_rpc_h(s);
break;
case MENU_RPC_R:
menu_rpc_r(s);
break;
case MENU_RHC_B:
menu_rhc_b(s);
break;
case MENU_RHC_H:
menu_rhc_h(s);
break;
case MENU_RHC_R:
menu_rhc_r(s);
break;
case MENU_RHC_C:
menu_rhc_c(s);
break;
case MENU_EPA_H:
menu_epa_h(s);
break;
case MENU_EPA_R1:
menu_epa_r1(s);
break;
case MENU_EPA_R2:
menu_epa_r2(s);
break;
case MENU_EHY_H:
menu_ehy_h(s);
break;
case MENU_EHY_R1:
menu_ehy_r1(s);
break;
case MENU_EHY_R2:
menu_ehy_r2(s);
break;
case MENU_EHY_C:
menu_ehy_c(s);
break;
case MENU_HYP_H:
menu_hyp_h(s);
break;
case MENU_HYP_SCALE_A:
menu_hyp_scale_a(s);
break;
case MENU_HYP_SCALE_B:
menu_hyp_scale_b(s);
break;
case MENU_HYP_C:
menu_hyp_c(s);
break;
case MENU_TGC_SCALE_A:
menu_tgc_scale_a(s);
break;
case MENU_TGC_SCALE_B:
menu_tgc_scale_b(s);
break;
case MENU_ELL_SCALE_A:
menu_ell_scale_a(s);
break;
case MENU_ELL_SCALE_B:
menu_ell_scale_b(s);
break;
case MENU_ELL_SCALE_C:
menu_ell_scale_c(s);
break;
case MENU_TGC_SCALE_C:
menu_tgc_scale_c(s);
break;
case MENU_TGC_SCALE_D:
menu_tgc_scale_d(s);
break;
case MENU_TGC_SCALE_AB:
menu_tgc_scale_ab(s);
break;
case MENU_TGC_SCALE_CD:
menu_tgc_scale_cd(s);
break;
case MENU_TGC_SCALE_ABCD:
menu_tgc_scale_abcd(s);
break;
case MENU_ELL_SCALE_ABC:
menu_ell_scale_abc(s);
break;
/* begin super ellipse menu options */
case MENU_SUPERELL_SCALE_A:
menu_superell_scale_a(s);
break;
case MENU_SUPERELL_SCALE_B:
menu_superell_scale_b(s);
break;
case MENU_SUPERELL_SCALE_C:
menu_superell_scale_c(s);
break;
case MENU_SUPERELL_SCALE_ABC:
menu_superell_scale_abc(s);
break;
case MENU_PIPE_PT_OD: /* scale OD of one pipe segment */
menu_pipe_pt_od(s);
break;
case MENU_PIPE_PT_ID: /* scale ID of one pipe segment */
menu_pipe_pt_od(s);
break;
case MENU_PIPE_PT_RADIUS: /* scale bend radius at selected point */
menu_pipe_pt_radius(s);
break;
case MENU_PIPE_SCALE_OD: /* scale entire pipe OD */
menu_pipe_scale_od(s);
break;
case MENU_PIPE_SCALE_ID: /* scale entire pipe ID */
menu_pipe_scale_id(s);
break;
case MENU_PIPE_SCALE_RADIUS: /* scale entire pipr bend radius */
menu_pipe_scale_radius(s);
break;
case MENU_PART_H:
menu_part_h(s);
break;
case MENU_PART_v:
menu_part_v(s);
break;
case MENU_PART_h:
menu_part_h_end_r(s);
break;
case MENU_METABALL_SET_THRESHOLD:
menu_metaball_set_threshold(s);
break;
case MENU_METABALL_SET_METHOD:
menu_metaball_set_method(s);
break;
case MENU_METABALL_PT_SET_GOO:
menu_metaball_pt_set_goo(s);
break;
case MENU_METABALL_PT_FLDSTR:
menu_metaball_pt_fldstr(s);
break;
}
}


/*
* A great deal of magic takes place here, to accomplish solid editing.
*
Expand Down Expand Up @@ -678,13 +495,6 @@ sedit(struct mged_state *s)
/* do nothing more */
--update_views;
break;
case PSCALE:
es_eu = (struct edgeuse *)NULL; /* Reset es_eu */
bot_verts[0] = -1;
bot_verts[1] = -1;
bot_verts[2] = -1;
pscale(s);
break;
default:
{
if (had_method)
Expand Down
2 changes: 1 addition & 1 deletion src/mged/primitives/eddatum.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ mged_datum_read_params(
} else {
first_line = 0;
}

if (bu_strncasecmp(lc, "point", strlen("point")) == 0) {
sscanf(lc, "%lf %lf %lf", &a, &b, &c);
VSET(datum->pnt, a, b, c);
Expand Down
42 changes: 42 additions & 0 deletions src/mged/primitives/edehy.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,48 @@ menu_ehy_c(struct mged_state *s)
ehy->ehy_c *= s->edit_state.es_scale;
}

static void
mged_ehy_pscale(struct mged_state *s, int mode)
{
switch (mode) {
case MENU_EHY_H:
menu_ehy_h(s);
break;
case MENU_EHY_R1:
menu_ehy_r1(s);
break;
case MENU_EHY_R2:
menu_ehy_r2(s);
break;
case MENU_EHY_C:
menu_ehy_c(s);
break;
};
}

int
mged_ehy_edit(struct mged_state *s, int edflag)
{
switch (edflag) {
case SSCALE:
/* scale the solid uniformly about its vertex point */
mged_generic_sscale(s, &s->edit_state.es_int);
break;
case STRANS:
/* translate solid */
mged_generic_strans(s, &s->edit_state.es_int);
break;
case SROT:
/* rot solid about vertex */
mged_generic_srot(s, &s->edit_state.es_int);
break;
case PSCALE:
mged_ehy_pscale(s, es_menu);
break;
}
return 0;
}

/*
* Local Variables:
* mode: C
Expand Down
5 changes: 0 additions & 5 deletions src/mged/primitives/edehy.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
#define MENU_EHY_R2 55
#define MENU_EHY_C 56

void menu_ehy_h(struct mged_state *s);
void menu_ehy_r1(struct mged_state *s);
void menu_ehy_r2(struct mged_state *s);
void menu_ehy_c(struct mged_state *s);

#endif /* EDEHY_H */

/*
Expand Down
42 changes: 42 additions & 0 deletions src/mged/primitives/edell.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,48 @@ menu_ell_scale_abc(struct mged_state *s)
VSCALE(ell->c, ell->c, ma/mb);
}

static void
mged_ell_pscale(struct mged_state *s, int mode)
{
switch (mode) {
case MENU_ELL_SCALE_A:
menu_ell_scale_a(s);
break;
case MENU_ELL_SCALE_B:
menu_ell_scale_b(s);
break;
case MENU_ELL_SCALE_C:
menu_ell_scale_c(s);
break;
case MENU_ELL_SCALE_ABC:
menu_ell_scale_abc(s);
break;
};
}

int
mged_ell_edit(struct mged_state *s, int edflag)
{
switch (edflag) {
case SSCALE:
/* scale the solid uniformly about its vertex point */
mged_generic_sscale(s, &s->edit_state.es_int);
break;
case STRANS:
/* translate solid */
mged_generic_strans(s, &s->edit_state.es_int);
break;
case SROT:
/* rot solid about vertex */
mged_generic_srot(s, &s->edit_state.es_int);
break;
case PSCALE:
mged_ell_pscale(s, es_menu);
break;
}
return 0;
}

/*
* Local Variables:
* mode: C
Expand Down
5 changes: 0 additions & 5 deletions src/mged/primitives/edell.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,6 @@
#define MENU_ELL_SCALE_C 41
#define MENU_ELL_SCALE_ABC 42

void menu_ell_scale_a(struct mged_state *s);
void menu_ell_scale_b(struct mged_state *s);
void menu_ell_scale_c(struct mged_state *s);
void menu_ell_scale_abc(struct mged_state *s);

#endif /* EDELL_H */

/*
Expand Down
39 changes: 39 additions & 0 deletions src/mged/primitives/edepa.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,45 @@ menu_epa_r2(struct mged_state *s)
bu_log("pscale: semi-minor axis cannot be longer than semi-major axis!");
}

static void
mged_epa_pscale(struct mged_state *s, int mode)
{
switch (mode) {
case MENU_EPA_H:
menu_epa_h(s);
break;
case MENU_EPA_R1:
menu_epa_r1(s);
break;
case MENU_EPA_R2:
menu_epa_r2(s);
break;
};
}

int
mged_epa_edit(struct mged_state *s, int edflag)
{
switch (edflag) {
case SSCALE:
/* scale the solid uniformly about its vertex point */
mged_generic_sscale(s, &s->edit_state.es_int);
break;
case STRANS:
/* translate solid */
mged_generic_strans(s, &s->edit_state.es_int);
break;
case SROT:
/* rot solid about vertex */
mged_generic_srot(s, &s->edit_state.es_int);
break;
case PSCALE:
mged_epa_pscale(s, es_menu);
break;
}
return 0;
}

/*
* Local Variables:
* mode: C
Expand Down
4 changes: 0 additions & 4 deletions src/mged/primitives/edepa.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@
#define MENU_EPA_R1 51
#define MENU_EPA_R2 52

void menu_epa_h(struct mged_state *s);
void menu_epa_r1(struct mged_state *s);
void menu_epa_r2(struct mged_state *s);

#endif /* EDEPA_H */

/*
Expand Down
Loading

0 comments on commit 6dfd26e

Please sign in to comment.