POV-Ray : Newsgroups : povray.advanced-users : how can a square mesh be changed to a rhomboid Server Time
29 Jun 2024 02:06:34 EDT (-0400)
  how can a square mesh be changed to a rhomboid (Message 11 to 16 of 16)  
<<< Previous 10 Messages Goto Initial 10 Messages
From: Alain
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 17:42:03
Message: <4c60762b$1@news.povray.org>

> I have a DTM (digital terrain Map) which is square, a mesh comprising of 140,000
> smooth triangles. I need to adjust the map for convergence - difference of the
> grids north to the earths true north. The adjustment would result in a rhomboid
> where the top-left corner might be rotated by, say 3 degrees from the
> bottom-left corner and the top-right corner rotated by 2 degress from the
> bottom-right corner.
>
> Does anybody have an idea on whether this can be achieved in POV-Ray?
>
>

Normaly, for most maps, the sides are parallel to the local longitude, 
and the top and bottom are parallel to the local latitude.

If I read correctly, you don't realy want a rhomboid but a trapezoid or 
something close to that. (top and bottom sides are parallel, but the 
sides are NOT parallel)


Furthermore, the sides don't seems to stay straight, but somewhat curves 
out on the sides and bottom, and curven IN for the top.

What I think you /realy/ want is to treat the DTM as a 
longitude/latitude object and map it on a sphere, keeping the sides 
parallel to the latitude and longitude lines of the sphere.

If I'm right, then, the other answers are not what you need. You need a 
spherical transformation of every vertex of the mesh. Then, most 
straight lines traced on the map will become curves.

It can be done, but involve much more work than a simple matrix 
operation. You need to scan the raw mesh array using loops and transform 
every point individualy from rectangular coordinated to spherical 
coordinates.



Alain


Post a reply to this message

From: Warp
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 10 Aug 2010 01:11:33
Message: <4c60df85@news.povray.org>
davidafisher <dav### [at] coppernet> wrote:
> x   |-446.448|   | 1+20.4894,  0.8421,    -0.247    |   |x|
> y = | 125.157| + |-0.8421,     1+20.4894,  0.1502   | * |y|
> z   |-542.06 |   | 0.247,     -0.1502,     1+20.4894|   |z|

  Well, that looks to me like a matrix transformation and a translate.
Why don't you simply try it?

-- 
                                                          - Warp


Post a reply to this message

From: clipka
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 10 Aug 2010 05:55:30
Message: <4c612212$1@news.povray.org>
Am 09.08.2010 21:52, schrieb davidafisher:

> New                                                   current
> x   |-446.448|   | 1+20.4894,  0.8421,    -0.247    |   |x|
> y = | 125.157| + |-0.8421,     1+20.4894,  0.1502   | * |y|
> z   |-542.06 |   | 0.247,     -0.1502,     1+20.4894|   |z|
>
> but I don't know how the matrix command works within POV-Ray and whether it can
> be used in this manner. My mind has stopped working and I'm stuck on thinking I
> have to build a separate routine to parse and convert every triangle coordinate
> within the mesh

No, this is exactly the kind of job the POV-Ray "matrix" statement is 
made for. See section 2.2.7 "POV-Ray Coordinate System" of the 
documentation, subsection 2.2.7.1.4 "Matrix", for how the 12 
coefficients are interpreted.

I must confess I'm not too familiar with the mathematical notation of 
matrices, but I /think/ the parameters should be as follows:

New                                   current
x   |Val30|   |Val00, Val10, Val20|   |x|
y = |Val31| + |Val01, Val11, Val21| * |y|
z   |Val32|   |Val02, Val12, Val22|   |z|

    =>

matrix <Val00, Val01, Val02,
         Val10, Val11, Val12,
         Val20, Val21, Val22,
         Val30, Val31, Val32>

I hope I'm of help.


Post a reply to this message

From: davidafisher
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 15 Aug 2010 16:10:00
Message: <web.4c68497ba72b83ae6175cda10@news.povray.org>
Alain <aze### [at] qwertyorg> wrote:

> > I have a DTM (digital terrain Map) which is square, a mesh comprising of 140,000
> > smooth triangles. I need to adjust the map for convergence - difference of the
> > grids north to the earths true north. The adjustment would result in a rhomboid
> > where the top-left corner might be rotated by, say 3 degrees from the
> > bottom-left corner and the top-right corner rotated by 2 degress from the
> > bottom-right corner.
> >
> > Does anybody have an idea on whether this can be achieved in POV-Ray?
> >
> >
>
> Normaly, for most maps, the sides are parallel to the local longitude,
> and the top and bottom are parallel to the local latitude.
>
> If I read correctly, you don't realy want a rhomboid but a trapezoid or
> something close to that. (top and bottom sides are parallel, but the
> sides are NOT parallel)


> Furthermore, the sides don't seems to stay straight, but somewhat curves
> out on the sides and bottom, and curven IN for the top.
>
> What I think you /realy/ want is to treat the DTM as a
> longitude/latitude object and map it on a sphere, keeping the sides
> parallel to the latitude and longitude lines of the sphere.
>
> If I'm right, then, the other answers are not what you need. You need a
> spherical transformation of every vertex of the mesh. Then, most
> straight lines traced on the map will become curves.
>
> It can be done, but involve much more work than a simple matrix
> operation. You need to scan the raw mesh array using loops and transform
> every point individualy from rectangular coordinated to spherical
> coordinates.
>
>
>
> Alain

The matrix sugestion did put me on the right track! but Alain, you are correct,
parsing every tringle is what would need to be done, and I believe I have the
resolution.

the vertices of the triangles in the map are given in easting and northing.
I have to convert these eastings and northings to geocentric cartesian xyz
points.

There doesn't seem to be a single step conversion to do this so a a two step
process has to be employed. First converting the eastings and northings to
latitude & longitude and then convert the Lat longs to the cartesian xyz.

But this raises an issue. The triangles will be "distorted" from their original
shape - if this impacts the normals to the vertices I don't know how to deal
with that.


Post a reply to this message

From: clipka
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 16 Aug 2010 04:54:53
Message: <4c68fcdd@news.povray.org>
Am 15.08.2010 22:09, schrieb davidafisher:

> But this raises an issue. The triangles will be "distorted" from their original
> shape - if this impacts the normals to the vertices I don't know how to deal
> with that.

If I understand you correctly, then re-computing the normals should be a 
piece of cake: They should point right away from the center. So 
presuming that the sphere is centered around the origin, you can simply 
set all normals to the same value as the corresponding vertices.


Post a reply to this message

From: Warp
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 16 Aug 2010 06:35:05
Message: <4c691458@news.povray.org>
clipka <ano### [at] anonymousorg> wrote:
> Am 15.08.2010 22:09, schrieb davidafisher:

> > But this raises an issue. The triangles will be "distorted" from their original
> > shape - if this impacts the normals to the vertices I don't know how to deal
> > with that.

> If I understand you correctly, then re-computing the normals should be a 
> piece of cake: They should point right away from the center. So 
> presuming that the sphere is centered around the origin, you can simply 
> set all normals to the same value as the corresponding vertices.

  A shearing transform doesn't sound to me like it would keep a sphere
spherical.

-- 
                                                          - Warp


Post a reply to this message

<<< Previous 10 Messages Goto Initial 10 Messages

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