|
|
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
|
|
|
|
In article <3a463448@news.povray.org>, "Dave Blandston"
<gra### [at] earthlinknet> wrote:
> With a slight modification, this macro works with any object, not just
> text... Excellent macro, Chris!
Well, depends on what you mean by "bevelling" for those other
objects...a bevelled box would require very different calculations than
a bevelled cylinder , and there are far more efficient ways of doing
those objects than shearing and CSG'ing a bunch of pieces(and how do you
bevel the edges of a sphere or torus?). Also, your object needs to be
aligned so that the part being bevelled is up against a plane and no
other parts are on the other side or within the bevelling depth of that
plane. This is what kept me from writing a general "BevelObject()" macro.
--
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
|
|
|
|
In article <3a469d0a@news.povray.org>, "Dave Blandston"
<gra### [at] earthlinknet> wrote:
> Ummm... yeah, that's what I meant - I used the macro to bevel a frame
> around some text, and it works very well. I'll put up another picture
> in the images group to illustrate.
I see...I was thinking in more 3D terms, where a bevelled cylinder would
be a short cylinder and two capping cones, and a bevelled box would have
bevels on all 12 edges. For stuff aligned on a plane, like this, it will
work fine.
--
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
|
|