POV-Ray : Newsgroups : povray.advanced-users : how can a square mesh be changed to a rhomboid Server Time
23 Nov 2024 23:09:31 EST (-0500)
  how can a square mesh be changed to a rhomboid (Message 1 to 10 of 16)  
Goto Latest 10 Messages Next 6 Messages >>>
From: davidafisher
Subject: how can a square mesh be changed to a rhomboid
Date: 8 Aug 2010 23:55:01
Message: <web.4c5f7b837d444d346175cda10@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?


Post a reply to this message

From: Le Forgeron
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 02:36:31
Message: <4c5fa1ef@news.povray.org>
Le 09/08/2010 05:52, davidafisher a écrit :
> 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?
> 
> 
Yes, Me! (end of first degre answer)

With a shear matrix transform.

http://www.povray.org/documentation/view/3.6.0/49/

http://www.f-lohmueller.de/pov_tut/trans/trans_450e.htm

Have a nice day.
-- 
A: Because it messes up the order in which people normally read text.<br/>
Q: Why is it such a bad thing?<br/>
A: Top-posting.<br/>
Q: What is the most annoying thing on usenet and in e-mail?


Post a reply to this message

From: Warp
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 05:52:02
Message: <4c5fcfc2@news.povray.org>
Le_Forgeron <lef### [at] freefr> wrote:
> With a shear matrix transform.

> http://www.povray.org/documentation/view/3.6.0/49/

> http://www.f-lohmueller.de/pov_tut/trans/trans_450e.htm

  You don't even need a matrix in order to convert a rectangle into a
rhomboid (although the matrix transformation makes it easier to control
more precisely how much the shape is sheared). You can also achieve the
same effect like this (assuming the rectangle is on the xy plane):

    rotate z*45
    scale <1, .5, 1>

  Varying the rotation amount allows you to change the amount of shearing,
but as said, the matrix transformation makes it easier to control it more
precisely. (Also it makes it easier to keep the rhomboid unrotated, if you
don't want the rotation that the above transformation causes. You could
undo the rotation after the scaling, but the exact angle is slightly more
complex to calculate.)

-- 
                                                          - 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 08:40:01
Message: <web.4c5ff644a72b83ae6175cda10@news.povray.org>
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?


Post a reply to this message

From: Warp
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 09:43:27
Message: <4c6005ff@news.povray.org>
davidafisher <dav### [at] coppernet> wrote:
> 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 rhomboid is a parallelogram in which adjacent sides are of unequal
lengths. A parallelogram with sides of equal length is a rhombus. The
transformation can be used to get either one.

-- 
                                                          - Warp


Post a reply to this message

From: Le Forgeron
Subject: Re: how can a square mesh be changed to a rhomboid
Date: 9 Aug 2010 09:44:00
Message: <4c600620@news.povray.org>
Le 09/08/2010 14:36, davidafisher a écrit :
> result in a parallelogram and not a
> rhomboid?

Houston, we got a problem.

Traditionally, in two-dimensional geometry, a rhomboid is a
parallelogram in which adjacent sides are of unequal lengths and angles
are oblique.

Please check
http://en.wikipedia.org/wiki/Rhomboid

Do they need to change the wiki ?

You want a specific matrix transform which will keep the length of the
side your square while changing the angle ? (but then the result would
not be a rhomboid, just an exceptional rhombus (and a rhombus is not a
rhomboid, so your question was wrong in first place ?))

A parallelogram is either:
 * a square (same length, right angle)
 * a rhombus (same length, not right angle)
 * a rectangle (not same length, right angle)
 * a rhomboid (all others)


Now, you do not provide the length of the original square size. (HINT:
you implied a 2D figure by writing about a square!)

You do not provide the length of the diagonals of the resulting rhomboid
(or the new coordinate/displacement of the corner opposite to the origin
corner [ "say 3 degres" is not a precise value, which direction ? and
what is the main plane of the original mesh ? ]), nor the length of its
sides. (for a rhombus, the length of the diagonals are enough, not for a
rhomboid as they are not intersecting at a right angle anymore: at least
one side is also needed, and the fourth length can be computed ( (sum of
squared sides = sum of squared diagonals, as the diagonals intersect at
their middle, their is no delta of 4*square distance between the middle
of the diagonal)**

So, yes, you have work on the computation of the 12 matrix's values to
get what you want, but so far I'm afraid we cannot help more with the
current data.

If you meant a rhombic prism (a 3D figure), it would still be a matrix
transform, just a bit more complex to set.


** formula for a convex quadrilateral ABCD : AB²+BC²+CD²+DA² =
AC²+BD²+4IJ² (where I,J middle of AC,BD), on parallelogram IJ=0.
-- 
A: Because it messes up the order in which people normally read text.<br/>
Q: Why is it such a bad thing?<br/>
A: Top-posting.<br/>
Q: What is the most annoying thing on usenet and in e-mail?


Post a reply to this message

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

Goto Latest 10 Messages Next 6 Messages >>>

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