POV-Ray : Newsgroups : povray.newusers : image_map to tilted and rotated triangle centered and scaled Server Time
28 Mar 2024 07:19:04 EDT (-0400)
  image_map to tilted and rotated triangle centered and scaled (Message 1 to 10 of 10)  
From: Molly-J
Subject: image_map to tilted and rotated triangle centered and scaled
Date: 27 Mar 2022 22:20:00
Message: <web.62411a4bab3fdb5f9cded0992eac0897@news.povray.org>
I am going mad trying to project image maps onto polygons that are not in the
x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
points so all I have to do is create each triangle using sets of the 32
vertices. BUT . . . .

I cannot work out how to project the 20 image_map pigments properly. Image_map
pigments only seem to work on polygons normal to the Z axis and left corner at
0,0 XY

The suggestion that I create each triangle at 0,0 and then translate/rotate them
to the icosahedron would be just fine if i had those numbers. (I do not)

There must exist another way, as the current limitation is ludicrously
un-useful. Everybody aplying pictures to polyhedra would have exactly the same
problem.
What am I missing?

Is it possible to translate the triangle by translating its individual points?
That I might be able to do, but I can't work out how.


The ultimate goal is a Dymaxion type world map on an Icosahedron.


Post a reply to this message


Attachments:
Download 'test-ico.png' (62 KB)

Preview of image 'test-ico.png'
test-ico.png


 

From: jr
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 28 Mar 2022 08:45:00
Message: <web.6241acc4ccfe2900fc0c8de6cde94f1@news.povray.org>
hi,

"Molly-J" <nomail@nomail> wrote:
> I am going mad trying to project image maps onto polygons that are not in the
> x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
> typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
> points so all I have to do is create each triangle using sets of the 32
> vertices. BUT . . . .
>
> I cannot work out how to project the 20 image_map pigments properly. Image_map
> pigments only seem to work on polygons normal to the Z axis and left corner at
> 0,0 XY

<https://wiki.povray.org/content/Reference:Image_Map>

once you've created the image_map, you'll want to scale it to correct
proportions, eg if the source is 1920x1080, the scale ought to read
'<1.92,1.08,1>'.


> The suggestion that I create each triangle at 0,0 and then translate/rotate them
> to the icosahedron would be just fine if i had those numbers. (I do not)

ok, I'll stop here 'coz confused, above you wrote "I have the XYZ coordinates
for the points".

if you do have those coords, create yr object in position (near origin, "image
is projected onto the object as though there were a slide projector somewhere in
the -z-direction"), then translate.  hth.


regards, jr.


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 28 Mar 2022 09:35:00
Message: <web.6241b916ccfe2900702815af89db30a9@news.povray.org>
"Molly-J" <nomail@nomail> wrote:
> I am going mad trying to project image maps onto polygons that are not in the
> x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
> typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
> points so all I have to do is create each triangle using sets of the 32
> vertices. BUT . . . .
>
> I cannot work out how to project the 20 image_map pigments properly. Image_map
> pigments only seem to work on polygons normal to the Z axis and left corner at
> 0,0 XY
>
> The suggestion that I create each triangle at 0,0 and then translate/rotate them
> to the icosahedron would be just fine if i had those numbers. (I do not)
>
> There must exist another way, as the current limitation is ludicrously
> un-useful. Everybody aplying pictures to polyhedra would have exactly the same
> problem.
> What am I missing?
>
> Is it possible to translate the triangle by translating its individual points?
> That I might be able to do, but I can't work out how.
>
>
> The ultimate goal is a Dymaxion type world map on an Icosahedron.

Hi Molly

Perhaps the code I posted in this thread can be useful for you:

From: Tor Olav Kristensen
Subject: How to transform a triangle into another
Date: 2002-10-02 19:41:55
http://news.povray.org/povray.text.tutorials/thread/%3C3D9B843D.E5392CD0%40hotmail.com%3E/

If so, then it is important to replace the 4 first lines in the
Triangle2Triangle_Trans macro (and probably in the Pyramid2Pyramid_Trans macro)
with the corrected ones in my second post.

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


Post a reply to this message

From: Alain Martel
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 28 Mar 2022 11:23:31
Message: <6241d2f3$1@news.povray.org>
Le 2022-03-27 à 22:18, Molly-J a écrit :
> I am going mad trying to project image maps onto polygons that are not in the
> x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
> typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
> points so all I have to do is create each triangle using sets of the 32
> vertices. BUT . . . .
> 
> I cannot work out how to project the 20 image_map pigments properly. Image_map
> pigments only seem to work on polygons normal to the Z axis and left corner at
> 0,0 XY
> 
> The suggestion that I create each triangle at 0,0 and then translate/rotate them
> to the icosahedron would be just fine if i had those numbers. (I do not)
> 
> There must exist another way, as the current limitation is ludicrously
> un-useful. Everybody aplying pictures to polyhedra would have exactly the same
> problem.
> What am I missing?
> 
> Is it possible to translate the triangle by translating its individual points?
> That I might be able to do, but I can't work out how.
> 
> 
> The ultimate goal is a Dymaxion type world map on an Icosahedron.
> 

In your case, it may be OK to use the spherical mapping for your 
image_map, making sure that the isocahedron is modelled centred at the 
origin. For that you need a single image showing every faces. Ideally, 
that image will have a 2:1 aspect ratio.

Add «map_type 1» at the beginning of the image_map statement. There will 
be some distortion, but, in this case, it'll be minimal.

Another option is to use UV mapping. For that, you need to declare your 
icosahedron as a mesh object.

If that's not an option, like you have individual images for each faces, 
you need to create each triangles at the origin parallel to the X-Y 
plane, rotate them correctly, then translate them to their final location.


Post a reply to this message

From: Leroy
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 28 Mar 2022 14:30:00
Message: <web.6241fd73ccfe2900b78ae31df712fc00@news.povray.org>
"Molly-J" <nomail@nomail> wrote:
> I am going mad trying to project image maps onto polygons that are not in the
> x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
> typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
> points so all I have to do is create each triangle using sets of the 32
> vertices. BUT . . . .
>
> I cannot work out how to project the 20 image_map pigments properly. Image_map
> pigments only seem to work on polygons normal to the Z axis and left corner at
> 0,0 XY
>
> The suggestion that I create each triangle at 0,0 and then translate/rotate them
> to the icosahedron would be just fine if i had those numbers. (I do not)
>
> There must exist another way, as the current limitation is ludicrously
> un-useful. Everybody aplying pictures to polyhedra would have exactly the same
> problem.
> What am I missing?
>
> Is it possible to translate the triangle by translating its individual points?
> That I might be able to do, but I can't work out how.
>
>
> The ultimate goal is a Dymaxion type world map on an Icosahedron.

My first thought is use a mesh2 with UV mapping. It may be a little hard to do
it by hand. But you only have 32 points to worry about. Try looking at the mesh2
documentation to see if you want to try that.


Post a reply to this message

From: Molly-J
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 29 Mar 2022 16:15:00
Message: <web.624367b3ccfe29009cded0992eac0897@news.povray.org>
Thank you everyone for all that help.
I worked out how to do it after re-reading your posts carefully. I had to break
out the geometry/trigonometry skills to derive the angles from xyz coordinates.
there seems to be no other way.
unless there is . . . .

Is there a povray function that returns polar coordinates of a surface's normal?

eg. create a polygon my_polygon at xyz xyz xyz and then ask--

let lat/lon = normal(my_polygon)


Post a reply to this message


Attachments:
Download 'tutorial-00.png' (505 KB)

Preview of image 'tutorial-00.png'
tutorial-00.png


 

From: Molly-J
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 30 Mar 2022 00:05:00
Message: <web.6243d6dbccfe29009cded0992eac0897@news.povray.org>
In case someone in the distant future is searching for the pitch angles on the
facets of an icosahedron standing on a vertex, they are:


+52.62263186 degrees from vertical on the five topmost facets

+/- 10.81231696 degrees from vertical for the 10 facets around the equator

-52.62263186 degrees from vertical on the five lowermost facets


Post a reply to this message

From: jr
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 31 Mar 2022 08:15:00
Message: <web.62459aa1ccfe2900fc0c8de6cde94f1@news.povray.org>
hi,

"Molly-J" <nomail@nomail> wrote:
> ...
> Is there a povray function that returns polar coordinates of a surface's normal?
>
> eg. create a polygon my_polygon at xyz xyz xyz and then ask--
>
> let lat/lon = normal(my_polygon)

afaik, no.  (in fact, searching "polar" in the wiki only finds (fish-eye) camera
related mention)  however, if you have the maths, you can (and usually would, in
POV-Ray) write a macro[1], using 'trace()'[2] to find the surface normal, then
convert and return the (lat,lon).  Bald Eagle wrote some polar coord conversion
code[3], maybe it'll be of use to you.

[1]
<https://wiki.povray.org/content/Reference:User_Defined_Macros#The_macro_Directive>
[2] <https://wiki.povray.org/content/Reference:Vector_Expressions#Functions>
[3] <http://news.povray.org/web.58dc085aae95604bc437ac910%40news.povray.org>


regards, jr.


Post a reply to this message

From: Bald Eagle
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 31 Mar 2022 14:25:00
Message: <web.6245f0deccfe29001f9dae3025979125@news.povray.org>
You might be able to use

f_th(x,y,z): f_th() is a function that is only useful when combined with other
surfaces. It produces a value which is equal to the theta angle, in radians, at
any point. The theta angle is like the longitude coordinate on the Earth. It
stays the same as you move north or south, but varies from east to west. Also
look at f_ph and f_r

and

f_ph(x,y,z): When used alone, the PH function gives a surface that consists of
all points that are at a particular latitude, i.e. a cone. If you use a
threshold of zero (the default) this gives a cone of width zero, which is
invisible. Also look at f_th and f_r

in Functions.inc

https://wiki.povray.org/content/Reference:Functions.inc


Post a reply to this message

From: Tor Olav Kristensen
Subject: Re: image_map to tilted and rotated triangle centered and scaled
Date: 2 Apr 2022 20:50:00
Message: <web.6248ee41ccfe29006d7cc5a589db30a9@news.povray.org>
"Molly-J" <nomail@nomail> wrote:
> I am going mad trying to project image maps onto polygons that are not in the
> x-y plane or plumb to the y axis. I have 20 equilateral triangles forming a
> typical D20 shape (regular icosahedron). I have the XYZ coordinates for the
> points so all I have to do is create each triangle using sets of the 32
> vertices. BUT . . . .
>
> I cannot work out how to project the 20 image_map pigments properly. Image_map
> pigments only seem to work on polygons normal to the Z axis and left corner at
> 0,0 XY
>
> The suggestion that I create each triangle at 0,0 and then translate/rotate them
> to the icosahedron would be just fine if i had those numbers. (I do not)
>
> There must exist another way, as the current limitation is ludicrously
> un-useful. Everybody aplying pictures to polyhedra would have exactly the same
> problem.
> What am I missing?
>
> Is it possible to translate the triangle by translating its individual points?
> That I might be able to do, but I can't work out how.
>
>
> The ultimate goal is a Dymaxion type world map on an Icosahedron.

Hi again Molly

I've now made a couple of GitHub repositories that may be useful for you.

Here you can find the vertices and the triangles that you need:
https://github.com/t-o-k/POV-Ray-icosahedron

Here you can see how you can UV-map parts of an image onto a mesh2:
https://github.com/t-o-k/POV-Ray-UV-mapping-of-mesh2

And here you can download images suitable for being mapped onto an icosahedron:
https://solarviews.com/cap/ico/icoearth.htm

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


Post a reply to this message

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