![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Mucking about with date algorithms.
The following macros will generate a calendar as a string object union for a
specified month/year (yucky example attached):
#macro MakeTOU(MyStr, YTrans) // modify this according to taste
text {
ttf // font type (only TrueType format for now)
"crystal.ttf", // Microsoft Windows-format TrueType font file name
MyStr, // the string to create
1, // the extrusion depth
0 // inter-character spacing
translate y*YTrans
}
#end
#macro MakeCal(Year, Month) // main date algo. macro
#local YTrans = 0;
#local YChange = 1.5;
#local TempStr = "";
#local Months = array[12]{
"January","Febuary","March","April",
"May","June","July","August",
"September","October","November","December"
};
#local Days = array[7]{"Su","Mo","Tu","We","Th","Fr","Sa"};
#local Day = 1;
#local RealYear = Year;
#if (Month < 3)
#local Month = Month + 12;
#local Year=Year-1;
#end
#local JulDay = Day + int((153 * Month - 457) / 5) + 365 * Year + floor(Year /
4) -
floor(Year / 100) + floor(Year / 400) + 1721118.5;
MakeTOU(concat(Months[Month-1], " ",str(RealYear,0,0)), YTrans)
#local YTrans = YTrans - YChange;
#local Temp = 0;
#while(Temp<7)
#local TempStr=concat(TempStr,Days[Temp], " ")
#local Temp = Temp+1;
#end
MakeTOU(TempStr, YTrans)
#local TempStr= "";
#local YTrans = YTrans - YChange;
#local JulDay = JulDay - 1;
#local LastDay = -1;
#local CalDay = 0;
#local First = 1;
#while(LastDay < CalDay)
#local LastDay = CalDay;
#local JulDay = JulDay + 1;
#local ModDInt = floor(mod(JulDay + 2, 7));
#local Z = floor(JulDay - 1721118.5);
#local R = JulDay - 1721118.5 - Z;
#local G = Z - 0.25;
#local A = floor(G / 36524.25);
#local B = A - floor(A / 4);
#local CalYear = floor((B+G) / 365.25);
#local C = B + Z - floor(365.25 * CalYear);
#local CalMonth = int((5 * C + 456) / 153);
#local CalDay = C - int((153 * CalMonth - 457) / 5) + R;
#if (CalMonth > 12)
#local CalYear = CalYear + 1;
#local CalMonth = CalMonth - 12;
#end
#if(First | CalDay > 1)
#local First = 0;
#if(CalDay = 1)
#local Temp = 0;
#local TempStr = "";
#while (Temp < ModDInt)
#local TempStr = concat(TempStr, " ")
#local Temp = Temp + 1;
#end
#end
#local TempStr = concat(TempStr, str(CalDay,2,0)," ")
#if(ModDInt = 6)
MakeTOU(TempStr, YTrans)
#local TempStr = "";
#local YTrans = YTrans - YChange;
#end
#end
#end
MakeTOU(TempStr, YTrans)
#end
union{ // example
MakeCal(2001,6)
pigment{Red}
translate x*-7
translate y*4
}
--
#macro G(D,E,F)#local I=array[3]{D,E,F}#local B=0;triangle{#while(
B<3)#while(I[B])A[mod(I[B],10)]+#local I[B]=div(I[B],10);#end<-5,-
2,9>#local B=B+1;#end}#end #local A=array[7]{x,x*2,x*4,y,y*2,y*4,z
}light_source{-x*6-z*9,1}mesh{G(105,10,146)G(105,246,10)G(105,56,
146)G(105,1256,246)G(1256,126,220)G(22156,2216,201)pigment{rgb 1}}//TM
Post a reply to this message
Attachments:
Download 'c1.jpg' (11 KB)
Preview of image 'c1.jpg'
![c1.jpg](/povray.binaries.images/attachment/%3C3bfbe3ff%40news.povray.org%3E/c1.jpg?preview=1)
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
The week starts with Monday!!!
I don't work at Sundays ... why does everybody do this wrong ?
SCNR ....
--
Jan Walzer <jan### [at] lzer net>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
in news:3bfbe3ff@news.povray.org Tom Melly wrote:
> Mucking about with date algorithms.
>
Moving :
MakeTOU(concat(Months[Month-1], " ",str(RealYear,0,0)), YTrans)
to the line above:
#if (Month < 3)
prevents an error for the months jan and feb.
Ingo
--
Photography: http://members.home.nl/ingoogni/
Pov-Ray : http://members.home.nl/seed7/
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Jan Walzer schrieb in Nachricht <3bfbe9a9@news.povray.org>...
>The week starts with Monday!!!
>I don't work at Sundays ... why does everybody do this wrong ?
OT: Do you have to earn your free day by the work of the week or do you get
it for free and therefore are able to work the next few days?
Marc-Hendrik
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"ingo" <ing### [at] home nl> wrote in message
news:Xns### [at] povray org...
>
> Moving :
> MakeTOU(concat(Months[Month-1], " ",str(RealYear,0,0)), YTrans)
> to the line above:
> #if (Month < 3)
> prevents an error for the months jan and feb.
>
>
> Ingo
>
Already dealt with - RealYear is a copy of Year prior to the jan-mar thing -
However, your suggestion save needing RealYear in the first place... Ta.
I've got a bit of enhancement and optomising to do, and will post an update
later.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Jan Walzer" <jan### [at] lzer net> wrote in message
news:3bfbe9a9@news.povray.org...
> The week starts with Monday!!!
> I don't work at Sundays ... why does everybody do this wrong ?
>
I'll parametise that in the next version (as well as height-offset and
suchlike).
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Tom Melly" <tom### [at] tomandlu co uk> wrote in message
news:3bfbe3ff@news.povray.org...
> Mucking about with date algorithms.
Do you have the getdate.bat system to make povray read the system clock
and generate today's calendar?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Okay, posted improved version with more params to b.scene-files...
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
"Bill DeWitt" <bde### [at] cfl rr com> wrote in message
news:3bfc0b26$1@news.povray.org...
>
> Do you have the getdate.bat system to make povray read the system
clock
> and generate today's calendar?
>
No, the scene uses pov lang to implement algorithms I found on a website (or
did you mean in general?)
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
intereting idea, now I have to make a nice background for mine.....
G.
Tom Melly <tom### [at] tomandlu co uk> wrote in message
news:3bfbe3ff@news.povray.org...
> Mucking about with date algorithms.
>
> The following macros will generate a calendar as a string object union for
a
> specified month/year (yucky example attached):
>
> #macro MakeTOU(MyStr, YTrans) // modify this according to taste
> text {
> ttf // font type (only TrueType format for now)
> "crystal.ttf", // Microsoft Windows-format TrueType font file name
> MyStr, // the string to create
> 1, // the extrusion depth
> 0 // inter-character spacing
> translate y*YTrans
> }
> #end
>
> #macro MakeCal(Year, Month) // main date algo. macro
> #local YTrans = 0;
> #local YChange = 1.5;
> #local TempStr = "";
> #local Months = array[12]{
> "January","Febuary","March","April",
> "May","June","July","August",
> "September","October","November","December"
> };
> #local Days = array[7]{"Su","Mo","Tu","We","Th","Fr","Sa"};
> #local Day = 1;
> #local RealYear = Year;
> #if (Month < 3)
> #local Month = Month + 12;
> #local Year=Year-1;
> #end
> #local JulDay = Day + int((153 * Month - 457) / 5) + 365 * Year +
floor(Year /
> 4) -
> floor(Year / 100) + floor(Year / 400) + 1721118.5;
> MakeTOU(concat(Months[Month-1], " ",str(RealYear,0,0)), YTrans)
>
> #local YTrans = YTrans - YChange;
>
> #local Temp = 0;
> #while(Temp<7)
> #local TempStr=concat(TempStr,Days[Temp], " ")
> #local Temp = Temp+1;
> #end
> MakeTOU(TempStr, YTrans)
> #local TempStr= "";
>
> #local YTrans = YTrans - YChange;
>
> #local JulDay = JulDay - 1;
> #local LastDay = -1;
> #local CalDay = 0;
> #local First = 1;
> #while(LastDay < CalDay)
> #local LastDay = CalDay;
> #local JulDay = JulDay + 1;
> #local ModDInt = floor(mod(JulDay + 2, 7));
> #local Z = floor(JulDay - 1721118.5);
> #local R = JulDay - 1721118.5 - Z;
> #local G = Z - 0.25;
> #local A = floor(G / 36524.25);
> #local B = A - floor(A / 4);
> #local CalYear = floor((B+G) / 365.25);
> #local C = B + Z - floor(365.25 * CalYear);
> #local CalMonth = int((5 * C + 456) / 153);
> #local CalDay = C - int((153 * CalMonth - 457) / 5) + R;
> #if (CalMonth > 12)
> #local CalYear = CalYear + 1;
> #local CalMonth = CalMonth - 12;
> #end
> #if(First | CalDay > 1)
> #local First = 0;
> #if(CalDay = 1)
> #local Temp = 0;
> #local TempStr = "";
> #while (Temp < ModDInt)
> #local TempStr = concat(TempStr, " ")
> #local Temp = Temp + 1;
> #end
> #end
> #local TempStr = concat(TempStr, str(CalDay,2,0)," ")
> #if(ModDInt = 6)
> MakeTOU(TempStr, YTrans)
> #local TempStr = "";
> #local YTrans = YTrans - YChange;
> #end
> #end
> #end
> MakeTOU(TempStr, YTrans)
> #end
>
> union{ // example
> MakeCal(2001,6)
> pigment{Red}
> translate x*-7
> translate y*4
> }
>
>
> --
> #macro G(D,E,F)#local I=array[3]{D,E,F}#local B=0;triangle{#while(
> B<3)#while(I[B])A[mod(I[B],10)]+#local I[B]=div(I[B],10);#end<-5,-
> 2,9>#local B=B+1;#end}#end #local A=array[7]{x,x*2,x*4,y,y*2,y*4,z
> }light_source{-x*6-z*9,1}mesh{G(105,10,146)G(105,246,10)G(105,56,
> 146)G(105,1256,246)G(1256,126,220)G(22156,2216,201)pigment{rgb 1}}//TM
>
>
>
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |