Copy link to clipboard
Copied
Hi,
Can someone show me how to get the signed angle between two Vector3D points?
Thanks!
Copy link to clipboard
Copied
the Vector3D class has a function called angleBtween() does that not do what you want? not it returns an angle in radians
Copy link to clipboard
Copied
Hi _spodboyle,
That returns an unsigned angle. A signed angle returns a minus or positive angle depending on which side one vector is compared to the other.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi Sinious,
that looks promising. I wish that the formula was written out, I'm not sure I understand what the responder in that post is saying : (
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi _spoboyle,
That looks helpful. How do I get Vn?
Copy link to clipboard
Copied
well this is the bit I don't really understand
Vn is the normal to the plane containing Va and Vb. You could find Vn by calculating the normalised corssproduct of Va and Vb
Copy link to clipboard
Copied
I've just tried what i said above and it's didn't give me what i expected
here is another discussion
Copy link to clipboard
Copied
I don't fully understand it or even how you would use it but here is an example I wrote in AS3
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Vector3D;
public class Main extends Sprite
{
public function Main():void
{
if (stage)
{
init();
}
else
{
addEventListener(Event.ADDED_TO_STAGE, init);
}
}
public function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
var a:Vector3D = new Vector3D(2, 1, 3);
a.normalize();
var b:Vector3D = new Vector3D(1, 2, 3);
b.normalize();
var sina:Number = a.crossProduct(b).length / (a.length * b.length);
var cosa:Number = a.dotProduct(b) / (a.length * b.length);
var sinb:Number = b.crossProduct(a).length / (a.length * b.length);
var cosb:Number = b.dotProduct(a) / (a.length * b.length);
var radiansa:Number = Math.atan2(sina, cosa);
var radiansb:Number = Math.atan2(sinb, cosb);
var n:Vector3D = a.crossProduct(b);
n.normalize();
var signa:Number = n.dotProduct(a.crossProduct(b));
var signb:Number = n.dotProduct(b.crossProduct(a));
if (signa < 0)
{
radiansa = -radiansa;
}
if (signb < 0)
{
radiansb = -radiansb;
}
var degreesa:Number = radiansa * 180 / Math.PI;
trace("angle A to B: " + degreesa);
var degreesb:Number = radiansb * 180 / Math.PI;
trace("angle B to A: " + degreesb);
}
}
}
Copy link to clipboard
Copied
that looks promising.
Thanks!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more