POV-Ray : Newsgroups : povray.binaries.scene-files : Round/bevel: Include file Server Time
2 Sep 2024 06:17:09 EDT (-0400)
  Round/bevel: Include file (Message 1 to 8 of 8)  
From: Frank 'Sputnik' Rothfuß
Subject: Round/bevel: Include file
Date: 23 Jan 2003 06:57:43
Message: <3E2FD8B6.7FFDC99B@computermuseum.fh-kiel.de>
Hi,




for an animation I'm currently working on I wanted complicated rounded
pieces of wood, so I wrote macros to create these shapes. To get a first
impression what these macros can do, just open the attached file Brett.in
c
in POV, and

in POV-Ray 3.5:
    replace the '233' in the following options line (sorry for eventual
    wrap around) by the clock frequency (in megahertz) of your computer,
    // +SP8 +EP8 +W512 +H384 -A -FN +D Declare=BrettDebug=0 Declare=
Typ=0 +KFF13 Declare=Show=233
    then render Brett.inc (as if it were a .pov-file) with these command
    line options.

in POV-Ray 3.1:
    uncomment the line 60 '// #declare Show = 233;' in Brett.inc,
    replace the '233' by the clock frequency (in megahertz) of your Compu
ter,
    then render Brett.inc (as if it were a .pov-file) with the following
    command line options:
    +SP8 +EP8 +W512 +H384 -A -FN +D +KFF13
  

A sequence of demo pictures will be displayed (and when the end is there,

you will know it ...) with a short pause between them (timed by the
megahertz-number). Look and enjoy!



== Do you want to use this stuff? ==

Here is a more detailed explanation:


=== Using Brett.inc in a scene: ===

Just include it, then use the macros (explained below).
No variables named 'Show', 'BrettDebug', 'Nr' may exist at the moment of
the #include.
'BrettSegmente', 'Eps' will be used when defined, else they are declared
with their default values 50, 0.0001.


=== Parameters for Brett.inc when used to create demo scenes: ==
=

  Show: MHz of the computer: automatic 'slide show'
        <=0 or undefined   : no show

  Nr: 1 ... 13      : Number of demo scene (ignored by 'slide show')
      other value or
      undefined     : no scene (for usage as include file)

  Typ: 0: rounded
       1: beveled

  BrettDebug: 0: normal
              1: marker arrows and debug info to #debug-stream
              2: arrows, #debug and 'explosion' (to see how it's done)


=== Demo scenes with POV-Ray version 3.5 ===

Use one of the option-lines below with appropriate values for the
'Declare='-variables as command line options and render like a
.pov scene file

Slide show: see above

Small picture:
+SP8 +EP8 +W320 +H240 -A -F +D Declare=BrettDebug=0 Declare=Typ=0
 Declare=Nr=1

Larger and nicer picture:
+SP8 +EP8 +W1024 +H768 +A0.1 -F +D Declare=BrettDebug=0 Declare=Typ
=0 Declare=Nr=1


=== Demo scenes with POV-Ray-Version 3.1 ===

Un-comment the lines 75-77 in Brett.inc ('#declare ...'), set the variabl
es
to appropriate values, use one of the option-lines below and render like 
a
.pov scene file

Show: see above

Small picture:
+SP8 +EP8 +W320 +H240 -A -F +D 


Larger and nicer picture:
+SP8 +EP8 +W1024 +H768 +A0.1 -F +D 



=== Dictionary ===

All names of macros, variables etc. are in german,
so here is a small dictionary:
  abgerundet      rounded

  Anfang          beginning
  Bogen           (part of a) circular line
  Brett           (wooden) board
  Dicke           thickness
  Ende            end
  erzeugen        to create
  Fass            barrel
  Fehler          error

  Gerade          straight line

  Holz            wood
  Kante           edge

  Letzter         (here:) most recent
  Punkt           point
  Richtung        direction


  Schluss-...     end-..., closing-...
  Schnitt         (here:) intersection
  Senkrechte      perpendicular
  Typ             type (here: rounded/beveled)
  Winkel          angle

Schickard is the name of the inventor of the first satisfactorily working

mechanical calculating machine, built in 1623. I'm working on an animatio
n
showing the operation and inner workings of this device. The demo-scene 6

will create the left and right side parts of this machine.


=== The macros etc. of Brett.inc ===

Purpose: to create an object from a 'sheet' (the volume between the XZ-pl
ane
and the plane parallel to it at y=thickness) by straight and circular c
uts.
Its edges are rounded/beveled by attaching a strip around its circumferen
ce.
The shape is described by giving a starting point and direction (in the
XZ-plane), then 'driving' clockwise around, giving a radius (zero is lega
l)
and an angle by which the direction is to change (in degrees, +:turn righ
t,
-: turn left) for a circular segment, or a length and an angle of 0 degre
es
for a straight segment. Optionally this path may be automatically closed 
by
a straight--circular--straight path with given radius for the circular
segment. The rounding/beveling is created by ATTACHING material to the ou
ter
contour of this figure, so the shape will EXPAND by the radius of roundin
g /
amount of beveling. The code of the demo scene 4 (following a #case (4)
directive) and macros E1, D1 and D2 of scene 13 should make quite clear h
ow
the Brett-macros are used.

Macros:

      BrettAnfang ( thickness, type, rounding_radius, start, direction )
        starts a new object

      BrettKante ( radius_or_length, turn_degrees_or_zero )
        defines a segment of the contour

      BrettMulti ( radius, turn_degrees, number_of_segments )
        defines a sub-divided segment (compare scenes 5 and 6)

      BrettEnde ( radius_for_closure )
        closes the contour (use BrettEnde(-1) if already closed)
      

      Brett ()
        creates the object as a union { ... }

      Segment ( major_radius, minor_radius, angle )
        (internal usage:) creates a segment of a torus/cone-ring
      

      XZ_Senkrechte ( vektor )
        (internal usage)
        gives a normalized vector in the XZ-plane perpendicular
        to the projection of the given vector onto the XZ-plane

      XZ_Winkel ( Vektor1, Vektor2 )
        (internal usage)
        calculates the angle between the projections of the given vectors

        onto the XZ-plane

      XZ_Schnitt ( position_1, direction_1, position_2, direction_2 )
        (internal usage)
        let line_N be the line through position_N in direction_N,
        projected onto the XZ-plane. This macro finds the intersection
        point of line_1 and line_2 and declares 3 variables:
        L1: distance from (position_1 projected onto XZ-plane) to this
            intersection point
        L2: same with position_2
        W : angle between L1 and L2
        (for an application see macro N1 in scene 13)

      BrettkanteErzeugen ( Index )
        (internal usage)

      Saeule ( ... )
        please look at the code and scenes 8 and 9; it's simple

      demo scenes
        selected with a #select directive; see the #case(...) directives
        Nr=1 ... 13: scene 1 ... 13
           0       : no scene (for usage as include file)

Variables:

      Show, Typ, Nr, BrettDebug: see beginning of this text
      Eps           : a small number to avoid coincident surfaces
      BrettSegmente : max. number of segments
      BrettR        : (internal usage) radius for rounding/amount of beve
l
      BrettT        : (internal usage) type
      BrettD        : (internal usage) thickness
      BrettI        : index of the most recent segment's endpoint
      BrettS        : (internal usage) radius for closure
      BrettK[]      : (internal usage) radii / lengths
      BrettP[]      : (internal usage) points
      BrettV[]      : (internal usage) directions
      BrettW[]      : (internal usage) angle between x and BrettV[...]


For further information look at the scenes or ask me ( but allow for a
couple of days for me to react :) ). If you want to look at the inner
workings, try BrettDebug=1 or =2.
Some scenes have parameters at their beginning (after the #case (...));
play with them and have fun!


ATTENTION!
I intend to develop greatly improved macros, but this will take some time

and they will definitely be INCOMPATIBLE with Brett.inc, because the new
macros will allow to specify the OUTER contour (i.e. no expansion due to
padding) and will have many more features, for example other types of
rounding; see the long list of planned features in Brett.inc (in german .
..).

   Sputnik


P.S. If you don't like my indentation, replace all occurrences of
'<space><space>#end' by '#end', and of
'<space><space>}'    by '}'. :)

-- 

-------------------------------------

e-mail: fr### [at] computermuseumfh-kielde
-------------------------------------


Post a reply to this message


Attachments:
Download 'iso-8859-1' (29 KB)

From: Doctor John
Subject: Re: Round/bevel: Include file
Date: 24 Jan 2003 11:42:11
Message: <3e316ce3$1@news.povray.org>


<snip all>
Just a little problem here, Frank. Although at first glance the code looks
amazing and your pic in p.b.i. is impressive, have you actually tested the
file as a demo?
I ran it (twice) last night and the file behaves as though it enters an
infinite loop at the start of parsing.
Checking what Povray was using in the way of my machine's resources gave CPU
usage 98% and Mem usage 0.1% which is the sort of values that I would expect
on a permanent non-processing loop.

BTW Yes, I did wait. Two hours for the first test and 1.5 for the second.

Just to see what the macros do, I'm going to strip the file tonight and test
each section independently. I may even find the source of the problem.

John
--
Run Fast
Run Free
Run Linux


Post a reply to this message

From: Frank 'Sputnik' Rothfuß
Subject: Re: Round/bevel: Include file
Date: 25 Jan 2003 00:06:16
Message: <3E321B47.568D0B52@computermuseum.fh-kiel.de>
Hi John,

sorry for the inconvenience. I've tested very carefully: on one computer
with versions 3.1 and 3.5 (windows 95), on a different computer with 3.1
only (windows 2000). The render starts *almost at once* (delay less than
2 seconds), even at only 233 MHz!

To find out what your problem might be, I downloaded the file and checked
it: perfectly OK here!

Did your newsreader misunderstand the encoding of the attachment (for
example '=3D' in place of a single '='?

Do you have anything unusual in your POVRAY.INI?

At the very end of Brett.inc, the variable 'Show' is used to time a small
pause (typ. 4 seconds) before the start of the next pic of the slide show.
This 15. line, counted from the end, should be

#ifdef (Show) #if (Nr>1&Nr!=10) #while (Show>0) #declare Show = Show-0.01; #end #end
#end

Please check if this is correct in your downloaded version, esp. check if
a line wrap has truncated the '0.01' to '0'. If there is everything OK,
please try the following:
 - delete or comment-out this delay loop, even if it looks OK
 - run with 'BrettDebug=1;', this will activate a protocol of macro
   invocations in the #debug stream
 - render and watch the message window: any activity?
 - also try to render a single pic with Show=0 and Nr=4 (or any other
   integer from 1 to 13)
 - last try: render with Show=0 and Nr=0, this should give only the
   background scene which uses no 'Brett'-macros. (But see the
   postscriptum below)

And never wait too long; when it works, then it is very fast!
Perhaps a new download will help?

Please let me know if your problem persists and what you observe.

   Sputnik

P.S. There are two minor errors:
 (1) change '#local Eps = 0.0001;' to '#declare Eps = 0.001;'
     The demo will run with both statements, but when using
     Brett.inc as include file, Eps will be forgotten.
 (2) When including Brett.inc (without Nr or with Nr=0), the
     background scene will appear, ruining the scene. The code for
     this is the last code block in the file; delete it :( or
     encapsulate it with:
     #ifdef (Nr) #if (Nr>0)
     <the code for background scene>
     #end #end


Post a reply to this message

From: Frank 'Sputnik' Rothfuß
Subject: Re: Round/bevel: Include file
Date: 25 Jan 2003 00:18:17
Message: <3E321E19.8CCE5DAD@computermuseum.fh-kiel.de>
Small typo in the P.S (1):
only switch from '#local' to '#declare', the value should stay at '0.0001'

   Sputnik


Post a reply to this message

From: Frank 'Sputnik' Rothfuß
Subject: Re: Round/bevel: Mini-Tutorial; Test-Arena
Date: 26 Jan 2003 03:26:59
Message: <3E339BD3.8638412C@computermuseum.fh-kiel.de>
Hi,

as requested by Hugo, I've written a little tutorial and
a well-equipped test arena for experimentation, containing
a ready-to-render example. You find both files attached to
this post. Now it should be really very easy to get started
(was easy before, but now even more ... ).
Next step: animation! I'm working at this ...

   Sputnik

-- 

-------------------------------------

e-mail: fr### [at] computermuseumfh-kielde
-------------------------------------


Post a reply to this message


Attachments:
Download 'iso-8859-1' (7 KB) Download 'iso-8859-1' (3 KB)

From: Doctor John
Subject: Re: Round/bevel: Include file
Date: 27 Jan 2003 11:04:56
Message: <3e3558a8$1@news.povray.org>

> Hi John,
>
> sorry for the inconvenience.

No problem, Frank. Thanks for the info and "changes" to the code.
ATM I'm away from my home machine and unfortunately our sysadmins don't
permit the installation of POV (or anything else that might be considered
fun) on our workstations, so I won't be able to test until tonight.

Will keep you updated.

John
--
Run Fast
Run Free
Run Linux


Post a reply to this message

From: Frank 'Sputnik' Rothfuß
Subject: Re: Round/bevel: Include file
Date: 27 Jan 2003 23:25:28
Message: <3E360638.215AE3F7@computermuseum.fh-kiel.de>
Hi John,

... POV might be considered fun... ?
Show your sysadmins a POV *scene* file with formulas,arrays, macros,
if etc., tell them is's a programming language (which is true!)
requiring hard work (also true), and they will permit installation!

   Sputnik

-- 

-------------------------------------

e-mail: fr### [at] computermuseumfh-kielde
-------------------------------------


Post a reply to this message

From: Doctor John
Subject: Re: Round/bevel: Include file
Date: 29 Jan 2003 08:55:31
Message: <3e37dd53@news.povray.org>

news:3E360638.215AE3F7@computermuseum.fh-kiel.de...
Hi John,

>... POV might be considered fun... ?

I'm a masochist

>Show your sysadmins a POV *scene* file with formulas,arrays, macros,
>if etc., tell them is's a programming language (which is true!)
>requiring hard work (also true), and they will permit installation!

You obviously haven't met our sysadmins! Their lack of comprehension of what
is required to keep users happy is exceeded only by their lack of ability in
keeping a large system stable.(We were effectively off-line all day
yesterday, hence no post from me)

I've finally figured out what's going wrong with Brett.inc on my machine!
It's either a minor pov bug or just that the docs need rewriting to make
things clearer.

1. Normally I run pov so:
povray +w800 +h600 +a0.2 +am2 ...... FileName.pov
... and of course it works. Fine, no problem. This is exactly what it says
in the docs.
2. Following the above logic, I run Brett.inc so:
povray +sp8 +ep8 +w512 +h384 -a -f +d Declare=BrettDebug=0 Declare=Typ=0
+kff13 Declare=Show=167 Brett.inc
Nothing happens apart from the initial pov words and copyright stuff. Weird!
3.Put all the bits and pieces from +sp8 to Declare=........167 into an .ini
file named Brett.ini and run so:
povray Brett Brett.inc
Nothing happens except....etc!
4. Put everything into the .ini file (i.e. adding the line
Input_File_Name=Brett.inc) and Lo! and Behold! A Miracle! Let joy be
unbounded! It runs!
...and yes, Frank, it is fast. Nice programming.
So, what's the problem? According to the docs, provided you specify the full
input file name as the last item on the command line you need not prefix it
with +i (quite honestly I forgot that was what we had to do in the "old
days"). This is not entirely true - provided that the file has a .pov, .POV,
.Pov, .POv, .pOv, .pOV or .PoV suffix then it works. As soon as you change
the suffix to something else, then pov hangs without giving any error
messages at all.
Solution: for the time being, all Linux users prefix Brett.inc with +i.

John

P.S. I'm using Brett.inc for my IRTC image! When it's completely finished
I'll send you the image and info about what is used where as an e-mail.

--
Run Fast
Run Free
Run Linux


Post a reply to this message

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