POV-Ray : Newsgroups : povray.advanced-users : how can a square mesh be changed to a rhomboid Server Time
29 Jun 2024 02:11:03 EDT (-0400)
  how can a square mesh be changed to a rhomboid (Message 7 to 16 of 16)  
<<< Previous 6 Messages Goto Initial 10 Messages
From: clipka
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 10:25:23
Message: <4c600fd3$1@news.povray.org>
Am 09.08.2010 14:36, schrieb davidafisher:
> But this is where I'm missing something. Wouldn't both these actions, the matrix
> shearing and the rotate with scaling, result in a parallelogram and not a
> rhomboid?

(A) A rhomboid, in traditionally 2D geometry, /is/ a parallelogram.

(B) A rhomboid, in contemporary 3D geometry, aka parallelepiped, /is/ 
the 3D analogon to a parallelogram.


Post a reply to this message

From: Warp
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 10:28:02
Message: <4c601072@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
>     rotate z*45
>     scale <1, .5, 1>

  If you want to shear in two axes instead of one, you can do it equally
easily with a matrix transformation, or if you want to do it like above,
then:

    rotate z*45 // or whatever
    rotate x*45 // or whatever
    scale <1, .5, 1>

  It might be easier with the proper matrix transformation, though.

-- 
                                                          - Warp


Post a reply to this message

From: davidafisher
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 11:45:01
Message: <web.4c602114a72b83ae6175cda10@news.povray.org>
Rhombus-Rhomboid - at 3 o'clock in the morning one gets tired. And in fact as
you state what I need is a convex quadrilateral.

A DTM by definition is a 3D object, "say 3 degrees" means its a variable not a
constant (I have multiple maps with different convergence values for opposite
edges), but there we go! I didn't realize how literal one has to be.

if it helps all maps have their initial sides at 5000 x 5000
In one of the instances
AC = 7050
BD = 7060
but as I have multple instances, devising the AC, BD dimensions for each is
tedious, hence the thought on the side rotation by angle.

the transformation needs to take place along the x-z axes the y axis does not
change


Post a reply to this message

From: davidafisher
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 15:55:00
Message: <web.4c605924a72b83ae6175cda10@news.povray.org>
Basically, as I think about it at a more lucid time, what I'm needing to do is a
Helmert transformation

New                       current
x   |tx|   |1+s, -rz, ry|   |x|
y = |ty| + |rz, 1+s, -rx| * |y|
z   |tz|   |-ry, rx, 1+s|   |z|

and in my case the variables are

tx(m)    ty(m)    tz(m)   s(ppm)  rx(sec)  ry(sec) rz(sec)
-446.448 125.157 -542.06 20.4894  -0.1502  -0.247  -0.8421

or

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


Post a reply to this message

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 6 Messages Goto Initial 10 Messages

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