EDIT_SCALE(nged)

Resize one or more objects in the database by a scale factor.

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… EDIT SCALE(nged) β€” the resize-your-stuff glow-up guide

okay bestie, welcome to EDIT SCALE from the nged manual (BRL-CAD User Commands, if you're keeping track) πŸŽ€ this is the page where we learn how to make objects bigger, smaller, and honestly just more. no cap, it's iconic.


✨ NAME ✨

edit scale, edit sca β€” resize one or more objects in the database by a scale factor. that's it. that's the whole gig. πŸ¦‹


✨ SYNOPSIS ✨

edit [options] geometry scale FACTOR
edit [options] geometry scale X_FACTOR Y_FACTOR Z_FACTOR
edit [options] geometry scale -r FACTOR
edit [options] geometry scale -r X_FACTOR Y_FACTOR Z_FACTOR
edit [options] geometry scale [-k FROM_POS|FROM_OBJ] -a TO_POS|TO_OBJ
edit [options] geometry scale [-k SCALE_FROM] -a SCALE_TO -r FACTOR
edit [options] geometry scale [-k SCALE_FROM] -a SCALE_TO -r X_FACTOR Y_FACTOR Z_FACTOR
edit [options] geometry scale [-c CENTER_POS|CENTER_OBJ] FACTOR
edit [options] geometry scale [-c CENTER_POS|CENTER_OBJ]
    X_FACTOR Y_FACTOR Z_FACTOR

quick lil glossary before we go any further, because these placeholders are doing a lot of work:

  • FROM_POS, TO_POS, SCALE_FROM, SCALE_TO, and CENTER_POS each accept one to three scalar values (broadcast to a 3-vector when fewer are given) πŸ‘‘
  • FROM_OBJ, TO_OBJ, CENTER_OBJ are names of existing database objects whose bounding-box centers are used 🌸

✨ DESCRIPTION ✨

so the whole point: you use this to enlarge or reduce the size of one or more instances of primitive or combination objects by a scaling factor. glow-up or shrink-down, your call πŸ’–

the rules of the road, and listen closely bestie:

  • a scale factor greater than 1 enlarges the object πŸ”₯
  • a factor between 0 and 1 shrinks it πŸ“
  • a factor of exactly 0, or any negative factor, gets rejected as invalid πŸ’€ β€” don't even try it

Uniform scale (all three factors equal) uses the primitive's native scale path and is supported by all primitives. slay. Anisotropic (per-axis) scale β€” where the X, Y, Z factors differ β€” applies a diagonal scale matrix via ft_mat and is only available for primitives that provide that function. (remember that, it comes back in Example 5 and it WILL bite you)

🧚 the conceptual model: two rulers, one vibe

the mental model behind edit scale uses two independent reference pairs β€” a SCALE ruler and a FACTOR ruler:

SCALE  = vector from SCALE_FROM (-k) to SCALE_TO (-a|-r)
         the reference "ruler" β€” measures a known distance in the scene
FACTOR = the desired result ruler β€” how large the result should be
         expressed as the positional argument(s), or -r when combined
         with a -k/-a pair
effective factor[i] = FACTOR[i] / |SCALE[i]|   per axis

the three supported calling patterns are, and yes i'm numbering them in my head with sparkles:

  • Positional (or explicit -r alone) β€” supply 1 or 3 scalar factor values directly. the implicit SCALE ruler is the unit vector (1, 1, 1), so the effective factor equals FACTOR directly. scale 2 and scale -r 2 both double the object. same energy, different spelling πŸ’…
  • -k FROM -a TO only β€” the effective factor vector is computed as TO - FROM. when FROM is the origin this is simply TO: scale -k 0 0 0 -a 2 2 2 yields factors {2, 2, 2} ⭐
  • -k FROM -a SCALE_TO -r FACTOR (two-pair form) β€” the -k/-a pair defines the SCALE reference ruler; -r is the FACTOR ruler. the effective factor is FACTOR / |SCALE| per axis. for example: scale -k 5 10 15 -a 7 11 -2 -r 4 2 34 computes SCALE=(2,1,17) and FACTOR=(4,2,34), giving effective factors (2, 2, 2) β€” a uniform 2Γ— scale regardless of the absolute coordinates. this form is the primary motivation for supplying a SCALE ruler: the FROM/TO pair captures a known real-world distance and the -r value expresses the desired outcome in the same units. genuinely chef's kiss πŸ‘‘

πŸŽ€ the pivot

the pivot CENTER defaults to the bounding-box center of the target object when -c is not specified. the batch-marker . is supported as a -c argument to use each target object's own keypoint as the pivot center. (batch mode = main character energy, we love her)

the alias sca is equivalent to scale. same girl, shorter name 🫢

global options (-S, -f, -F, -i) are described in edit(nged). go read that one too, bestie.


✨ OPTIONS ✨

  • -k SCALE_FROM_POS | SCALE_FROM_OBJ β€” set SCALE_FROM, the tail of the SCALE reference ruler vector. accepts 1–3 scalar values (broadcast to a 3-vector when fewer than three are given) or an object name whose bounding-box center is used. when combined with -a SCALE_TO only (no -r), the effective scale factor is SCALE_TO - SCALE_FROM. when combined with both -a SCALE_TO and -r FACTOR, the -k/-a pair defines the SCALE reference ruler and -r provides the FACTOR ruler; the effective factor is FACTOR / |SCALE| per axis. if absent, FROM defaults to the origin (0, 0, 0) πŸ¦‹
  • -a SCALE_TO_POS | SCALE_TO_OBJ β€” set SCALE_TO as an absolute position, defining the head of the SCALE reference ruler. required when SCALE_TO is specified as an object name. when used alone with -k, effective factors = TO - FROM. when combined with -r FACTOR, it triggers the two-pair ratio model ✨
  • -r FACTOR | X_FACTOR Y_FACTOR Z_FACTOR β€” provide the FACTOR ruler explicitly. when used without -k/-a, this is the direct scale factor (broadcast or per-axis). when combined with a -k/-a SCALE pair, this becomes the FACTOR ruler and the effective factor is r_vec[i] / |SCALE[i]| per axis. accepts 1 value (broadcast to all three axes) or 3 per-axis values πŸ’œ
  • -c CENTER_POS | CENTER_OBJ | . β€” set the pivot center from which the scale expands or contracts. defaults to the bounding-box center of the target object. accepts 1–3 scalar values, an object name, or the batch marker . to use each target object's own keypoint as the pivot center πŸŽ€
  • -n β€” accepted for compatibility; intended to select natural origin over bounding-box center for an object argument. has minimal effect in the current implementation. (so like... it's there. it vibes. it doesn't do much. πŸ™ˆ)

✨ EXAMPLES ✨

πŸ’– Example 1. Double the size of cube from its center β€” simple forms

a single scalar factor:

mged> edit cube scale 2

three equal factors (still uniform):

mged> edit cube scale 2 2 2

explicit relative flag:

mged> edit cube scale -r 2
mged> edit cube scale -r 2 2 2

using the FROM/TO reference pair (origin β†’ 2 = factor of 2):

mged> edit cube scale -k 0 0 0 -a 2 2 2

πŸ’– Example 2. Halve the size of sph.s

mged> edit sph.s scale 0.5

using the FROM/TO reference pair:

mged> edit sph.s scale -k 0 0 0 -a 0.5 0.5 0.5

using explicit -r:

mged> edit sph.s scale -r 0.5

πŸ’– Example 3. Scale with a fixed pivot center

scale sph.s by 2 but keep its surface nearest the origin fixed (pivot at the origin):

mged> edit sph.s scale -c 0 0 0 2

scale cube from a named object's position as the pivot:

mged> edit cube scale -c sphere1 2

scale from the cube's own center (the default; written explicitly):

mged> edit cube scale -c cube 2

πŸ’– Example 4. Understanding the -k / -a vector model and the two-pair ratio form

when FROM is the origin and TO is the desired factor, the model is intuitive: scale -k 0 0 0 -a F F F applies a uniform factor F.

mged> edit cube scale -k 0 0 0 -a 3 3 3

the above triples the object. the following halves it:

mged> edit cube scale -k 0 0 0 -a 0.5 0.5 0.5
⚠️ when FROM is not the origin, the effective factor is simply TO - FROM. scale -k 1 1 1 -a 3 3 3 yields factors {2, 2, 2} β€” it doubles, not triples, because 3-1=2. plan your FROM/TO values accordingly, bestie 😭

two-pair (ratio) form: when -k FROM -a SCALE_TO -r FACTOR are all supplied together, the -k/-a pair is the SCALE reference ruler and -r is the FACTOR ruler. the effective factor is computed as FACTOR / |SCALE| per axis. for example:

mged> edit cube scale -k 0 0 0 -a 1 1 1 -r 2

here SCALE=(1,1,1) and FACTOR=(2,2,2), so effective factor = 2/1 = 2 (doubles the cube). a more complex example illustrating that the sign of SCALE components is ignored (only magnitude matters):

mged> edit cube scale -k 5 10 15 -a 7 11 -2 -r 4 2 34

SCALE vector = (2, 1, -17), |per axis| = (2, 1, 17). FACTOR = (4, 2, 34). effective = (4/2, 2/1, 34/17) = (2, 2, 2) β€” a uniform 2Γ— scale πŸ”₯

this form is most useful when the SCALE ruler is derived from known scene measurements: specify FROM and TO as points that span a known reference distance, then use -r to state the desired result size.

πŸ’– Example 5. Non-uniform (anisotropic) scale: stretch X by 2, shrink Y by 0.5, leave Z unchanged

🚨 only primitives that implement ft_mat support per-axis scale. for primitives without ft_mat (e.g. arb8, bot, brep) this will return an error.
mged> edit ell.s scale 2 0.5 1

the three values map to X, Y, Z scale factors respectively. a zero in any position is rejected:

mged> edit ell.s scale 0 1 1   ← error, zero factor

equal factors are treated as uniform (uses the native scale path):

mged> edit ell.s scale 2 2 2   ← uniform, equivalent to scale 2

πŸ’– Example 6. Scale with an explicit center and an explicit factor

apply a factor of 1.5 to cube, pivoting on sphere1's keypoint:

mged> edit cube scale -c sphere1 1.5

pivot on a world-space coordinate:

mged> edit cube scale -c 10 0 0 1.5

πŸ’– Example 7. Batch scale: each object scales from its own center using -c .

use -c . to pivot each object on its own keypoint (bounding-box center) in a single command per object:

mged> edit sph.s scale -c . 2
mged> edit other.s scale -c . 2

the . causes each object's own current keypoint to serve as the pivot center, equivalent to naming each object explicitly:

mged> edit sph.s scale -c sph.s 2
mged> edit other.s scale -c other.s 2

πŸ’– Example 8. Use the intermediate buffer: scale tentatively, then revert if unsatisfied

mged> edit cube checkpoint
mged> edit -i cube scale 2
mged> edit cube revert

try it, hate it, undo it. no commitment, we love a low-stakes experiment 🌈


✨ SEE ALSO ✨

edit(nged), edit rotate(nged), edit translate(nged), oscale(nged), pscale(nged) β€” go read the whole family, they're all icons πŸ‘‘


✨ AUTHOR ✨

BRL-CAD Team 🫢


✨ BUG REPORTS ✨

reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org β€” they genuinely want to hear it, bestie, don't be shy πŸ’Œ


that's the page! BRL-CAD, EDIT SCALE(nged), straight from the BRL-CAD User Commands set β€” go forth and resize responsibly πŸ’…βœ¨

πŸ“¦ where this page comes from