POV-Ray : Newsgroups : povray.advanced-users : Vector Math Server Time
2 Nov 2024 09:18:34 EDT (-0400)
  Vector Math (Message 1 to 6 of 6)  
From: Darcy Johnston
Subject: Vector Math
Date: 10 Jan 2000 00:13:44
Message: <38796a88@news.povray.org>
Say I have a cylinder which goes from 0, to <0, h, 0> and I want to
transform it so that it runs from <a,b,c> to <x,y,z>. How do I go about
figuring out that transformation?

Thanks,
Darcy


Post a reply to this message

From: Thomas Willhalm
Subject: Re: Vector Math
Date: 10 Jan 2000 07:43:31
Message: <qqmaeme2j2l.fsf@goldach.fmi.uni-konstanz.de>
"Darcy Johnston" <djo### [at] inamecomNOSPAM> writes:

> Say I have a cylinder which goes from 0, to <0, h, 0> and I want to
> transform it so that it runs from <a,b,c> to <x,y,z>. How do I go about
> figuring out that transformation?

Perhaps you should have a look at my "segment" include file. It's not
exactly what you looking for, but close to it. You can find the zip 
file at http://www.fmi.uni-konstanz.de/~willhalm/graphics/povaddon/

Thomas

-- 
http://thomas.willhalm.de/ (includes pgp key)


Post a reply to this message

From: Michael Andrews
Subject: Re: Vector Math
Date: 10 Jan 2000 08:06:25
Message: <3879D8F8.D40B42C0@reading.ac.uk>
Hi Darcy,

Darcy Johnston wrote:
> 
> Say I have a cylinder which goes from 0, to <0, h, 0> and I want to
> transform it so that it runs from <a,b,c> to <x,y,z>. How do I go about
> figuring out that transformation?
> 
> Thanks,
> Darcy

Well, I wouldn't try to re-invent the wheel, so ...

Given S == vlength(<a,b,c>-<x,y,z>)

1) Scale your object by S/h or <1,S,1>/h depending whether you want to
keep the proportions consistent.
2) Apply one of the reorientation macros to the object. The two I can
remember are in John VanSickle's Thoroughly Useful Macros and Gilles
Tran's tree generator, either of which should do the trick.

Hope this helps,
	Mike Andrews.


Post a reply to this message

From: Nieminen Juha
Subject: Re: Vector Math
Date: 10 Jan 2000 08:54:24
Message: <3879e490@news.povray.org>
http://users.erols.com/vansickl/matrix.htm

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):5;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: Vector Math
Date: 12 Jan 2000 12:26:23
Message: <387CB932.CE4C734@spiritone.com>
I had three orientation macros but I can only find two of them:

#macro Orient_X(v1,v2)
  #local nx = vnormalize(v2 - v1);
  #local nz = vnormalize(vcross(nx,y));
  #local ny = vcross(nz,nx);
  matrix <nx.x,nx.y,nx.z,
          ny.x,ny.y,ny.z,
          nz.x,nz.y,nz.z,
          v1.x,v1.y,v1.z>
#end

#macro Orient_Z(v1,v2)
  #local nz = vnormalize(v2 - v1);
  #local nx = vnormalize(vcross(nz,y));
  #local ny = vcross(nz,nx);
  matrix <nx.x,nx.y,nx.z,
          ny.x,ny.y,ny.z,
          nz.x,nz.y,nz.z,
          v1.x,v1.y,v1.z>
#end

I have no idea what happened to Orient_Y
I think if you use
   #local ny = vnormalize(v2 - v1);
  #local nz = vnormalize(vcross(x,nz));
  #local nx = vcross(nz,ny);

it will work. Instead of x you can use any vector that you want to be "to
the right of" the object before it gets adjusted.

This is what I use.

Darcy Johnston wrote:

> Say I have a cylinder which goes from 0, to <0, h, 0> and I want to
> transform it so that it runs from <a,b,c> to <x,y,z>. How do I go about
> figuring out that transformation?
>
> Thanks,
> Darcy

--

Josh English
eng### [at] spiritonecom
ICQ: 1946299
"Stress is when you wake up screaming and realize you haven't fallen
asleep yet."


Post a reply to this message

From: David Fontaine
Subject: Re: Vector Math
Date: 13 Jan 2000 23:31:43
Message: <387EA43A.53222078@faricy.net>
Try VanSickle's macro http://users.erols.com/vansickl/matrix.htm or my own
Reposition macro which is at my homepage.

--
Homepage: http://www.faricy.net/~davidf/
___     ______________________________
 | \     |_       <dav### [at] faricynet>
 |_/avid |ontaine      <ICQ 55354965>


Post a reply to this message

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