Revision: 76393
http://sourceforge.net/p/brlcad/code/76393
Author: starseeker
Date: 2020-07-21 18:25:56 +0000 (Tue, 21 Jul 2020)
Log Message:
-----------
scale files all pertain just to pscale - move them there
Modified Paths:
--------------
brlcad/branches/gedplugins/src/libged/CMakeLists.txt
brlcad/branches/gedplugins/src/libged/ged_private.h
brlcad/branches/gedplugins/src/libged/pscale/CMakeLists.txt
brlcad/branches/gedplugins/src/libged/pscale/pscale.c
Added Paths:
-----------
brlcad/branches/gedplugins/src/libged/pscale/pscale.h
brlcad/branches/gedplugins/src/libged/pscale/scale_ehy.c
brlcad/branches/gedplugins/src/libged/pscale/scale_ell.c
brlcad/branches/gedplugins/src/libged/pscale/scale_epa.c
brlcad/branches/gedplugins/src/libged/pscale/scale_eto.c
brlcad/branches/gedplugins/src/libged/pscale/scale_extrude.c
brlcad/branches/gedplugins/src/libged/pscale/scale_hyp.c
brlcad/branches/gedplugins/src/libged/pscale/scale_part.c
brlcad/branches/gedplugins/src/libged/pscale/scale_rhc.c
brlcad/branches/gedplugins/src/libged/pscale/scale_rpc.c
brlcad/branches/gedplugins/src/libged/pscale/scale_superell.c
brlcad/branches/gedplugins/src/libged/pscale/scale_tgc.c
brlcad/branches/gedplugins/src/libged/pscale/scale_tor.c
Removed Paths:
-------------
brlcad/branches/gedplugins/src/libged/scale_ehy.c
brlcad/branches/gedplugins/src/libged/scale_ell.c
brlcad/branches/gedplugins/src/libged/scale_epa.c
brlcad/branches/gedplugins/src/libged/scale_eto.c
brlcad/branches/gedplugins/src/libged/scale_extrude.c
brlcad/branches/gedplugins/src/libged/scale_hyp.c
brlcad/branches/gedplugins/src/libged/scale_part.c
brlcad/branches/gedplugins/src/libged/scale_rhc.c
brlcad/branches/gedplugins/src/libged/scale_rpc.c
brlcad/branches/gedplugins/src/libged/scale_superell.c
brlcad/branches/gedplugins/src/libged/scale_tgc.c
brlcad/branches/gedplugins/src/libged/scale_tor.c
Modified: brlcad/branches/gedplugins/src/libged/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/CMakeLists.txt 2020-07-21
17:17:07 UTC (rev 76392)
+++ brlcad/branches/gedplugins/src/libged/CMakeLists.txt 2020-07-21
18:25:56 UTC (rev 76393)
@@ -69,18 +69,6 @@
rotate_extrude.c
rotate_hyp.c
rotate_tgc.c
- scale_ehy.c
- scale_ell.c
- scale_epa.c
- scale_eto.c
- scale_extrude.c
- scale_hyp.c
- scale_part.c
- scale_rhc.c
- scale_rpc.c
- scale_superell.c
- scale_tgc.c
- scale_tor.c
trace.c
translate_extrude.c
translate_tgc.c
@@ -280,6 +268,18 @@
protate/protate.c
ps/ps.c
pscale/pscale.c
+ pscale/scale_ehy.c
+ pscale/scale_ell.c
+ pscale/scale_epa.c
+ pscale/scale_eto.c
+ pscale/scale_extrude.c
+ pscale/scale_hyp.c
+ pscale/scale_part.c
+ pscale/scale_rhc.c
+ pscale/scale_rpc.c
+ pscale/scale_superell.c
+ pscale/scale_tgc.c
+ pscale/scale_tor.c
pset/pset.c
ptranslate/ptranslate.c
pull/pull.c
@@ -436,6 +436,7 @@
ged_private.h
joint/joint.h
osg.cpp
+ pscale/pscale.h
pnts_util.h
qray.h
simulate/NOTES
Modified: brlcad/branches/gedplugins/src/libged/ged_private.h
===================================================================
--- brlcad/branches/gedplugins/src/libged/ged_private.h 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/ged_private.h 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -380,48 +380,6 @@
const char *attribute,
matp_t rmat);
-/* defined in scale_ehy.c */
-GED_EXPORT extern int _ged_scale_ehy(struct ged *gedp,
- struct rt_ehy_internal *ehy,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
-/* defined in scale_ell.c */
-GED_EXPORT extern int _ged_scale_ell(struct ged *gedp,
- struct rt_ell_internal *ell,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
-/* defined in scale_epa.c */
-GED_EXPORT extern int _ged_scale_epa(struct ged *gedp,
- struct rt_epa_internal *epa,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
-/* defined in scale_eto.c */
-GED_EXPORT extern int _ged_scale_eto(struct ged *gedp,
- struct rt_eto_internal *eto,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
-/* defined in scale_extrude.c */
-GED_EXPORT extern int _ged_scale_extrude(struct ged *gedp,
- struct rt_extrude_internal *extrude,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
-/* defined in scale_hyp.c */
-GED_EXPORT extern int _ged_scale_hyp(struct ged *gedp,
- struct rt_hyp_internal *hyp,
- const char *attribute,
- fastf_t sf,
- int rflag);
-
/* defined in edit_metaball.c */
GED_EXPORT extern int _ged_scale_metaball(struct ged *gedp,
struct rt_metaball_internal *mbip,
Modified: brlcad/branches/gedplugins/src/libged/pscale/CMakeLists.txt
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/CMakeLists.txt 2020-07-21
17:17:07 UTC (rev 76392)
+++ brlcad/branches/gedplugins/src/libged/pscale/CMakeLists.txt 2020-07-21
18:25:56 UTC (rev 76393)
@@ -6,11 +6,27 @@
${GED_INCLUDE_DIRS}
)
+set(PSCALE_SRCS
+ pscale.c
+ scale_ehy.c
+ scale_ell.c
+ scale_epa.c
+ scale_eto.c
+ scale_extrude.c
+ scale_hyp.c
+ scale_part.c
+ scale_rhc.c
+ scale_rpc.c
+ scale_superell.c
+ scale_tgc.c
+ scale_tor.c
+ )
+
add_definitions(-DGED_PLUGIN)
-add_library(ged-pscale SHARED pscale.c)
+add_library(ged-pscale SHARED ${PSCALE_SRCS})
target_link_libraries(ged-pscale libged libbu)
set_property(TARGET ged-pscale APPEND PROPERTY COMPILE_DEFINITIONS BRLCADBUILD
HAVE_CONFIG_H)
-VALIDATE_STYLE(ged-pscale pscale.c)
+VALIDATE_STYLE(ged-pscale ${PSCALE_SRCS})
PLUGIN_SETUP(ged-pscale ged)
# Local Variables:
@@ -19,3 +35,4 @@
# indent-tabs-mode: t
# End:
# ex: shiftwidth=2 tabstop=8
+
Modified: brlcad/branches/gedplugins/src/libged/pscale/pscale.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/pscale.c 2020-07-21
17:17:07 UTC (rev 76392)
+++ brlcad/branches/gedplugins/src/libged/pscale/pscale.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -31,8 +31,8 @@
#include "raytrace.h"
#include "../ged_private.h"
+#include "./pscale.h"
-
int
ged_pscale(struct ged *gedp, int argc, const char *argv[])
{
Added: brlcad/branches/gedplugins/src/libged/pscale/pscale.h
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/pscale.h
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/pscale.h 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,90 @@
+/* P S C A L E . H
+ * BRL-CAD
+ *
+ * Copyright (c) 2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file pscale.h
+ *
+ * Brief description
+ *
+ */
+
+#ifndef GED_PSCALE_H
+#define GED_PSCALE_H
+
+#include "common.h"
+
+#include "ged.h"
+
+__BEGIN_DECLS
+
+/* defined in scale_ehy.c */
+GED_EXPORT extern int _ged_scale_ehy(struct ged *gedp,
+ struct rt_ehy_internal *ehy,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+/* defined in scale_ell.c */
+GED_EXPORT extern int _ged_scale_ell(struct ged *gedp,
+ struct rt_ell_internal *ell,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+/* defined in scale_epa.c */
+GED_EXPORT extern int _ged_scale_epa(struct ged *gedp,
+ struct rt_epa_internal *epa,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+/* defined in scale_eto.c */
+GED_EXPORT extern int _ged_scale_eto(struct ged *gedp,
+ struct rt_eto_internal *eto,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+/* defined in scale_extrude.c */
+GED_EXPORT extern int _ged_scale_extrude(struct ged *gedp,
+ struct rt_extrude_internal *extrude,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+/* defined in scale_hyp.c */
+GED_EXPORT extern int _ged_scale_hyp(struct ged *gedp,
+ struct rt_hyp_internal *hyp,
+ const char *attribute,
+ fastf_t sf,
+ int rflag);
+
+__END_DECLS
+
+#endif /* LIBGED_GED_PRIVATE_H */
+
+/** @} */
+/*
+ * Local Variables:
+ * mode: C
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Property changes on: brlcad/branches/gedplugins/src/libged/pscale/pscale.h
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_ehy.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_ehy.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_ehy.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_ehy.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,95 @@
+/* S C A L E _ E H Y . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_ehy.c
+ *
+ * The scale_ehy command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_ehy(struct ged *gedp, struct rt_ehy_internal *ehy, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t newrad;
+
+ RT_EHY_CK_MAGIC(ehy);
+
+ switch (attribute[0]) {
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(ehy->ehy_H);
+
+ VSCALE(ehy->ehy_H, ehy->ehy_H, sf);
+ break;
+ case 'a':
+ case 'A':
+ if (rflag)
+ newrad = ehy->ehy_r1 * sf;
+ else
+ newrad = sf;
+
+ if (newrad >= ehy->ehy_r2)
+ ehy->ehy_r1 = newrad;
+ break;
+ case 'b':
+ case 'B':
+ if (rflag)
+ newrad = ehy->ehy_r2 * sf;
+ else
+ newrad = sf;
+
+ if (newrad <= ehy->ehy_r1)
+ ehy->ehy_r2 = newrad;
+ break;
+ case 'c':
+ case 'C':
+ if (rflag)
+ ehy->ehy_c *= sf;
+ else
+ ehy->ehy_c = sf;
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad ehy attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_ell.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_ell.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_ell.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_ell.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,106 @@
+/* S C A L E _ E L L . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_ell.c
+ *
+ * The scale_ell command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_ell(struct ged *gedp, struct rt_ell_internal *ell, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t ma, mb;
+
+ RT_ELL_CK_MAGIC(ell);
+
+ switch (attribute[0]) {
+ case 'a':
+ case 'A':
+ if (!rflag)
+ sf /= MAGNITUDE(ell->a);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(ell->a, ell->a, sf);
+ break;
+ case 'b':
+ case 'B':
+ if ((attribute[2] == 'c' || attribute[2] == 'C') &&
+ attribute[3] == '\0') {
+ /* set A, B, and C lengths the same */
+ VSCALE(ell->a, ell->a, sf);
+ ma = MAGNITUDE(ell->a);
+ mb = MAGNITUDE(ell->b);
+ VSCALE(ell->b, ell->b, ma/mb);
+ mb = MAGNITUDE(ell->c);
+ VSCALE(ell->c, ell->c, ma/mb);
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "bad ell attribute
- %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad ell attribute -
%s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ case 'b':
+ case 'B':
+ if (!rflag)
+ sf /= MAGNITUDE(ell->b);
+
+ VSCALE(ell->b, ell->b, sf);
+ break;
+ case 'c':
+ case 'C':
+ if (!rflag)
+ sf /= MAGNITUDE(ell->c);
+
+ VSCALE(ell->c, ell->c, sf);
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad ell attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_epa.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_epa.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_epa.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_epa.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,87 @@
+/* S C A L E _ E P A . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_epa.c
+ *
+ * The scale_epa command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_epa(struct ged *gedp, struct rt_epa_internal *epa, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t newrad;
+
+ RT_EPA_CK_MAGIC(epa);
+
+ switch (attribute[0]) {
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(epa->epa_H);
+
+ VSCALE(epa->epa_H, epa->epa_H, sf);
+ break;
+ case 'a':
+ case 'A':
+ if (rflag)
+ newrad = epa->epa_r1 * sf;
+ else
+ newrad = sf;
+
+ if (newrad >= epa->epa_r2)
+ epa->epa_r1 = newrad;
+ break;
+ case 'b':
+ case 'B':
+ if (rflag)
+ newrad = epa->epa_r2 * sf;
+ else
+ newrad = sf;
+
+ if (newrad <= epa->epa_r1)
+ epa->epa_r2 = newrad;
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad epa attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_eto.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_eto.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_eto.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_eto.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,132 @@
+/* S C A L E _ E T O . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_eto.c
+ *
+ * The scale_eto command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+
+int
+_ged_scale_eto(struct ged *gedp, struct rt_eto_internal *eto, const char
*attribute, fastf_t sf, int rflag)
+{
+ RT_ETO_CK_MAGIC(eto);
+
+ switch (attribute[0]) {
+ case 'r':
+ case 'R': {
+ fastf_t ch, cv, dh, newrad;
+ vect_t Nu;
+
+ if (rflag)
+ newrad = eto->eto_r * sf;
+ else
+ newrad = sf;
+
+ if (newrad < SMALL)
+ newrad = 4*SMALL;
+
+ VMOVE(Nu, eto->eto_N);
+ VUNITIZE(Nu);
+
+ /* get horiz and vert components of C and Rd */
+ cv = VDOT(eto->eto_C, Nu);
+ ch = sqrt(VDOT(eto->eto_C, eto->eto_C) - cv * cv);
+
+ /* angle between C and Nu */
+ dh = eto->eto_rd * cv / MAGNITUDE(eto->eto_C);
+
+ /* make sure revolved ellipse doesn't overlap itself */
+ if (ch <= newrad && dh <= newrad)
+ eto->eto_r = newrad;
+ }
+ break;
+ case 'd':
+ case 'D': {
+ fastf_t dh, newrad, work;
+ vect_t Nu;
+
+ if (rflag)
+ newrad = eto->eto_rd * sf;
+ else
+ newrad = sf;
+
+ if (newrad < SMALL)
+ newrad = 4*SMALL;
+ work = MAGNITUDE(eto->eto_C);
+ if (newrad <= work) {
+ VMOVE(Nu, eto->eto_N);
+ VUNITIZE(Nu);
+ dh = newrad * VDOT(eto->eto_C, Nu) / work;
+ /* make sure revolved ellipse doesn't overlap itself */
+ if (dh <= eto->eto_r)
+ eto->eto_rd = newrad;
+ }
+ }
+ break;
+ case 'c':
+ case 'C': {
+ fastf_t ch, cv;
+ vect_t Nu, Work;
+
+ if (!rflag)
+ sf /= MAGNITUDE(eto->eto_C);
+
+ if (sf * MAGNITUDE(eto->eto_C) >= eto->eto_rd) {
+ VMOVE(Nu, eto->eto_N);
+ VUNITIZE(Nu);
+ VSCALE(Work, eto->eto_C, sf);
+
+ /* get horiz and vert comps of C and Rd */
+ cv = VDOT(Work, Nu);
+ ch = sqrt(VDOT(Work, Work) - cv * cv);
+ if (ch <= eto->eto_r)
+ VMOVE(eto->eto_C, Work);
+ }
+ }
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad eto attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_extrude.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_extrude.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_extrude.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_extrude.c
2020-07-21 18:25:56 UTC (rev 76393)
@@ -0,0 +1,75 @@
+/* S C A L E _ E X T R U D E . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_extrude.c
+ *
+ * The scale_extrude command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+
+int
+_ged_scale_extrude(struct ged *gedp, struct rt_extrude_internal *extrude,
const char *attribute, fastf_t sf, int rflag)
+{
+ vect_t hvec;
+
+ RT_EXTRUDE_CK_MAGIC(extrude);
+
+ switch (attribute[0]) {
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(extrude->h);
+
+ VSCALE(hvec, extrude->h, sf);
+
+ /* Make sure hvec is not zero length */
+ if (MAGNITUDE(hvec) > SQRT_SMALL_FASTF) {
+ VMOVE(extrude->h, hvec);
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad extrude attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_hyp.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_hyp.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_hyp.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_hyp.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,111 @@
+/* S C A L E _ H Y P . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_hyp.c
+ *
+ * The scale_hyp command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+
+int
+_ged_scale_hyp(struct ged *gedp, struct rt_hyp_internal *hyp, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t f;
+ point_t old_top;
+
+ RT_HYP_CK_MAGIC(hyp);
+
+ switch (attribute[0]) {
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(hyp->hyp_Hi);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(hyp->hyp_Hi, hyp->hyp_Hi, sf);
+ break;
+ case 'v':
+ case 'V':
+ /* Scale H move V */
+ VADD2(old_top, hyp->hyp_Vi, hyp->hyp_Hi);
+ VSCALE(hyp->hyp_Hi, hyp->hyp_Hi, sf);
+ VSUB2(hyp->hyp_Vi, old_top, hyp->hyp_Hi);
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad hyp attribute -
%s", attribute);
+ return GED_ERROR;
+ }
+ break;
+ case 'a':
+ case 'A':
+ if (!rflag)
+ sf /= MAGNITUDE(hyp->hyp_A);
+
+ VSCALE(hyp->hyp_A, hyp->hyp_A, sf);
+ break;
+ case 'b':
+ case 'B':
+ if (rflag)
+ hyp->hyp_b *= sf;
+ else
+ hyp->hyp_b = sf;
+
+ break;
+ case 'c':
+ case 'C':
+ if (rflag)
+ f = hyp->hyp_bnr * sf;
+ else
+ f = sf;
+
+ if (f <= 1.0)
+ hyp->hyp_bnr = f;
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad hyp attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_part.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_part.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_part.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_part.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,78 @@
+/* S C A L E _ P A R T . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_part.c
+ *
+ * The scale_part command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_part(struct ged *gedp, struct rt_part_internal *part, const char
*attribute, fastf_t sf, int rflag)
+{
+ RT_PART_CK_MAGIC(part);
+
+ switch (attribute[0]) {
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(part->part_H);
+
+ VSCALE(part->part_H, part->part_H, sf);
+ break;
+ case 'v':
+ if (rflag)
+ part->part_vrad *= sf;
+ else
+ part->part_vrad = sf;
+
+ break;
+ case 'h':
+ if (rflag)
+ part->part_hrad *= sf;
+ else
+ part->part_hrad = sf;
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad part attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_rhc.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_rhc.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_rhc.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_rhc.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,88 @@
+/* S C A L E _ R H C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_rhc.c
+ *
+ * The scale_rhc command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_rhc(struct ged *gedp, struct rt_rhc_internal *rhc, const char
*attribute, fastf_t sf, int rflag)
+{
+ RT_RHC_CK_MAGIC(rhc);
+
+ switch (attribute[0]) {
+ case 'b':
+ case 'B':
+ if (!rflag)
+ sf /= MAGNITUDE(rhc->rhc_B);
+
+ VSCALE(rhc->rhc_B, rhc->rhc_B, sf);
+ break;
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(rhc->rhc_H);
+
+ VSCALE(rhc->rhc_H, rhc->rhc_H, sf);
+ break;
+ case 'c':
+ case 'C':
+ if (rflag)
+ rhc->rhc_c *= sf;
+ else
+ rhc->rhc_c = sf;
+
+ break;
+ case 'r':
+ case 'R':
+ if (rflag)
+ rhc->rhc_r *= sf;
+ else
+ rhc->rhc_r = sf;
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad rhc attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_rpc.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_rpc.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_rpc.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_rpc.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,80 @@
+/* S C A L E _ R P C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_rpc.c
+ *
+ * The scale_rpc command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_rpc(struct ged *gedp, struct rt_rpc_internal *rpc, const char
*attribute, fastf_t sf, int rflag)
+{
+ RT_RPC_CK_MAGIC(rpc);
+
+ switch (attribute[0]) {
+ case 'b':
+ case 'B':
+ if (!rflag)
+ sf /= MAGNITUDE(rpc->rpc_B);
+
+ VSCALE(rpc->rpc_B, rpc->rpc_B, sf);
+ break;
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(rpc->rpc_H);
+
+ VSCALE(rpc->rpc_H, rpc->rpc_H, sf);
+ break;
+ case 'r':
+ case 'R':
+ if (rflag)
+ rpc->rpc_r *= sf;
+ else
+ rpc->rpc_r = sf;
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad rpc attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_superell.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_superell.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_superell.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_superell.c
2020-07-21 18:25:56 UTC (rev 76393)
@@ -0,0 +1,106 @@
+/* S C A L E _ S U P E R E L L . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_superell.c
+ *
+ * The scale_superell command.
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+int
+_ged_scale_superell(struct ged *gedp, struct rt_superell_internal *superell,
const char *attribute, fastf_t sf, int rflag)
+{
+ fastf_t ma, mb;
+
+ RT_SUPERELL_CK_MAGIC(superell);
+
+ switch (attribute[0]) {
+ case 'a':
+ case 'A':
+ if (!rflag)
+ sf /= MAGNITUDE(superell->a);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(superell->a, superell->a, sf);
+ break;
+ case 'b':
+ case 'B':
+ if ((attribute[2] == 'c' || attribute[2] == 'C') &&
+ attribute[3] == '\0') {
+ /* set A, B, and C lengths the same */
+ VSCALE(superell->a, superell->a, sf);
+ ma = MAGNITUDE(superell->a);
+ mb = MAGNITUDE(superell->b);
+ VSCALE(superell->b, superell->b, ma/mb);
+ mb = MAGNITUDE(superell->c);
+ VSCALE(superell->c, superell->c, ma/mb);
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "bad ell attribute
- %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad ell attribute -
%s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ case 'b':
+ case 'B':
+ if (!rflag)
+ sf /= MAGNITUDE(superell->b);
+
+ VSCALE(superell->b, superell->b, sf);
+ break;
+ case 'c':
+ case 'C':
+ if (!rflag)
+ sf /= MAGNITUDE(superell->c);
+
+ VSCALE(superell->c, superell->c, sf);
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad superell attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_tgc.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_tgc.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_tgc.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_tgc.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,247 @@
+/* S C A L E _ T G C . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_tgc.c
+ *
+ * The scale_tgc command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+
+int
+_ged_scale_tgc(struct ged *gedp, struct rt_tgc_internal *tgc, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t ma, mb;
+
+ RT_TGC_CK_MAGIC(tgc);
+
+ switch (attribute[0]) {
+ case 'a':
+ case 'A':
+ if (!rflag)
+ sf /= MAGNITUDE(tgc->a);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(tgc->a, tgc->a, sf);
+ break;
+ case 'b':
+ case 'B':
+ switch (attribute[2]) {
+ case '\0':
+ VSCALE(tgc->a, tgc->a, sf);
+ ma = MAGNITUDE(tgc->a);
+ mb = MAGNITUDE(tgc->b);
+ VSCALE(tgc->b, tgc->b, ma/mb);
+
+ break;
+ case 'c':
+ case 'C':
+ if ((attribute[3] == 'd' || attribute[3] == 'D') &&
+ attribute[4] == '\0') {
+ VSCALE(tgc->a, tgc->a, sf);
+ ma = MAGNITUDE(tgc->a);
+ mb = MAGNITUDE(tgc->b);
+ VSCALE(tgc->b, tgc->b, ma/mb);
+ mb = MAGNITUDE(tgc->c);
+ VSCALE(tgc->c, tgc->c, ma/mb);
+ mb = MAGNITUDE(tgc->d);
+ VSCALE(tgc->d, tgc->d, ma/mb);
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ case 'b':
+ case 'B':
+ if (!rflag)
+ sf /= MAGNITUDE(tgc->b);
+
+ VSCALE(tgc->b, tgc->b, sf);
+ break;
+ case 'c':
+ case 'C':
+ if (!rflag)
+ sf /= MAGNITUDE(tgc->c);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(tgc->c, tgc->c, sf);
+ break;
+ case 'd':
+ case 'D':
+ VSCALE(tgc->c, tgc->c, sf);
+ ma = MAGNITUDE(tgc->c);
+ mb = MAGNITUDE(tgc->d);
+ VSCALE(tgc->d, tgc->d, ma/mb);
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ case 'd':
+ case 'D':
+ if (!rflag)
+ sf /= MAGNITUDE(tgc->d);
+
+ VSCALE(tgc->d, tgc->d, sf);
+ break;
+ case 'h':
+ case 'H':
+ if (!rflag)
+ sf /= MAGNITUDE(tgc->h);
+
+ switch (attribute[1]) {
+ case '\0':
+ VSCALE(tgc->h, tgc->h, sf);
+ break;
+ case 'c':
+ case 'C':
+ if ((attribute[2] == 'd' || attribute[2] == 'D') &&
+ attribute[3] == '\0') {
+ vect_t vec1, vec2;
+ vect_t c, d;
+
+ /* calculate new c */
+ VSUB2(vec1, tgc->a, tgc->c);
+ VSCALE(vec2, vec1, 1-sf);
+ VADD2(c, tgc->c, vec2);
+
+ /* calculate new d */
+ VSUB2(vec1, tgc->b, tgc->d);
+ VSCALE(vec2, vec1, 1-sf);
+ VADD2(d, tgc->d, vec2);
+
+ if (0 <= VDOT(tgc->c, c) &&
+ 0 <= VDOT(tgc->d, d) &&
+ !ZERO(MAGNITUDE(c)) &&
+ !ZERO(MAGNITUDE(d))) {
+ /* adjust c, d and h */
+ VMOVE(tgc->c, c);
+ VMOVE(tgc->d, d);
+ VSCALE(tgc->h, tgc->h, sf);
+ }
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "bad tgc attribute
- %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ case 'v':
+ case 'V':
+ switch (attribute[2]) {
+ case '\0': {
+ point_t old_top;
+
+ VADD2(old_top, tgc->v, tgc->h);
+ VSCALE(tgc->h, tgc->h, sf);
+ VSUB2(tgc->v, old_top, tgc->h);
+ }
+
+ break;
+ case 'a':
+ case 'A':
+ if ((attribute[3] == 'b' || attribute[3] == 'B') &&
+ attribute[4] == '\0') {
+ vect_t vec1, vec2;
+ vect_t a, b;
+ point_t old_top;
+
+ /* calculate new a */
+ VSUB2(vec1, tgc->c, tgc->a);
+ VSCALE(vec2, vec1, 1-sf);
+ VADD2(a, tgc->a, vec2);
+
+ /* calculate new b */
+ VSUB2(vec1, tgc->d, tgc->b);
+ VSCALE(vec2, vec1, 1-sf);
+ VADD2(b, tgc->b, vec2);
+
+ if (0 <= VDOT(tgc->a, a) &&
+ 0 <= VDOT(tgc->b, b) &&
+ !ZERO(MAGNITUDE(a)) &&
+ !ZERO(MAGNITUDE(b))) {
+ /* adjust a, b, v and h */
+ VMOVE(tgc->a, a);
+ VMOVE(tgc->b, b);
+ VADD2(old_top, tgc->v, tgc->h);
+ VSCALE(tgc->h, tgc->h, sf);
+ VSUB2(tgc->v, old_top, tgc->h);
+ }
+ } else {
+ bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
+ return GED_ERROR;
+ }
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
+ return GED_ERROR;
+ } /* switch (attribute[2]) */
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
+ return GED_ERROR;
+ } /* switch (attribute[1]) */
+
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tgc attribute - %s",
attribute);
+ return GED_ERROR;
+ } /* switch (attribute[0]) */
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Copied: brlcad/branches/gedplugins/src/libged/pscale/scale_tor.c (from rev
76392, brlcad/branches/gedplugins/src/libged/scale_tor.c)
===================================================================
--- brlcad/branches/gedplugins/src/libged/pscale/scale_tor.c
(rev 0)
+++ brlcad/branches/gedplugins/src/libged/pscale/scale_tor.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -0,0 +1,86 @@
+/* S C A L E _ T O R . C
+ * BRL-CAD
+ *
+ * Copyright (c) 2008-2020 United States Government as represented by
+ * the U.S. Army Research Laboratory.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * version 2.1 as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this file; see the file named COPYING for more
+ * information.
+ */
+/** @file libged/scale_tor.c
+ *
+ * The scale_tor command.
+ *
+ */
+
+#include "common.h"
+
+#include <string.h>
+
+#include "bu/cmd.h"
+#include "rt/geom.h"
+#include "raytrace.h"
+
+#include "../ged_private.h"
+
+
+int
+_ged_scale_tor(struct ged *gedp, struct rt_tor_internal *tor, const char
*attribute, fastf_t sf, int rflag)
+{
+ fastf_t newrad;
+
+ RT_TOR_CK_MAGIC(tor);
+
+ switch (attribute[0]) {
+ case 'a':
+ case 'A':
+ if (rflag)
+ newrad = tor->r_a * sf;
+ else
+ newrad = sf;
+
+ if (newrad < SMALL)
+ newrad = 4*SMALL;
+ if (tor->r_h <= newrad)
+ tor->r_a = newrad;
+ break;
+ case 'h':
+ case 'H':
+ if (rflag)
+ newrad = tor->r_h * sf;
+ else
+ newrad = sf;
+
+ if (newrad < SMALL)
+ newrad = 4*SMALL;
+ if (newrad <= tor->r_a)
+ tor->r_h = newrad;
+ break;
+ default:
+ bu_vls_printf(gedp->ged_result_str, "bad tor attribute - %s",
attribute);
+ return GED_ERROR;
+ }
+
+ return GED_OK;
+}
+
+
+/*
+ * Local Variables:
+ * tab-width: 8
+ * mode: C
+ * indent-tabs-mode: t
+ * c-file-style: "stroustrup"
+ * End:
+ * ex: shiftwidth=4 tabstop=8
+ */
Deleted: brlcad/branches/gedplugins/src/libged/scale_ehy.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_ehy.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_ehy.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,95 +0,0 @@
-/* S C A L E _ E H Y . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_ehy.c
- *
- * The scale_ehy command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_ehy(struct ged *gedp, struct rt_ehy_internal *ehy, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t newrad;
-
- RT_EHY_CK_MAGIC(ehy);
-
- switch (attribute[0]) {
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(ehy->ehy_H);
-
- VSCALE(ehy->ehy_H, ehy->ehy_H, sf);
- break;
- case 'a':
- case 'A':
- if (rflag)
- newrad = ehy->ehy_r1 * sf;
- else
- newrad = sf;
-
- if (newrad >= ehy->ehy_r2)
- ehy->ehy_r1 = newrad;
- break;
- case 'b':
- case 'B':
- if (rflag)
- newrad = ehy->ehy_r2 * sf;
- else
- newrad = sf;
-
- if (newrad <= ehy->ehy_r1)
- ehy->ehy_r2 = newrad;
- break;
- case 'c':
- case 'C':
- if (rflag)
- ehy->ehy_c *= sf;
- else
- ehy->ehy_c = sf;
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad ehy attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_ell.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_ell.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_ell.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,106 +0,0 @@
-/* S C A L E _ E L L . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_ell.c
- *
- * The scale_ell command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_ell(struct ged *gedp, struct rt_ell_internal *ell, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t ma, mb;
-
- RT_ELL_CK_MAGIC(ell);
-
- switch (attribute[0]) {
- case 'a':
- case 'A':
- if (!rflag)
- sf /= MAGNITUDE(ell->a);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(ell->a, ell->a, sf);
- break;
- case 'b':
- case 'B':
- if ((attribute[2] == 'c' || attribute[2] == 'C') &&
- attribute[3] == '\0') {
- /* set A, B, and C lengths the same */
- VSCALE(ell->a, ell->a, sf);
- ma = MAGNITUDE(ell->a);
- mb = MAGNITUDE(ell->b);
- VSCALE(ell->b, ell->b, ma/mb);
- mb = MAGNITUDE(ell->c);
- VSCALE(ell->c, ell->c, ma/mb);
- } else {
- bu_vls_printf(gedp->ged_result_str, "bad ell attribute
- %s", attribute);
- return GED_ERROR;
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad ell attribute -
%s", attribute);
- return GED_ERROR;
- }
-
- break;
- case 'b':
- case 'B':
- if (!rflag)
- sf /= MAGNITUDE(ell->b);
-
- VSCALE(ell->b, ell->b, sf);
- break;
- case 'c':
- case 'C':
- if (!rflag)
- sf /= MAGNITUDE(ell->c);
-
- VSCALE(ell->c, ell->c, sf);
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad ell attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_epa.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_epa.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_epa.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,87 +0,0 @@
-/* S C A L E _ E P A . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_epa.c
- *
- * The scale_epa command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_epa(struct ged *gedp, struct rt_epa_internal *epa, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t newrad;
-
- RT_EPA_CK_MAGIC(epa);
-
- switch (attribute[0]) {
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(epa->epa_H);
-
- VSCALE(epa->epa_H, epa->epa_H, sf);
- break;
- case 'a':
- case 'A':
- if (rflag)
- newrad = epa->epa_r1 * sf;
- else
- newrad = sf;
-
- if (newrad >= epa->epa_r2)
- epa->epa_r1 = newrad;
- break;
- case 'b':
- case 'B':
- if (rflag)
- newrad = epa->epa_r2 * sf;
- else
- newrad = sf;
-
- if (newrad <= epa->epa_r1)
- epa->epa_r2 = newrad;
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad epa attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_eto.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_eto.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_eto.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,132 +0,0 @@
-/* S C A L E _ E T O . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_eto.c
- *
- * The scale_eto command.
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-
-int
-_ged_scale_eto(struct ged *gedp, struct rt_eto_internal *eto, const char
*attribute, fastf_t sf, int rflag)
-{
- RT_ETO_CK_MAGIC(eto);
-
- switch (attribute[0]) {
- case 'r':
- case 'R': {
- fastf_t ch, cv, dh, newrad;
- vect_t Nu;
-
- if (rflag)
- newrad = eto->eto_r * sf;
- else
- newrad = sf;
-
- if (newrad < SMALL)
- newrad = 4*SMALL;
-
- VMOVE(Nu, eto->eto_N);
- VUNITIZE(Nu);
-
- /* get horiz and vert components of C and Rd */
- cv = VDOT(eto->eto_C, Nu);
- ch = sqrt(VDOT(eto->eto_C, eto->eto_C) - cv * cv);
-
- /* angle between C and Nu */
- dh = eto->eto_rd * cv / MAGNITUDE(eto->eto_C);
-
- /* make sure revolved ellipse doesn't overlap itself */
- if (ch <= newrad && dh <= newrad)
- eto->eto_r = newrad;
- }
- break;
- case 'd':
- case 'D': {
- fastf_t dh, newrad, work;
- vect_t Nu;
-
- if (rflag)
- newrad = eto->eto_rd * sf;
- else
- newrad = sf;
-
- if (newrad < SMALL)
- newrad = 4*SMALL;
- work = MAGNITUDE(eto->eto_C);
- if (newrad <= work) {
- VMOVE(Nu, eto->eto_N);
- VUNITIZE(Nu);
- dh = newrad * VDOT(eto->eto_C, Nu) / work;
- /* make sure revolved ellipse doesn't overlap itself */
- if (dh <= eto->eto_r)
- eto->eto_rd = newrad;
- }
- }
- break;
- case 'c':
- case 'C': {
- fastf_t ch, cv;
- vect_t Nu, Work;
-
- if (!rflag)
- sf /= MAGNITUDE(eto->eto_C);
-
- if (sf * MAGNITUDE(eto->eto_C) >= eto->eto_rd) {
- VMOVE(Nu, eto->eto_N);
- VUNITIZE(Nu);
- VSCALE(Work, eto->eto_C, sf);
-
- /* get horiz and vert comps of C and Rd */
- cv = VDOT(Work, Nu);
- ch = sqrt(VDOT(Work, Work) - cv * cv);
- if (ch <= eto->eto_r)
- VMOVE(eto->eto_C, Work);
- }
- }
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad eto attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_extrude.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_extrude.c 2020-07-21
17:17:07 UTC (rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_extrude.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -1,75 +0,0 @@
-/* S C A L E _ E X T R U D E . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_extrude.c
- *
- * The scale_extrude command.
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-
-int
-_ged_scale_extrude(struct ged *gedp, struct rt_extrude_internal *extrude,
const char *attribute, fastf_t sf, int rflag)
-{
- vect_t hvec;
-
- RT_EXTRUDE_CK_MAGIC(extrude);
-
- switch (attribute[0]) {
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(extrude->h);
-
- VSCALE(hvec, extrude->h, sf);
-
- /* Make sure hvec is not zero length */
- if (MAGNITUDE(hvec) > SQRT_SMALL_FASTF) {
- VMOVE(extrude->h, hvec);
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad extrude attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_hyp.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_hyp.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_hyp.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,111 +0,0 @@
-/* S C A L E _ H Y P . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_hyp.c
- *
- * The scale_hyp command.
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-
-int
-_ged_scale_hyp(struct ged *gedp, struct rt_hyp_internal *hyp, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t f;
- point_t old_top;
-
- RT_HYP_CK_MAGIC(hyp);
-
- switch (attribute[0]) {
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(hyp->hyp_Hi);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(hyp->hyp_Hi, hyp->hyp_Hi, sf);
- break;
- case 'v':
- case 'V':
- /* Scale H move V */
- VADD2(old_top, hyp->hyp_Vi, hyp->hyp_Hi);
- VSCALE(hyp->hyp_Hi, hyp->hyp_Hi, sf);
- VSUB2(hyp->hyp_Vi, old_top, hyp->hyp_Hi);
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad hyp attribute -
%s", attribute);
- return GED_ERROR;
- }
- break;
- case 'a':
- case 'A':
- if (!rflag)
- sf /= MAGNITUDE(hyp->hyp_A);
-
- VSCALE(hyp->hyp_A, hyp->hyp_A, sf);
- break;
- case 'b':
- case 'B':
- if (rflag)
- hyp->hyp_b *= sf;
- else
- hyp->hyp_b = sf;
-
- break;
- case 'c':
- case 'C':
- if (rflag)
- f = hyp->hyp_bnr * sf;
- else
- f = sf;
-
- if (f <= 1.0)
- hyp->hyp_bnr = f;
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad hyp attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_part.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_part.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_part.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,78 +0,0 @@
-/* S C A L E _ P A R T . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_part.c
- *
- * The scale_part command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_part(struct ged *gedp, struct rt_part_internal *part, const char
*attribute, fastf_t sf, int rflag)
-{
- RT_PART_CK_MAGIC(part);
-
- switch (attribute[0]) {
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(part->part_H);
-
- VSCALE(part->part_H, part->part_H, sf);
- break;
- case 'v':
- if (rflag)
- part->part_vrad *= sf;
- else
- part->part_vrad = sf;
-
- break;
- case 'h':
- if (rflag)
- part->part_hrad *= sf;
- else
- part->part_hrad = sf;
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad part attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_rhc.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_rhc.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_rhc.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,88 +0,0 @@
-/* S C A L E _ R H C . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_rhc.c
- *
- * The scale_rhc command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_rhc(struct ged *gedp, struct rt_rhc_internal *rhc, const char
*attribute, fastf_t sf, int rflag)
-{
- RT_RHC_CK_MAGIC(rhc);
-
- switch (attribute[0]) {
- case 'b':
- case 'B':
- if (!rflag)
- sf /= MAGNITUDE(rhc->rhc_B);
-
- VSCALE(rhc->rhc_B, rhc->rhc_B, sf);
- break;
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(rhc->rhc_H);
-
- VSCALE(rhc->rhc_H, rhc->rhc_H, sf);
- break;
- case 'c':
- case 'C':
- if (rflag)
- rhc->rhc_c *= sf;
- else
- rhc->rhc_c = sf;
-
- break;
- case 'r':
- case 'R':
- if (rflag)
- rhc->rhc_r *= sf;
- else
- rhc->rhc_r = sf;
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad rhc attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_rpc.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_rpc.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_rpc.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,80 +0,0 @@
-/* S C A L E _ R P C . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_rpc.c
- *
- * The scale_rpc command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_rpc(struct ged *gedp, struct rt_rpc_internal *rpc, const char
*attribute, fastf_t sf, int rflag)
-{
- RT_RPC_CK_MAGIC(rpc);
-
- switch (attribute[0]) {
- case 'b':
- case 'B':
- if (!rflag)
- sf /= MAGNITUDE(rpc->rpc_B);
-
- VSCALE(rpc->rpc_B, rpc->rpc_B, sf);
- break;
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(rpc->rpc_H);
-
- VSCALE(rpc->rpc_H, rpc->rpc_H, sf);
- break;
- case 'r':
- case 'R':
- if (rflag)
- rpc->rpc_r *= sf;
- else
- rpc->rpc_r = sf;
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad rpc attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_superell.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_superell.c 2020-07-21
17:17:07 UTC (rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_superell.c 2020-07-21
18:25:56 UTC (rev 76393)
@@ -1,106 +0,0 @@
-/* S C A L E _ S U P E R E L L . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_superell.c
- *
- * The scale_superell command.
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-int
-_ged_scale_superell(struct ged *gedp, struct rt_superell_internal *superell,
const char *attribute, fastf_t sf, int rflag)
-{
- fastf_t ma, mb;
-
- RT_SUPERELL_CK_MAGIC(superell);
-
- switch (attribute[0]) {
- case 'a':
- case 'A':
- if (!rflag)
- sf /= MAGNITUDE(superell->a);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(superell->a, superell->a, sf);
- break;
- case 'b':
- case 'B':
- if ((attribute[2] == 'c' || attribute[2] == 'C') &&
- attribute[3] == '\0') {
- /* set A, B, and C lengths the same */
- VSCALE(superell->a, superell->a, sf);
- ma = MAGNITUDE(superell->a);
- mb = MAGNITUDE(superell->b);
- VSCALE(superell->b, superell->b, ma/mb);
- mb = MAGNITUDE(superell->c);
- VSCALE(superell->c, superell->c, ma/mb);
- } else {
- bu_vls_printf(gedp->ged_result_str, "bad ell attribute
- %s", attribute);
- return GED_ERROR;
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad ell attribute -
%s", attribute);
- return GED_ERROR;
- }
-
- break;
- case 'b':
- case 'B':
- if (!rflag)
- sf /= MAGNITUDE(superell->b);
-
- VSCALE(superell->b, superell->b, sf);
- break;
- case 'c':
- case 'C':
- if (!rflag)
- sf /= MAGNITUDE(superell->c);
-
- VSCALE(superell->c, superell->c, sf);
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad superell attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_tgc.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_tgc.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_tgc.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,247 +0,0 @@
-/* S C A L E _ T G C . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_tgc.c
- *
- * The scale_tgc command.
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-
-int
-_ged_scale_tgc(struct ged *gedp, struct rt_tgc_internal *tgc, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t ma, mb;
-
- RT_TGC_CK_MAGIC(tgc);
-
- switch (attribute[0]) {
- case 'a':
- case 'A':
- if (!rflag)
- sf /= MAGNITUDE(tgc->a);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(tgc->a, tgc->a, sf);
- break;
- case 'b':
- case 'B':
- switch (attribute[2]) {
- case '\0':
- VSCALE(tgc->a, tgc->a, sf);
- ma = MAGNITUDE(tgc->a);
- mb = MAGNITUDE(tgc->b);
- VSCALE(tgc->b, tgc->b, ma/mb);
-
- break;
- case 'c':
- case 'C':
- if ((attribute[3] == 'd' || attribute[3] == 'D') &&
- attribute[4] == '\0') {
- VSCALE(tgc->a, tgc->a, sf);
- ma = MAGNITUDE(tgc->a);
- mb = MAGNITUDE(tgc->b);
- VSCALE(tgc->b, tgc->b, ma/mb);
- mb = MAGNITUDE(tgc->c);
- VSCALE(tgc->c, tgc->c, ma/mb);
- mb = MAGNITUDE(tgc->d);
- VSCALE(tgc->d, tgc->d, ma/mb);
- } else {
- bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
- return GED_ERROR;
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
- return GED_ERROR;
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
- return GED_ERROR;
- }
-
- break;
- case 'b':
- case 'B':
- if (!rflag)
- sf /= MAGNITUDE(tgc->b);
-
- VSCALE(tgc->b, tgc->b, sf);
- break;
- case 'c':
- case 'C':
- if (!rflag)
- sf /= MAGNITUDE(tgc->c);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(tgc->c, tgc->c, sf);
- break;
- case 'd':
- case 'D':
- VSCALE(tgc->c, tgc->c, sf);
- ma = MAGNITUDE(tgc->c);
- mb = MAGNITUDE(tgc->d);
- VSCALE(tgc->d, tgc->d, ma/mb);
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
- return GED_ERROR;
- }
-
- break;
- case 'd':
- case 'D':
- if (!rflag)
- sf /= MAGNITUDE(tgc->d);
-
- VSCALE(tgc->d, tgc->d, sf);
- break;
- case 'h':
- case 'H':
- if (!rflag)
- sf /= MAGNITUDE(tgc->h);
-
- switch (attribute[1]) {
- case '\0':
- VSCALE(tgc->h, tgc->h, sf);
- break;
- case 'c':
- case 'C':
- if ((attribute[2] == 'd' || attribute[2] == 'D') &&
- attribute[3] == '\0') {
- vect_t vec1, vec2;
- vect_t c, d;
-
- /* calculate new c */
- VSUB2(vec1, tgc->a, tgc->c);
- VSCALE(vec2, vec1, 1-sf);
- VADD2(c, tgc->c, vec2);
-
- /* calculate new d */
- VSUB2(vec1, tgc->b, tgc->d);
- VSCALE(vec2, vec1, 1-sf);
- VADD2(d, tgc->d, vec2);
-
- if (0 <= VDOT(tgc->c, c) &&
- 0 <= VDOT(tgc->d, d) &&
- !ZERO(MAGNITUDE(c)) &&
- !ZERO(MAGNITUDE(d))) {
- /* adjust c, d and h */
- VMOVE(tgc->c, c);
- VMOVE(tgc->d, d);
- VSCALE(tgc->h, tgc->h, sf);
- }
- } else {
- bu_vls_printf(gedp->ged_result_str, "bad tgc attribute
- %s", attribute);
- return GED_ERROR;
- }
-
- break;
- case 'v':
- case 'V':
- switch (attribute[2]) {
- case '\0': {
- point_t old_top;
-
- VADD2(old_top, tgc->v, tgc->h);
- VSCALE(tgc->h, tgc->h, sf);
- VSUB2(tgc->v, old_top, tgc->h);
- }
-
- break;
- case 'a':
- case 'A':
- if ((attribute[3] == 'b' || attribute[3] == 'B') &&
- attribute[4] == '\0') {
- vect_t vec1, vec2;
- vect_t a, b;
- point_t old_top;
-
- /* calculate new a */
- VSUB2(vec1, tgc->c, tgc->a);
- VSCALE(vec2, vec1, 1-sf);
- VADD2(a, tgc->a, vec2);
-
- /* calculate new b */
- VSUB2(vec1, tgc->d, tgc->b);
- VSCALE(vec2, vec1, 1-sf);
- VADD2(b, tgc->b, vec2);
-
- if (0 <= VDOT(tgc->a, a) &&
- 0 <= VDOT(tgc->b, b) &&
- !ZERO(MAGNITUDE(a)) &&
- !ZERO(MAGNITUDE(b))) {
- /* adjust a, b, v and h */
- VMOVE(tgc->a, a);
- VMOVE(tgc->b, b);
- VADD2(old_top, tgc->v, tgc->h);
- VSCALE(tgc->h, tgc->h, sf);
- VSUB2(tgc->v, old_top, tgc->h);
- }
- } else {
- bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
- return GED_ERROR;
- }
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc
attribute - %s", attribute);
- return GED_ERROR;
- } /* switch (attribute[2]) */
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc attribute -
%s", attribute);
- return GED_ERROR;
- } /* switch (attribute[1]) */
-
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tgc attribute - %s",
attribute);
- return GED_ERROR;
- } /* switch (attribute[0]) */
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
Deleted: brlcad/branches/gedplugins/src/libged/scale_tor.c
===================================================================
--- brlcad/branches/gedplugins/src/libged/scale_tor.c 2020-07-21 17:17:07 UTC
(rev 76392)
+++ brlcad/branches/gedplugins/src/libged/scale_tor.c 2020-07-21 18:25:56 UTC
(rev 76393)
@@ -1,86 +0,0 @@
-/* S C A L E _ T O R . C
- * BRL-CAD
- *
- * Copyright (c) 2008-2020 United States Government as represented by
- * the U.S. Army Research Laboratory.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * version 2.1 as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this file; see the file named COPYING for more
- * information.
- */
-/** @file libged/scale_tor.c
- *
- * The scale_tor command.
- *
- */
-
-#include "common.h"
-
-#include <string.h>
-
-#include "bu/cmd.h"
-#include "rt/geom.h"
-#include "raytrace.h"
-
-#include "./ged_private.h"
-
-
-int
-_ged_scale_tor(struct ged *gedp, struct rt_tor_internal *tor, const char
*attribute, fastf_t sf, int rflag)
-{
- fastf_t newrad;
-
- RT_TOR_CK_MAGIC(tor);
-
- switch (attribute[0]) {
- case 'a':
- case 'A':
- if (rflag)
- newrad = tor->r_a * sf;
- else
- newrad = sf;
-
- if (newrad < SMALL)
- newrad = 4*SMALL;
- if (tor->r_h <= newrad)
- tor->r_a = newrad;
- break;
- case 'h':
- case 'H':
- if (rflag)
- newrad = tor->r_h * sf;
- else
- newrad = sf;
-
- if (newrad < SMALL)
- newrad = 4*SMALL;
- if (newrad <= tor->r_a)
- tor->r_h = newrad;
- break;
- default:
- bu_vls_printf(gedp->ged_result_str, "bad tor attribute - %s",
attribute);
- return GED_ERROR;
- }
-
- return GED_OK;
-}
-
-
-/*
- * Local Variables:
- * tab-width: 8
- * mode: C
- * indent-tabs-mode: t
- * c-file-style: "stroustrup"
- * End:
- * ex: shiftwidth=4 tabstop=8
- */
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits