VS:DotProduct/ja

From Vectorworks Developer
Jump to navigation Jump to search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

指定した2つのベクトルの内積を返します。

FUNCTION DotProduct(
v1 :VECTOR;
v2 :VECTOR) : REAL;
def vs.DotProduct(v1, v2):
    return REAL

Parameters

v1 VECTOR ベクトル1
v2 VECTOR ベクトル2

Return Value

第1ベクトルと第2ベクトルの積を返します。

Example

PROCEDURE Example;
VAR
	pt1, pt2, pt3, pt4 :VECTOR;
	ang :REAL;
BEGIN
	GetPt(pt1.x, pt1.y);
	GetPtL(pt1.x, pt1.y, pt2.x, pt2.y);
	GetPtL(pt2.x, pt2.y, pt3.x, pt3.y);
	MoveTo(pt1.x, pt1.y);
	LineTo(pt2.x, pt2.y);
	LineTo(pt3.x, pt3.y);
	pt4 := (pt1 + pt3) / 2;
	{Find the angle between the vectors.}
	ang := Rad2Deg(ArcCos(DotProduct(UnitVec(pt1-pt2), UnitVec(pt3-pt2))));
	TextOrigin(pt4.x, pt4.y);
	CreateText(Concat(ang));
END;
RUN(Example);

Version

利用可能バージョン: VectorWorks8.0

See Also

関連関数:

VS:AngBVec

関連関数: [[VS:AngBVec]]