POV-Ray : Newsgroups : povray.binaries.scene-files : Round/bevel: Include file : Round/bevel: Include file Server Time
2 Sep 2024 04:17:12 EDT (-0400)
  Round/bevel: Include file  
From: Frank 'Sputnik' Rothfuß
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)

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