POV-Ray : Newsgroups : povray.newusers : Math expressions in text Server Time 3 Jul 2022 22:10:01 EDT (-0400)
 Math expressions in text (Message 1 to 4 of 4)
 From: Subrahmanyam Pattamatta Subject: Math expressions in text Date: 4 Jan 2022 15:20:00 Message:

{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.61d4aac6e174f468fa65d356592a2d00%40news.povray.org",
"dateCreated": "2022-01-04T20:20:00+00:00",
"datePublished": "2022-01-04T20:20:00+00:00",
"author": {
"@type": "Person",
"name": "Subrahmanyam Pattamatta"
}
}
Hello,

I have recently started using POV-Ray for making illustrations/schematics for a
material science research article. The figures came out really well. Thanks to
POV-Ray developers.

I wonder if there is a way to insert mathematical expressions as text into the
figure (example: say latex symbols $\alpha + \beta = 0$) directly into the scene
file or do I have to render the image in POV-Ray, save it to .png and later cut
and paste latex equations into the .png file ?

Thank you,
Subrahmanyam Pattamatta
Research Fellow
University of Hong Kong

 From: Bald Eagle Subject: Re: Math expressions in text Date: 4 Jan 2022 18:25:00 Message:

{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.61d4d74973c36b761f9dae3025979125%40news.povray.org",
"headline": "Re: Math expressions in text",
"dateCreated": "2022-01-04T23:25:00+00:00",
"datePublished": "2022-01-04T23:25:00+00:00",
"author": {
"@type": "Person",
"name": "Bald Eagle"
}
}
"Subrahmanyam Pattamatta" <nomail@nomail> wrote:

> I wonder if there is a way to insert mathematical expressions as text into the
> figure (example: say latex symbols $\alpha + \beta = 0$) directly into the scene
> file or do I have to render the image in POV-Ray, save it to .png and later cut
> and paste latex equations into the .png file ?

You can likely do anything you'd like, but as clipka would say, just keep in
mind that POV-Ray is a raytracer and not a word-processor or equation editor.

http://www.f-lohmueller.de/pov_tut/all_shapes/shapes604e.htm

So, just choose whatever font you want to use, and you can arrange your text and
symbols however you'd like. You may have to "draw" your own symbols using
cylinders, segments of tori, etc, and use scaling to get them to look right, but
it's doable.

You may also benefit from jr's tabulated macro to make tables and arrange the
terms of your equations that way.


 From: Tor Olav Kristensen Subject: Re: Math expressions in text Date: 5 Jan 2022 01:00:00 Message:

{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#web.61d532a673c36b76a52f2c989db30a9%40news.povray.org",
"headline": "Re: Math expressions in text",
"dateCreated": "2022-01-05T06:00:00+00:00",
"datePublished": "2022-01-05T06:00:00+00:00",
"author": {
"@type": "Person",
"name": "Tor Olav Kristensen"
}
}
"Subrahmanyam Pattamatta" <nomail@nomail> wrote:
> Hello,
>
> I have recently started using POV-Ray for making illustrations/schematics for a
> material science research article. The figures came out really well. Thanks to
> POV-Ray developers.
>
> I wonder if there is a way to insert mathematical expressions as text into the
> figure (example: say latex symbols $\alpha + \beta = 0$) directly into the scene
> file or do I have to render the image in POV-Ray, save it to .png and later cut
> and paste latex equations into the .png file ?

Hi Subrahmanyam

Have you considered rendering the mathematical expressions into high resolution
png-files with some other tool and then bringing them into the POV-Ray scenes by
UV-mapping the png-files onto objects ?

https://wiki.povray.org/content/Reference:UV_Mapping

--
Tor Olav
http://subcube.com
https://github.com/t-o-k

 From: Alain Martel Subject: Re: Math expressions in text Date: 5 Jan 2022 12:44:17 Message: <61d5d8f1@news.povray.org>

{
"@context": "https://schema.org",
"@type": "DiscussionForumPosting",
"@id": "#61d5d8f1%40news.povray.org",
"headline": "Re: Math expressions in text",
"dateCreated": "2022-01-05T17:44:17+00:00",
"datePublished": "2022-01-05T17:44:17+00:00",
"author": {
"@type": "Person",
"name": "Alain Martel"
}
}
Le 2022-01-04 à 15:15, Subrahmanyam Pattamatta a écrit :
> Hello,
>
> I have recently started using POV-Ray for making illustrations/schematics for a
> material science research article. The figures came out really well. Thanks to
> POV-Ray developers.
>
> I wonder if there is a way to insert mathematical expressions as text into the
> figure (example: say latex symbols $\alpha + \beta = 0$) directly into the scene
> file or do I have to render the image in POV-Ray, save it to .png and later cut
> and paste latex equations into the .png file ?
>
> Thank you,
> Subrahmanyam Pattamatta
> Research Fellow
> University of Hong Kong
>

You may use a text object. You can't directly use \alpha and \beta, but
you can use the unicode code for those. Obviously, you need to chose a
font where the Greek alphabet is defined.

You can also create an image file showing your equation and apply it to
some object. Here, the simplest way is to have a box with an image_map
as pigment using the image :

box{0, <1, 1, 0.0001> pigment{image_map{png "equation.png"}} scale<20,
1, 1> translate Final_Location}

The image could be a jpeg or a gif if you want, just replace the «png»
with «jpeg» or «gif».
Change the name of the file to whatever name you are using.
Place the image file in the same folder as your scene file.
The image is initially mapped from <0,0>to <1,1>.
Then, you scale it according to how wide it is compared to it's height.
Finally, you can translate to wherever you want it to show up.

If you use a png file, you can have an alpha channel to make the
background transparent.