POV-Ray : Newsgroups : povray.newusers : vector math / transforms Server Time
28 Apr 2024 19:21:17 EDT (-0400)
  vector math / transforms (Message 1 to 5 of 5)  
From: Bald Eagle
Subject: vector math / transforms
Date: 3 Aug 2013 15:10:00
Message: <web.51fd546da1a2cc4473fc9ebb0@news.povray.org>
I want to scale a vector.
What is the directive and syntax to do this?
Say, "squash" vector <-1, -1, 0> so it's <-1, 0.5, 0>
I'd like to operate on the whole vector, rather than do something like
<vector.x/2, vector.y, vector.z> "by hand"

I see the transforms.inc, but I don't know how to implement it, especially since
some of the macros are nested.

I'd also like to understand the "native" functions used there.


Post a reply to this message

From: Bald Eagle
Subject: Re: vector math / transforms
Date: 3 Aug 2013 15:25:00
Message: <web.51fd58d63315535a73fc9ebb0@news.povray.org>
.... and I guess the point of all this is, I want to find the intersection points
of 2 circles (cylinders, tori) after I squash them out of round by scaling.


Post a reply to this message

From: Warp
Subject: Re: vector math / transforms
Date: 3 Aug 2013 16:12:08
Message: <51fd6418@news.povray.org>
Bald Eagle <cre### [at] netscapenet> wrote:
> I want to scale a vector.
> What is the directive and syntax to do this?
> Say, "squash" vector <-1, -1, 0> so it's <-1, 0.5, 0>
> I'd like to operate on the whole vector, rather than do something like
> <vector.x/2, vector.y, vector.z> "by hand"

You can multiply vectors in the same way as number, with '*'.
(It will simply multiply each vector component with each other.)

For example <1, 2, 3> * <1, 0.25, 1> = <1, 0.5, 3>

-- 
                                                          - Warp


Post a reply to this message

From: Bald Eagle
Subject: Re: vector math / transforms
Date: 3 Aug 2013 22:00:00
Message: <web.51fdb58f3315535a73fc9ebb0@news.povray.org>
That worked ... sorta.  But when is scaled my vector it seemed to translate it
when the scale vector.x wasn't 1.
I'll work on it and see if I'm doing something ELSE dumb.


Post a reply to this message

From: Thomas de Groot
Subject: Re: vector math / transforms
Date: 4 Aug 2013 03:12:39
Message: <51fdfee7@news.povray.org>
On 4-8-2013 3:59, Bald Eagle wrote:
> That worked ... sorta.  But when is scaled my vector it seemed to translate it
> when the scale vector.x wasn't 1.
> I'll work on it and see if I'm doing something ELSE dumb.

Probably because the object to be scaled is not at the origin or has 
been translated first (which results in the same thing of course).

The basic order in which transforms should be done for no surprises is 
/scale/ then /rotate/ then /translate/.

Thomas


Post a reply to this message

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