 |
 |
|
 |
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I recently made a macro to do almost-perfctly-centered text. Anyone
interested?
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 8 Nov 2001 07:52:03 -0500, "Mahalis" <don### [at] fakey com> wrote:
> I recently made a macro to do almost-perfctly-centered text. Anyone
> interested?
I'm interested. What is wrong with centered around bounding box? Or is it the
same? Could you provide some image to show atventage of your
"almost-perfctly-center" ?
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
I'm not sure what the advantage is over 'centered bounding boxes' (to be
perfectly honest I've never heard of using such a technique to do this).
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
"W³odzimierz ABX Skiba" <abx### [at] babilon org> wrote in message
news:nh0lutchh0ph8b0olp9pvohdq94tklu3pi@4ax.com...
> On Thu, 8 Nov 2001 07:52:03 -0500, "Mahalis" <don### [at] fakey com>
wrote:
> > I recently made a macro to do almost-perfctly-centered text. Anyone
> > interested?
>
> I'm interested. What is wrong with centered around bounding box? Or is it
the
> same? Could you provide some image to show atventage of your
> "almost-perfctly-center" ?
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35
Post a reply to this message
Attachments:
Download 'text.png' (11 KB)
Preview of image 'text.png'

|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mahalis wrote:
>
> I'm not sure what the advantage is over 'centered bounding boxes' (to be
> perfectly honest I've never heard of using such a technique to do this).
>
See the Center_Object() macro in 'shapes.inc'
BTW, you should know that you should not post binaries in this group.
Christoph
--
Christoph Hormann <chr### [at] gmx de>
IsoWood include, radiosity tutorial, TransSkin and other
things on: http://www.schunter.etc.tu-bs.de/~chris/
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 8 Nov 2001 08:24:48 -0500, "Mahalis" <don### [at] fakey com> wrote:
> I'm not sure what the advantage is over 'centered bounding boxes' (to be
> perfectly honest I've never heard of using such a technique to do this).
With MegaPOV and POV 3.5 you can find useful vector functions min_extent and
max_extent to get lower and higher corner of bounding object. With this you can
find center and size of any object. It is not perfect center but good enough in
almost all situations. You can use it as:
#declare Text=text {ttf "crystal.ttf" "Mahalis" 2 0};
#declare Min=min_extent(Text);
#declare Max=max_extent(Text);
#declare Size=Max-Min;
#declare Center=(Max+Min)/2;
object{Text translate -Center}
You can also find Center_Object in 3.5's standard include files.
So, is your solution still almost-perfect ?
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Well, I see 6 lines of code there, as opposed to:
ctext("MaHaLiS","C:\Windows\Fonts\ocrb.ttf",0.125,yes,texture{pigment{Blue}
finish{reflection 0.25 metallic}},interior{})
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
"W³odzimierz ABX Skiba" <abx### [at] babilon org> wrote in message
news:l82lutola6vcavbh9qopoho3h7m1itbvjo@4ax.com...
> On Thu, 8 Nov 2001 08:24:48 -0500, "Mahalis" <don### [at] fakey com>
wrote:
> > I'm not sure what the advantage is over 'centered bounding boxes' (to be
> > perfectly honest I've never heard of using such a technique to do this).
>
> With MegaPOV and POV 3.5 you can find useful vector functions min_extent
and
> max_extent to get lower and higher corner of bounding object. With this
you can
> find center and size of any object. It is not perfect center but good
enough in
> almost all situations. You can use it as:
>
> #declare Text=text {ttf "crystal.ttf" "Mahalis" 2 0};
> #declare Min=min_extent(Text);
> #declare Max=max_extent(Text);
> #declare Size=Max-Min;
> #declare Center=(Max+Min)/2;
> object{Text translate -Center}
>
> You can also find Center_Object in 3.5's standard include files.
> So, is your solution still almost-perfect ?
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 8 Nov 2001 08:51:00 -0500, "Mahalis" <don### [at] fakey com> wrote:
> Well, I see 6 lines of code there, as opposed to:
> ctext("MaHaLiS","C:\Windows\Fonts\ocrb.ttf",0.125,yes,texture{pigment{Blue}
> finish{reflection 0.25 metallic}},interior{})
Oh, you want count?
So let's simplify this 6 lines, remove not necessary space and group to macro
#macro Center(O)object{O translate-(max_extent(O)+min_extent(O))/2}#end
is your macro shorten? :-)
Note it works fine with all objects.
Center(text{ttf "crystal.ttf" "Mahalis" 2 0})
Center(sphere{0,1})
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Poo. Well.. that only works in POV 3.5, whereas mine works equally well in
3.1 and 3.5.
Look, I'm really scraping the bottom of the barrel here.. :-)
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
"W³odzimierz ABX Skiba" <abx### [at] babilon org> wrote in message
news:qm3lutsk4ug928itbjhpounodvn89m2u0b@4ax.com...
> On Thu, 8 Nov 2001 08:51:00 -0500, "Mahalis" <don### [at] fakey com>
wrote:
>
> > Well, I see 6 lines of code there, as opposed to:
> >
ctext("MaHaLiS","C:\Windows\Fonts\ocrb.ttf",0.125,yes,texture{pigment{Blue}
> > finish{reflection 0.25 metallic}},interior{})
>
> Oh, you want count?
> So let's simplify this 6 lines, remove not necessary space and group to
macro
>
> #macro Center(O)object{O translate-(max_extent(O)+min_extent(O))/2}#end
>
> is your macro shorten? :-)
> Note it works fine with all objects.
>
> Center(text{ttf "crystal.ttf" "Mahalis" 2 0})
> Center(sphere{0,1})
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Mahalis" <don### [at] fakey com> wrote in message
news:3beaa261$1@news.povray.org...
> Poo. Well.. that only works in POV 3.5, whereas mine works equally well in
> 3.1 and 3.5.
> Look, I'm really scraping the bottom of the barrel here.. :-)
No your not - your grasping at straws ;)
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Okay, okay, I get the message. No one wants my poor little macro [sniff]
<g>
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
"Mahalis" <don### [at] fakey com> wrote in message
news:3beaab8f@news.povray.org...
> Okay, okay, I get the message. No one wants my poor little macro [sniff]
> <g>
What macro?
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 8 Nov 2001 10:59:44 -0500, "Mahalis" <don### [at] fakey com> wrote:
> Okay, okay, I get the message. No one wants my poor little macro [sniff]
> <g>
That's not true. I said to you I'm interested at first post. There could be
always interesting technic. But you tried fight. I showed source. Where is your?
:-)
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
On Thu, 08 Nov 2001 15:02:46 +0100, W�odzimierz ABX Skiba <abx### [at] babilon org>
wrote:
> #macro Center(O)object{O translate-(max_extent(O)+min_extent(O))/2}#end
>
> Center(sphere{0,1})
Hmmm, not very brillant example :-)
ABX
--
#declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb 1}}
union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{ //ABX
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)}
contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient 1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
#macro ctext(txt,fon,thk,ac,tex,in)
#local len=strlen(txt)*0.55
#if(ac)
text{ttf fon txt thk,0 texture{tex} interior{in}translate
<-(len/2),-0.375,-(thk/2)>}
#else
text{ttf fon txt thk,0 texture{tex} interior{in}translate
<-(len/2),0,-(thk/2)>}
#end
#end
txt=Text
fon=Font
thk=Thickness
ac=Absolute center
tex=Texture
in=Interior
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
"W³odzimierz ABX Skiba" <abx### [at] babilon org> wrote in message
news:ik4nutoba5si6hj6fo6ga3h4k3a16741qr@4ax.com...
> On Thu, 8 Nov 2001 10:59:44 -0500, "Mahalis" <don### [at] fakey com>
wrote:
> > Okay, okay, I get the message. No one wants my poor little macro [sniff]
> > <g>
>
> That's not true. I said to you I'm interested at first post. There could
be
> always interesting technic. But you tried fight. I showed source. Where is
your?
> :-)
>
> ABX
> --
> #declare _=function(a,b,x){((a^2)+(b^2))^.5-x}#default {pigment{color rgb
1}}
> union{plane{y,-3}plane{-x,-3}finish{reflection 1 ambient 0}}isosurface{
//ABX
>
function{_(x-2,y,1)|_((x+y)*.7,z,.1)|_((x+y+2)*.7,z,.1)|_(x/2+y*.8+1.5,z,.1)
}
> contained_by{box{<0,-3,-.1>,<3,0,.1>}}translate z*15finish{ambient
1}}//POV35
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Mahalis <don### [at] fakey com> wrote:
: #local len=strlen(txt)*0.55
Do you really think this is completely accurate independently of the font
and characters used?
I would say that min_extent() and max_extent() are much more accurate than
that.
--
#macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
],13),8)-3,10>#end blob{N(array[6]{11117333955,
7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
Yes, I suppose they are. Phoo, and I thought I had something useful :-(
--
//Mahalis
camera{location<0,0.25,-2> look_at 0.5*y} #declare T=texture{pigment{crackle
scale 0.5 rotate 90 turbulence 0.75 color_map{[0 rgb 1][0.05 rgb 1][0.1
rgb<1,0.25,1>][0.25 rgbf 1][1 rgbf 1]}} finish{ambient 1}} #declare
c=difference{torus{0.5,0.1 rotate -90*x}box{<0.7,0,0.2>,<-0.7,-0.7,-0.2>}}
merge{object{c translate<0.5,0.5,0>} object{c translate<-0.5,0.5,0>}
cylinder{<1,0.5,0>,<1,0,0>,0.1} cylinder{<-1,0.5,0>,<-1,0,0>,0.1}
cylinder{0.5*y,0,0.1} texture{T}}
--
"Warp" <war### [at] tag povray org> wrote in message
news:3bebd43f@news.povray.org...
> Mahalis <don### [at] fakey com> wrote:
> : #local len=strlen(txt)*0.55
>
> Do you really think this is completely accurate independently of the
font
> and characters used?
>
> I would say that min_extent() and max_extent() are much more accurate
than
> that.
>
> --
> #macro N(D,I)#if(I<6)cylinder{M()#local D[I]=div(D[I],104);M().5,2pigment{
> rgb M()}}N(D,(D[I]>99?I:I+1))#end#end#macro M()<mod(D[I],13)-6,mod(div(D[I
> ],13),8)-3,10>#end blob{N(array[6]{11117333955,
> 7382340,3358,3900569407,970,4254934330},0)}// - Warp -
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|  |
|
 |
In article <3bec4bce$1@news.povray.org> , "Mahalis" <don### [at] fakey com>
wrote:
> Yes, I suppose they are. Phoo, and I thought I had something useful :-(
Well, you had good intent, just the implementation had a few problems...
Thorsten
____________________________________________________
Thorsten Froehlich, Duisburg, Germany
e-mail: tho### [at] trf de
Visit POV-Ray on the web: http://mac.povray.org
Post a reply to this message
|
 |
|  |
|  |
|
 |
|
 |
|  |
|
 |