FAQ
Cover
\
Build
\
Source
\
Bugs
\
Reference
\
Libraries
\
Tools
The bugs database has moved
here
.
Bug 1243 : add a function to shift in a given direction
Last modified: 2010-02-17 19:40
P
roject:
processing
trash
Version:
unspecified
Co
m
ponent:
android
book
core
libraries
pde
reference
tools
web
Status:
ASSIGNED
Resolution:
-
Pr
i
ority:
P4
Severity:
enhancement
Platform
All
O
S:
All
Windows
Mac OS
Linux
Other
Reporter:
BenHem
Assigned To:
fry
Attachment
Type
Created
Size
Actions
Description
: Opened: 2009-05-12 18:18
Hi,
I have been pasting this simple scrap of code in almost every visual project I make. It just
finds the X and Y coordinates when shifting a given distance at a given angle. It seems like
something that might be useful to others, maybe it could even find a home in the API?
float chaseX(float startX, float angle, float speed){
return (startX + (speed * cos(angle)));
}
float chaseY(float startY, float angle, float speed) {
return (startY + (speed * sin(angle)));
}
Additional Comment
#1 From fry 2010-02-17 19:40
k, we'll leave it in the db so people can vote on it or advocate for its
inclusion.
This bug is now being tracked
here
.