|
![](/i/fill.gif) |
"SharkD" <mik### [at] gmail com> wrote in message
news:4ae8fd66$1@news.povray.org...
>
> Next question: How do I modify a one character text object such that the
> character fits inside a 1x1x1 cube? (Note that I am working only with
> single character strings, so I don't have to worry about what happens with
> larger strings.)
>
Assign a text object to an identifier, then use the min_extent and
max_extent functions to find the dimensions of the resulting object and
scale it accordingly as you add it to the scene:
#declare Letter = text {ttf "arial.ttf","~",1,0}
object {Letter
translate -min_extent(Letter)
scale 1/(max_extent(Letter)-min_extent(Letter))
pigment {rgb <1,1,0>}
}
box {-0.001,1.001 pigment {rgbt 0.7}}
Though you don't need it to, this should work the same with a
multi-character string and should work reasonably well with a lot of other
POV-Ray objects to boot. These functions actually measure the bounding box
of the object, but I think that the bounding box aligns pretty well with the
actual extents of a text object (I didn't yet notice any big differences).
It doesn't align very well with certain CSG objects and I hate to think what
would happen with infinite objects such as planes :-)
Regards,
Chris B.
Post a reply to this message
|
![](/i/fill.gif) |