POV-Ray : Newsgroups : povray.newusers : Math expressions in text Server Time
9 Oct 2024 02:14:13 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: <web.61d4aac6e174f468fa65d356592a2d00@news.povray.org>
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


Post a reply to this message

From: Bald Eagle
Subject: Re: Math expressions in text
Date: 4 Jan 2022 18:25:00
Message: <web.61d4d74973c36b761f9dae3025979125@news.povray.org>
"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.

https://news.povray.org/povray.text.scene-files/thread/%3Cweb.610402268669d715e0fed26cde94f1@news.povray.org%3E/

https://news.povray.org/povray.binaries.images/thread/%3C610444e7@news.povray.org%3E/

http://news.povray.org/povray.binaries.images/thread/%3Cweb.610564b1d66467d55e0fed26cde94f1%40news.povray.org%3E/


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: Math expressions in text
Date: 5 Jan 2022 01:00:00
Message: <web.61d532a673c36b76a52f2c989db30a9@news.povray.org>
"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


Post a reply to this message

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


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.