POV-Ray : Newsgroups : povray.binaries.scene-files : Dice & RoundBox macros Server Time
26 Jun 2024 11:17:28 EDT (-0400)
  Dice & RoundBox macros (Message 1 to 1 of 1)  
From: Larry Hudson
Subject: Dice & RoundBox macros
Date: 3 May 2008 19:11:52
Message: <481cf138@news.povray.org>
Here are the macros I used for the example images I posted to p.b.i

My RoundBox macro differs from the standard Round_Box macro in 
shapes.inc.  The original is defined like the box primitive by taking 
the coords of two diagonally opposite corners.  Mine takes a single 
vector which defines the dimensions of the box, and like the torus, it 
creates this box centered on the origin.  It can then be rotated and 
translated to its final position.

As I said in my original posting, I wrote this version simply as a 
personal project without refering to the original version.  But after it 
was done and I looked at the original, I stole the UseMerge flag idea to 
add to mine.  The original also checked for the edge radius being too 
large and would output #warning messages.  I didn't add this to mine, 
but it would be a trivial addition as well.  Mine is considerably 
shorter than the original, but whether it's more/less efficient, I don't 
know.  Just be aware that it's used in a different manner than the original.

The Die macro uses my RoundBox macro, so it also creates the dice 
centered on the origin.

The headers are:
     #macro RoundBox(Dims, Rad, UseMerge)
         and
     #macro Die(Size, Rad, Dot, UseMerge)
Parameters:
     Dims     - Vector giving box dimensions
     Rad      - Edge radius
     Size     - Size of die, passed to RoundBox as <Size, Size, Size>
     Dot      - Color of the die spots
     UseMerge - flag for union or merge, yes=merge, no=union

Both of these macros are in the rbox.inc file.

I'm also attaching the source to the two sample images I posted to show 
how these macros are used.  I think these three files are all 
well-commented and (I hope) easy to follow.

      -=- Larry -=-

PS.  These files were written with tabs set for 4 characters.


Post a reply to this message


Attachments:
Download 'us-ascii' (5 KB) Download 'us-ascii' (2 KB) Download 'us-ascii' (3 KB)

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.