Is there a way to move a shape using a certain angle? For example,
starting at the center of the applet and moving forwarward, but not
just up/down/left/right or up-left/down-right/whatever, but up-up-up-
left, with a certain numerical angle?
Sorry if this is unclear, just say what you need to know.
Alex Hunsley - 23 Mar 2007 17:56 GMT
> Is there a way to move a shape using a certain angle? For example,
> starting at the center of the applet and moving forwarward, but not
> just up/down/left/right or up-left/down-right/whatever, but up-up-up-
> left, with a certain numerical angle?
Yes. Why would you imagine that objects couldn't move in whatever
arbitrary you want them to?
> Sorry if this is unclear, just say what you need to know.
You shouldn't come here expecting people to tease your actual question
out of you. People help here for nothing; the least they can ask is that
those wanting help actually ask a clear question....
Max - 23 Mar 2007 17:58 GMT
>Is there a way to move a shape using a certain angle?
What is it?
Oliver Wong - 23 Mar 2007 18:15 GMT
> >Is there a way to move a shape using a certain angle?
> What is it?
You mean what is the way to move a shape using a certain angle? Google
for "trigonometry". You need to study math concepts, not Java concepts, to
understand how to do this.
- Oliver
bugbear - 23 Mar 2007 18:39 GMT
> Is there a way to move a shape using a certain angle? For example,
> starting at the center of the applet and moving forwarward, but not
> just up/down/left/right or up-left/down-right/whatever, but up-up-up-
> left, with a certain numerical angle?
>
> Sorry if this is unclear, just say what you need to know.
How is your shape defined?
What API are you using?
What do you want to do with the moved shape?
BugBear
Jeff Higgins - 24 Mar 2007 22:26 GMT
> Is there a way to move a shape using a certain angle? For example,
> starting at the center of the applet and moving forwarward, but not
> just up/down/left/right or up-left/down-right/whatever, but up-up-up-
> left, with a certain numerical angle?
>
> Sorry if this is unclear, just say what you need to know.
public class Test {
public static void main(String[] args) {
int numberOfFrames = Integer.parseInt(args[0]);
double decimalDegrees = Double.parseDouble(args[1]);
double radians = decimalDegrees * ((Math.PI / 180));
double slope = Math.tan(radians);
int xstart = 0;
int ystart = 0;
int xdelta = xstart;
int ydelta = ystart;
for(int i = 0; i < numberOfFrames; i++){
xdelta = i;
ydelta = (int)Math.rint(i * slope);
System.out.println("shape location: x = " + xdelta + " y = " +
ydelta);
}
}
Jeff Higgins - 25 Mar 2007 01:28 GMT
> Is there a way to move a shape using a certain angle? For example,
> starting at the center of the applet and moving forwarward, but not
> just up/down/left/right or up-left/down-right/whatever, but up-up-up-
> left, with a certain numerical angle?
>
> Sorry if this is unclear, just say what you need to know.
http://forum.java.sun.com/thread.jspa?threadID=762521&messageID=4354087