POV-Ray : Newsgroups : povray.text.scene-files : Bevelled text macro : Bevelled text macro Server Time
8 Jul 2024 11:26:41 EDT (-0400)
  Bevelled text macro  
From: Chris Huff
Date: 20 Dec 2000 16:56:31
Message: <chrishuff-CF42D9.16573920122000@news.povray.org>
This version is slightly more complete than the version posted in 
povray.text.scene-files.

#macro ShearTrans(A, B, C)
    matrix <    A.x, A.y, A.z,
                B.x, B.y, B.z,
                C.x, C.y, C.z,
                0, 0, 0>
#end
#macro BevelText(Font, String, Cuts, BevelAng, BevelDepth, Depth, Offset)
    #local BBox = text {ttf Font, String Depth, Offset}
    union {
        text {ttf Font, String Depth-BevelDepth, Offset}
        intersection {
            #local J=0;
            #while(J<Cuts)
                #local A = 2*pi*J/(Cuts);
                #local CA = cos(radians(BevelAng));
                #local SA = sin(radians(BevelAng));
                text {ttf Font, String BevelDepth, Offset
                    translate -z*(BevelDepth+J*0.0001)
                    ShearTrans(x, y, < cos(A)*SA, sin(A)*SA, CA>/CA)
                }
                #local J=J+1;
            #end
        }
        translate z*BevelDepth
        bounded_by {box {min_extent(BBox), max_extent(BBox)}}
    }
#end

BevelText(Font, String, Cuts, BevelAng, BevelDepth, Depth, Offset)
Font: the name of the font file.
String: the text of the text object.
Cuts: the number of intersections to use to bevel the edges, more is 
better, but slower. You can use any positive number, but multiples of 4 
work well.
BevelAng: the angle of the bevel.
BevelDepth: the distance the bevel extends front-to-back.
Depth: the total front-to-back thickness of the final object.
Offset: the offset vector of the text object. Using an offset along the 
z-axis won't work, but other offsets should be fine.

Note that this macro doesn't work well with sharp corners, though using 
more cuts will reduce the problems.

-- 
Christopher James Huff
Personal: chr### [at] maccom, http://homepage.mac.com/chrishuff/
TAG: chr### [at] tagpovrayorg, http://tag.povray.org/

<><


Post a reply to this message

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