SIVector3.Dot

説明

このベクトルとベクトル v の内積を戻します。内積は次のように定義されます。

X Y = |X| |Y| cos( theta )

ここで、theta はベクトル間の角度で、|X| はベクトル X の長さです。

C#構文

Double SIVector3.Dot( SIVector3 in_pVector );

スクリプト構文

oFloat = SIVector3.Dot( v );

戻り値

Float ポイント値(このベクトルとベクトル vの内積)

パラメータ

パラメータ タイプ 説明
v SIVector3 オペランドベクトル

1. JScript の例

x = XSIMath.CreateVector3();

y = XSIMath.CreateVector3();

// Example 1: Perpendicular vectors have 0 dot product

x.Set( 1,0,0 ) ;

y.Set( 0,1,0 ) ;

// Output is 0

Application.LogMessage( x.Dot( y ) ) ;

// Example 2: Commutative nature of dot product

x.Set( 2,0,0 ) ;

y.Set( 1,1,0 ) ;

// Output is 2 for both

Application.LogMessage( x.Dot( y ) ) ;

Application.LogMessage( y.Dot( x ) ) ;

// Example 3: When angle is zero the value

// is equal to the lengths multipled

x.Set( 2,0,0 ) ;

y.Set( 3,0,0 ) ;

//Output is 6 for both

Application.LogMessage( x.Dot( y ) ) ;

Application.LogMessage( x.length() * y.length() ) ;

2. VBScript の例

dim v1, v2

' Create 3D vectors.

set v1 = XSIMath.CreateVector3

set v2 = XSIMath.CreateVector3

v1.Set 1.0, 0.0, 0.0

v2.Set 1.0, 1.0, 0.0

Application.LogMessage v1.Dot( v2 )

関連項目

SIVector3.Angle SIMatrix3 SIMatrix4 SIRotation SITransformation SIQuaternion