POV-Ray : Newsgroups : povray.tools.general : sin cos delta : sin cos delta Server Time
26 Apr 2024 05:44:18 EDT (-0400)
  sin cos delta  
From: def gsus-
Date: 29 May 2007 08:50:01
Message: <web.465c207f1626778dbd61fc7e0@news.povray.org>
hi everyone,
don't know where to post this exactly.
want to do some crowd simulation externally and have this prob.

every dude has property X,Y, SPEED and DIRECTION.
direction ranging from 0..1
they are update like
 x = x + speed * sin(direction * 2*pi)
 y = y + speed * cos(direction * 2*pi)

now i want people be attracted by others and move in their direction
so i'd need something to get the direction vector back into the direction
variable
i calc the delta, say dx and dy, between the dude and the dude attracted to,
and normalized to 1
but i cannot figure the final step
newdir = ....
maybe something with arcsin/arccos?
it should be just the reverse of the equation above.
it tried newdir = (arcsin(dx)+arccos(dy))/(2*pi) and stuff like this but not
with very satisfactory results.
thanks for help in advance. i know there are some true mathematicians here
;)


Post a reply to this message

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