POV-Ray : Newsgroups : povray.tools.general : sin cos delta : Re: sin cos delta Server Time
2 May 2024 15:46:52 EDT (-0400)
  Re: sin cos delta  
From: Roman Reiner
Date: 29 May 2007 09:35:01
Message: <web.465c2b8f6b42587279d2ccf20@news.povray.org>
You'd probably need to use atan(dy/dx). however the usage of atan is a
little problematic since dx is not necessarily unequal zero and it's

(which is the opposite direction).

I recommend using one vector for the direction and speed (with the speed
being the length of the direction vector) and one for the location. So
instead of

x = x + speed * sin(direction * 2*pi)
y = y + speed * cos(direction * 2*pi)

you'd have

Position = Position+Direction ( with Direction = vnormalize(<dx,dy>)*Speed )

if you need to access the former x and y components use

x=Position.x
y=Position.y

Hope that helps!
Regards Roman


Post a reply to this message

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