POV-Ray : Newsgroups : povray.news-submissions : getting coordinates Server Time: 26 Jun 2019 10:24:23 GMT
 getting coordinates (Message 1 to 5 of 5)
 From: Coucou Subject: getting coordinates Date: 1 Jan 2010 18:00:01 Message:
```Hi
Happy new years !
I have a small problem
I written the following simple macro
#macro Foot(c1,c2,R,col)
cylinder {
C1
c2
R
pigment {color col}

}
#end
with such a call
#declare MyRedFoot =  Foot(<0,0,0>,<0,10,0>,1,Red)
But i would like to calle
#declare MyRedFoot =  Foot(<0,0,0>,h,1,Red)
where h is height of foot. Macro would be

#macro Foot(c1,h,R,col)
cylinder {
C1
<x.C1, y.C1 + h, z.C1>
R
pigment {color col}

}
but of course it doesn't work like i hope because i do not know x y and z
How to get x, y and z of C1 ?

Thanks a lot
```
 From: Tor Olav Kristensen Subject: Re: getting coordinates Date: 1 Jan 2010 19:00:01 Message:
```"Coucou" <dom### [at] neuffr> wrote:
......
> How to get x, y and z of C1 ?

You can write:

vdot(C1, x)
vdot(C1, y)
vdot(C1, z)

- or shorter:

C1.x
C1.y
C1.z

Also have a look here:

http://www.povray.org/documentation/view/3.6.1/229/#s02_02_01_04_03
"2.2.1.4.3 Operators"

(The last part of that section is about the dot operator.)

--
Tor Olav
http://subcube.com
```
 From: Warp Subject: Re: getting coordinates Date: 1 Jan 2010 19:10:06 Message: <4b3e488e@news.povray.org>
```Tor Olav Kristensen <tor### [at] toberemovedgmailcom> wrote:
> "Coucou" <dom### [at] neuffr> wrote:
> ......
> > How to get x, y and z of C1 ?

> You can write:

>   vdot(C1, x)
>   vdot(C1, y)
>   vdot(C1, z)

> - or shorter:

>   C1.x
>   C1.y
>   C1.z

I hate to sound rude, but I really don't understand why give first a rather
contrived answer of "vdot(C1, x)" and then give the right answer "C1.x".
The dot product does produce the same result, but it's a needlessly
complicated solution, so I don't really understand why you even suggested it.

--
- Warp
```
 From: Tor Olav Kristensen Subject: Re: getting coordinates Date: 1 Jan 2010 19:15:00 Message:
```By the way:
I did not notice to which news group you had posted your question.

Your question belongs in the povray.newusers group:

http://news.povray.org/povray.newusers/

- not in the povray.news-submissions group.

http://tinyurl.com/yj6btea

--
Tor Olav
http://subcube.com
```
 From: Tor Olav Kristensen Subject: Re: getting coordinates Date: 1 Jan 2010 19:40:01 Message:
```Warp <war### [at] tagpovrayorg> wrote:
> Tor Olav Kristensen <tor### [at] toberemovedgmailcom> wrote:
> > "Coucou" <dom### [at] neuffr> wrote:
> > ......
> > > How to get x, y and z of C1 ?
>
> > You can write:
>
> >   vdot(C1, x)
> >   vdot(C1, y)
> >   vdot(C1, z)
>
> > - or shorter:
>
> >   C1.x
> >   C1.y
> >   C1.z
>
>   I hate to sound rude, but I really don't understand why give first a rather
> contrived answer of "vdot(C1, x)" and then give the right answer "C1.x".
> The dot product does produce the same result, but it's a needlessly
> complicated solution, so I don't really understand why you even suggested it.

Ok, the documentation says that the dot operator is used to extract components
from vectors.

- But the reason that I wrote it that way, is because I like to think of the
"C1.x" form as a short form of the dot product between the C1 vector and the
basis vector x.

It wasn't my intention to confuse anyone.

(Several ASCII-coded texts/papers/posts about vector math use the "." as the
vector dot product operator.)

--
Tor Olav
http://subcube.com
```