ASC2DSP(1)

πŸ“¦
version 7.44.0 Β· 2 versions
, in nixpkgs unstable

πŸ’… ASC2DSP(1) β€” the BRL-CAD glow-up

okay so bestie, welcome to asc2dsp, a little BRL-CAD icon that takes your plain-text vibes and turns them into a whole binary situation. no cap.


✨ NAME ✨

asc2dsp β€” converts an ASCII displacement map file into the BRL-CAD binary dsp format. it's giving translator. it's giving glow-up arc. πŸ¦‹


🌸 SYNOPSIS 🌸

asc2dsp [-h] file.asc file.dsp

πŸ’– DESCRIPTION πŸ’–

asc2dsp converts ASCII (decimal integer) point data files into the BRL-CAD binary dsp (displacement map) format. literally its whole personality.

the input file should contain whitespace-delimited, unsigned decimal integers ranging from 0 to 65535. that's the range, bestie, respect it. the output is a dsp binary file containing one network unsigned short integer per cell. one per cell. every cell gets one. no cell left behind 🫢

when you use it to create a dsp object in mged(1), the grid is oriented in the X-Y plane. okay so orientation lore:

  • the first cell defined in the ASCII file becomes the bottom-left cell (X=0, Y=0) πŸ‘‘
  • its bottom sits at Z=0
  • its top sits at Z equal to the input value

data is read bottom to top, left to right, similar to the pix(5) format. and because whitespace is ignored, you can absolutely format the input grid row by row for readability β€” go off, make it pretty, the parser does not care ✨

wanna author an input file in a natural top-down viewing order? iconic, but do it like this: create it row by row from top to bottom, then reverse the lines using the tac(1) utility before processing with asc2dsp. that's the move. that's the whole trick πŸ”₯

the total number of input cells must match the product of the width and length intended for the dsp object. do the math. the math is not optional. 😭


πŸŽ€ OPTIONS πŸŽ€

  • -h, -?, β€”help β€” prints a usage message and exits. that's it. that's the whole option. a one-hit wonder πŸ’…

🌈 EXAMPLES 🌈

Example 1. Converting an ASCII displacement map to binary dsp

$ asc2dsp terrain.asc terrain.dsp

converts the ASCII file terrain.asc to the binary displacement map format and saves it as terrain.dsp. slay. done. next. ✨

Example 2. Creating a dsp file using tac for proper row order

$ tac top_down.asc > bottom_up.asc
$ asc2dsp bottom_up.asc terrain.dsp

reverses the row order of top_down.asc to align with the bottom-to-top layout required by mged(1), and then converts it to terrain.dsp. two commands. one flawless pipeline. we love a collab 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

tac(1), mged(1), dsp(5), pix(5) β€” the whole friend group, go say hi πŸ’œ


⭐ DIAGNOSTICS ⭐

error conditions include invalid input characters or an input value greater than 65535. descriptive messages are printed on standard error. so if something's wrong, it will tell you β€” just not on stdout, bestie, check stderr πŸ™ˆ


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team. the legends. the icons. the moment.


This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory. yes, that's a long reign. main character energy since '89. periodt.


πŸ“ BUG REPORTS πŸ“

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org. don't suffer in silence, ngl β€” tell the devs, they wanna know 🧚


lowkey reminder: keep those values between 0 and 65535, keep your cell count matching width Γ— length, and if your grid looks upside down that's a you problem β€” that's what tac(1) is for πŸ’–

that's the whole page, bestie β€” brought to you by BRL-CAD / ASC2DSP(1). go convert something iconic πŸ’…βœ¨

πŸ“¦ where this page comes from