ルギア君の戯言

雑多な記事。

5年2月26日 (日)

みんな「みーっつ! みんな笑顔であかるい世界!」
Everyone: THIRD! SMILES GO FOR MILES!
ドンちゃん「よし、今日も仕事始め!」
Don: Then, start your work!


...


Kirlun*1: Hi.
Lugia Kun: Hi.
Kirlun: Lugia Kun, what are you doing?
Lugia Kun: I'm writing program for converting SVG to POV-Ray data.
Kirlun: POV-Ray data?
Lugia Kun: Yes, I want to use path data from SVG in POV-Ray file.
Kirlun: SVG is 2D data, but POV-Ray is 3D data. How do you convert these files?
Lugia Kun: Ah, I only want to convert to POV-Ray "Prism" data.
Kirlun: I see.
Lugia Kun: The path data of SVG is short data. But, the Bezier spline data of POV-Ray is little long data.
Kirlun: Why?
Lugia Kun: For example, SVG data is...

m 0 c 1 2 3 4 5 6 l 7 8 9 c 10 11 12 13 14 15 l 0 z

Lugia Kun: 0 to 15 is coordinates.
Kirlun: Uh.
Lugia Kun: "m" is a beginning coordinate, "c" means "curve to", "l" means "line to", and "z" means "end".
Kirlun: Uh-huh.
Lugia Kun: But POV-Ray Bezier spline prism data is...

{0 1 2 3} {3 4 5 6} {6 6 7 7} {7 7 8 8} {8 8 9 9} {9 10 11 12} {12 13 14 15} {15 15 0 0}

Lugia Kun: I enclosed every four points in parentheses.
Kirlun: Is POV-Ray prism data always Bezier curve?
Lugia Kun: Yes, it is. So same coord appears many times.
Kirlun: Is there merit to do this?
Lugia Kun: Yes, there is. For example, POV-Ray doesn't accept Japanese and Japanese font.
Kirlun: I've heard that before.
Lugia Kun: If you use this program, you can use Japanese text in POV-Ray!
Kirlun: Really?
Lugia Kun: First, convert text data to SVG path data in Inkscape.
Kirlun: Uh-huh.
Lugia Kun: Open SVG file in text editor, and copy the path data which begins in "m" or "M" to the program input.
Kirlun: Huh.
Lugia Kun: Press Ctrl + D. *2
Kirlun: Ctrl + D means "End of File", doesn't it?
Lugia Kun: Yes, it does. Answer the question, and copy the result POV-Ray code to your POV-Ray file.
Kirlun: I see.


To be continue...

*1:キリルン

*2:Windows は Ctrl + Z