SIVector3.Angle
 
 
 

SIVector3.Angle

Description

Returns the angle (in radians) between this vector and the vector v.

C# Syntax

Double SIVector3.Angle( SIVector3 in_pVector );

Scripting Syntax

oFloat = SIVector3.Angle( v );

Return Value

Floating point value (angle in radians between this vector and the vector v).

Parameters

Parameter Type Description
v SIVector3 Operand vector

Examples

1. JScript Example

x = XSIMath.CreateVector3();
y = XSIMath.CreateVector3();
x.Set( 2,0,0 ) ;
y.Set( 1,1,0 ) ;
theta = x.Angle( y )
Application.LogMessage( "Angle is " + theta + " radians (" +  theta / XSIMath.Pi + " pi)" ) ;
Application.LogMessage( "Angle is " + XSIMath.RadiansToDegrees( x.Angle( y ) ) + " degrees" ) ;
//Output (rounded):
//INFO : Angle is 0.785398163 radians (0.25 pi)
//INFO : Angle is 45.0 degrees

2. VBScript Example

dim v1, v2
' Create 3D vectors.
set v1 = XSIMath.CreateVector3
set v2 = XSIMath.CreateVector3
v1.Set 1.0, 2.0, 3.0
v2.Set -1.0, 5.0, 6.0
angle = v1.Angle( v2 )

See Also

SIVector3 SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion