OCENTER(nged)

get or set the center point of an object's bounding box

πŸ“… published 7.44.0, from nixpkgs unstable

πŸ’… OCENTER(nged) β€” the get-or-set bounding-box center queen πŸ‘‘

okay so bestie, welcome to ocenter from the BRL-CAD user commands (nged fam), and honestly? it's giving main character energy for a two-line command. let's get into it ✨


✨ NAME ✨

ocenter β€” get or set the center point of an object's bounding box 🎯


πŸ¦‹ SYNOPSIS πŸ¦‹

ocenter object
ocenter object x y z

like, either you're just asking a question, or you're rearranging furniture. two vibes, one command πŸ’…


🌸 DESCRIPTION 🌸

The ocenter command gets or sets the bounding-box center of the specified object. simple as that, no cap 🫢

With one argument, ocenter computes the axis-aligned bounding box of object and returns the center point as a space-separated x y z triplet in the current working units. just a lil read-only peek, she's not touching anything πŸ‘€

With four arguments (object x y z), ocenter moves the object so that its bounding-box center coincides with the specified point (x, y, z) in model coordinates. and here's the important part, bestie β€” the move is applied by modifying the object's own geometry, not by adding a transformation to a parent combination. no sneaky wrapper prim, no parent combo doing the heavy lifting. the object is updated directly in the database. it's giving "no middleman" energy πŸ”₯

Coordinates are in the current working units. always. don't forget or she'll gaslight you πŸ’€

⚠️ Note: the bounding-box center is computed from the axis-aligned bounding box of the object, which may not coincide with the geometric centroid for asymmetric shapes. so if your shape is lopsided, the "center" is the box's center, not the vibe's center. just so we're clear πŸ™ˆ

πŸŽ€ EXAMPLES πŸŽ€

Example 1. Get the bounding-box center of an object

mged> ocenter hull.s

Returns the center of hull.s's bounding box in working units, for example: 0 0 250. cute, quick, no drama πŸ’–

Example 2. Move an object's center to the origin

mged> ocenter wheel.s 0 0 0

Moves wheel.s so its bounding-box center is at the model origin (0, 0, 0). centering era 🌈

Example 3. Center an object on an axis

mged> set c [ocenter part.s] mged> ocenter part.s 0 0 [lindex $c 2]

Retrieves the current center, then moves part.s so its center is on the Z axis (X=0, Y=0) without changing its Z position. look at her go, preserving Z like a queen πŸ‘‘


🧚 SEE ALSO 🧚

  • center(nged)
  • translate(nged)
  • bb(nged)

the whole friend group, honestly 🫢


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team β€” icons, legends, the blueprint πŸ’œ


πŸ’€ BUG REPORTS πŸ’€

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org β€” yes, actual email, we love a retro moment πŸ“


okay that's the whole page bestie, go center something βœ¨πŸ’…

BRL-CAD made this one, and it's the OCENTER(nged) manual page β€” that's the version + date energy right there, no cap πŸŽ€

πŸ“¦ where this page comes from