ActionScript 2.0 :: Shortest Distance Between Two Angles
Jul 20, 2004How could I find the shortest distance between two angles? Like say the distance between 359 degrees and 1 degree is 2 not 358. Any ideas?
View 4 RepliesHow could I find the shortest distance between two angles? Like say the distance between 359 degrees and 1 degree is 2 not 358. Any ideas?
View 4 RepliesHow could I find the shortest distance between two angles? Like say the distance between 359 degrees and 1 degree is 2 not 358.
View 5 RepliesIn Actionscript, I'm trying to work out the best way to create the shortest route between two point on the map above. I have all the distances.
Algorithms like A* I dont think are relevant as it is near impossible to work out the heuristic distance.
I thought I could create a big array of all the nodes with the distances to any connected nodes and just iterate through until Ive found the the shortest distance, but this I know is very inefficient.
I am working on the project where everything is based on the distance from the center of the stage. First I made this fla where flash outputs the x and y distance from the center. First problem is that I want to output distance only in positive numbers.
View 1 RepliesI am posting my code that attaches the movieclips on stage
[Code]...
i was hoping that when the newMc expands, all other mc would keep the same distance between each other as at initialisation. I not able to figure how to do it. maybe even an earlier post or llink where similar query was explained.
In AS3 I am trying to get the distance between 2 3D objects by using distance method.
if(Vector3D.distance(model.position,model2.position) < 100)
{
// do something
[Code]....
>>You can use it directly as a method of the Vector3D class to get the Euclidean distance between two three-dimensional points.
Which point does this method pick? Is it the closest point to the other object ?
I am just thinking of how much time this would take in testing objects with large poly count.
I am currently working on a quite big map and trying to provide the shortest path service between two points. From what I saw, this is possible with a small map since it has to calculate ALL possible paths and then choose the shortest one (Am I right?).
View 3 RepliesI want to put shortest int in shortest:
shortest = 500;
for(i = 1; i <= _global.var_process_count; i++) {
if(_root["process" + i].process_time_original.text < shortest)
shortest = _root["process" + i].process_time_original.text ;
}
What's wrong with above lines of code?
I have this object in Flex 4
[Code]....
It is a circle divided into 5 equal parts each 72 degrees. So each state you can see is increases the rotation by 72 degrees. I have a transition for the rotation when the state changes like so:
[Code]....
Being that this is a circle you can actually rotate CW or CCW to get to the right degree for the state. Usually the rotation-transition uses whichever is lower. For example to get from Classic to Centro (0 to 72) it goes CW. But this is not always the case. To go from Lace to Lido (144 to 216) it goes CCW. This is not desired sense it would make a much better transition to go CW because it requires less spinning of the circle to get to the desired degree.
I've been trying to rotate an arrow but I can't get it choose the shortest direction. How would I do that?
Here's something I've started:
ActionScript Code:
import com.greensock.TweenLite;
import com.greensock.easing.*;
[code]....
who wants to build a flash application to find the shortest path using ant algorithm. but i have not the refferrence about that?
View 5 RepliesThe idea is simple enough but I feel as if I've been running in circles trying to figure this out. I need to get the polar angle between two objects. One object is stationary (the item) and the other moves around (the character). I need the polar angle to the item from the character. Basically the 0,0 of the polar angle will be the character's x,y.
View 2 RepliesI am trying to create a wheel of fortune with dyanamic values being inserted into it. Is there any way to have dynamic values to be at angles. When ever I turn them a little bit, they dont' seem to show up any more.
View 3 Repliesbest method to calculate the angles of a triangle? Or have any good references? I have 3 points which can be moved when the user drags on it, so the angles will have to change accordingly.
View 8 RepliesI am trying to create a wheel of fortune with dyanamic values being inserted into it. Is there any way to have dynamic values to be at angles. When ever I turn them a little bit, they dont' seem to show up any more.
View 3 RepliesI am currently learning some trigonometry tome with my actionscript...In AS I am aware that angles need to be converted from degrees to radians to use certain Math properties, such as Math.sin...etcHere is my code to convert degrees to radians...
ActionScript Code:
var degrees:Number = 90;
var radians:Number = degrees * Math.PI / 180;
[code].....
This client of wants a flash video player of a model, modeling some clothes.
They are going to set up 3 different cameras around her at the same time filming her - one from the front, one from the side and one from the back. Each clip lasts exactly 3mins and they are filming her at THE SAME TIME.
Now after this, they want to put a FLASHPLAYER on their website with the video playing in a screen with 3 buttons underneath one saying FRONT VIEW, one saying SIDE VIEW AND one saying BACK VIEW. The three separate videos will be integrated in some way with this one flash file.
The video player might start playing the FRONT VIEW first.
BUT lets say 30 seconds into the clip I press the SIDE VIEW button the video switches to the side view on 30 seconds - The side view video doesn't play right from the start. Like I said before for example if the person is speaking and says "hello there", if you switch angle by clicking one of the buttons just at the point after she has said the word "hello", you switch to the angle where he is just about to say "there". If you see what I mean.
As I said before there are 3 separate video clips:- FRONT VIEW, SIDE VIEW and BACK VIEW. Now I am not sure if these have to be embedded in the FLA file or can be contained in a separate folder on the server so that the SWF can access them. I am worry about streaming over the internet thats why I THINK Flash Media Server3 MIGHT be a solution BUT I don't know. BUT they must be seamless.
AGAIN to reiterate...LETS say I am watching the SIDE view 30 seconds after the clip has started and the model starts scatching her head and then AT THAT POINT I click the front view button below I see the model scratching her head from the front view at THAT precise moment.
So all the videos seem to work at the same time to the casual viewer/user and it looks as though you are just switching views whenever you want.
I have been looking all over the net to see if someone has produced a working example or if there is a tutorial somewhere but I have found NOTHING.
I think there might be a problem pulling this one off as each video clip could be 4-5 MB in size and if they are streaming then there would be download problems and these videos might stop due to people with various bandwidth restrictions UNLESS all the videos were integrated into the flash library and were referenced from within by Actionscript but then the resultant SWF could be HUGE.
getting angles, of two movieclips that are on my stage. With instance names: circle1,circle2. I read that I should use the function Math.atan2 to get the angle, in radians, then I convert it to degrees, but it doesn't make sense, the angles aren't correct.. Here I paste the code I use (its AS not PHP don't know how to add the AS tags):
[Code]...
I have a draggable movie clip with another movie inside that. On the click of a button I need it to be at 0,0. This works fine but I also need to rotate the draggable movie clip and when I attempt to move the child movie to 0,0 it goes of the screen.
View 3 RepliesI want to do a triangle so when you drag the corners the sides and the angles alter and you can show the degrees and lengths. Just like this website.
[URL]
I want to do a triangle so when you drag the corners the sides and the angles alter and you can show the degrees and lengths. Just like this website.
[URL]
wat's the difference between finding a angle using Math.atan2(y,x) function and by finding using the movie clip's rotation (mc._rotation*Math.PI/180);
View 9 Repliesanyone have a hint how to create with AS, leader dots? Meaning, I need to connect two points with growing leader dots that may change direction at right angles.
View 3 RepliesCan't figure out this. I have 3 points A(305,108),B(311,119) and C(348,172), to find out the distance from B to AC, i use a method found here [URL]..
I then got the distance equals to 131. When I draw AC and B, it appears B is almost on the line (distance <= 1). Am i doing wrong? what does 131 mean?
Is there any difference between: distance = point1.subtract(point2).length; and distance = Point.distance(point1, point2);
View 3 RepliesI cannot arrive at dynamically showing the text in the dynamic text field when I move one any one of the MC on stage.
View 6 RepliesI am working on a project where I have 5 equal sized panels inside of a MC that I am using the following code on the loading of MC:
onClipEvent (load) {
targetx = 650.0;
delay = 8;
}
[Code]...
What I would like to do is ALSO move the panels with left and right arrows that act independently of navigation buttons. So that if you were on panel 2 you could advance to panel 3 or back to 1. Can I assign AS to the arrows to move the MC a specified distance left or right?
I'm building a touchscreen project that consists of flash and max/msp using Olaf Matthes flashserver as bi-directional control.
how I create a function in flash that will provide me with the distance of a concentric circle, so that as it grows I can use trace() to give me a constant stream of it's x & y coordinates?
I've also implemented a collision detection between two or more circles for the purpose of an overlap function. Trouble being that it's not quite working properly. I want the overlap function for the purpose of morphing sounds between the intersecting parts of the circles.
Here's the code I'm using:
[Code]....
Is there a way to calculate the distance between the origin of a movieClip at, say, (x:500, y:0, z:0) and one at, (x:500, y:0, z:50)?? And lets say the vanishing point is (0,0) and the perspective angle is 50.
I know that the eq for finding the distance between two points in 3D space is:
d = ((x1-x2)^2 +(y1-y2)^2+(z1-z2)^2)^(1/2)
the problem is I dont know x2 (the x value of MC2 (the one set at z = 50)).
[URL]
At first it seemed simple to find out the distance between two movieclips' x values, I could have just done:
Code:
mc1.x - mc2.x
However, What I'm trying to achieve is a movieclip of a person climbing an un-even surfaced wall, and to do this I first want to make sure the x value of the person is always equal to the edge of the wall.
How would I calculate the exact position of wall's edge where the person is touching it? I've attached an image to show what I mean.