Ang2Vec Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   Ang2Vec
(   angleR :REAL;
    Length :REAL
) :VECTOR ;

Python:

def  vs.Ang2Vec(angleR, Length):
   return VECTOR

Description:

Returns a 2-dimensional vector that is defined by the specified polar angle and length values.

Parameters:

angleR The angle of the vector (in degrees).
Length The length of the vector.

Result:

Returns a 2-dimensional vector.



  AngBVec Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   AngBVec
(   v1 :VECTOR;
    v2 :VECTOR
) :REAL ;

Python:

def  vs.AngBVec(v1, v2):
   return REAL

Description:

Returns the positive angle between the two specified vectors, in the range of 0~180 degrees.

When used with 3D vectors, the angle returned will be in a plane defined by the two vectors.

Parameters:

v1 First vector to be compared.
v2 Second vector to be compared.

Result:

Returns a REAL value which is the angle (in degrees) between the two vectors.

Example:

PROCEDURE Example;
VAR
	pt1, pt2, pt3, pt4 :VECTOR;
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;
	TextOrigin(pt4.x, pt4.y);
	CreateText(Concat(AngBVec(pt1 - pt2, pt3 - pt2)));
END;
RUN(Example);



  Comp Math - Vectors 
MiniCAD

VectorScript Declaration:

PROCEDURE   Comp
(   v1 :VECTOR;
    v2 :VECTOR;
  VAR  v3 :VECTOR;
  VAR  v4 :VECTOR
) ;

Python:

def  vs.Comp(v1, v2, v3, v4):
   return (v3, v4)

Description:

Returns the components of a comparison of two vectors.

The vector component of v1 along v2 in v3, and the vector component of v1 orthogonal to v2 in v4.

Parameters:

v1 Comparison vector 1.
v2 Comparison vector 2
v3 Component of vector 1 along vector 2
v4 Component of vector 1 orthogonal to vector 2.



  CrossProduct Math - Vectors 
VectorWorks8.5

VectorScript Declaration:

FUNCTION   CrossProduct
(   v1 :VECTOR;
    v2 :VECTOR
) :VECTOR ;

Python:

def  vs.CrossProduct(v1, v2):
   return VECTOR

Description:

Returns the cross product of the two specified vectors.

The cross product is also known as the vector product of the two vectors. The result is a vector whose magnitude is equivalent to the product of the magnitudes of the two vectors multiplied by the sine of the smaller angle between the two vectors. The direction of the resultant vector is perpendicular to a plane formed by the two source vectors.

Parameters:

v1 Source vector 1.
v2 Source vector 2.

Result:

Returns a VECTOR which is the cross product of v1 and v2.



  DotProduct Math - Vectors 
VectorWorks8.0

VectorScript Declaration:

FUNCTION   DotProduct
(   v1 :VECTOR;
    v2 :VECTOR
) :REAL ;

Python:

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

Description:

Returns the dot product of the two specified vectors.

The dot product is also known as the scalar product of the two vectors, and is equivalent to the product of the magnitudes of the two vectors multiplied by the cosine of the angle between the two vectors.

Parameters:

v1 Source vector 1.
v2 Source vector 2.

Result:

Returns the scalar, or dot, product of the vectors v1 and v2.

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);

See Also:

AngBVec  



  Norm Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   Norm
( Vec:VECTOR ) :REAL ;

Python:

def  vs.Norm(Vec):
   return REAL

Description:

Returns the length, or magnitude, of the specified vector.

Parameters:

Vec Vector to be measured.

Result:

A REAL value which is the length of the vector.

Example:

PROCEDURE Example;
VAR
	vec :VECTOR;
BEGIN
	vec.x := 1;
	vec.y := 1.732050807;
	Message(Norm(vec));
END;
RUN(Example);

See Also:

Distance  



  Perp Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   Perp
( Vec:VECTOR ) :VECTOR ;

Python:

def  vs.Perp(Vec):
   return VECTOR

Description:

Returns a vector which is perpendicular to the specified vector. The resultant vector will have the same magnitude as the source vector, and their scalar product will be zero. The direction of the return vector will equal Vec2Ang(Vec) - 90.

Parameters:

Vec Source vector.

Result:

Returns a VECTOR.



  UnitVec Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   UnitVec
( Vect:VECTOR ) :VECTOR ;

Python:

def  vs.UnitVec(Vect):
   return VECTOR

Description:

Returns the standard unit vector of the specified vector.

Parameters:

Vect Source vector.

Result:

Returns a VECTOR.



  Vec2Ang Math - Vectors 
MiniCAD

VectorScript Declaration:

FUNCTION   Vec2Ang
( Vect:VECTOR ) :REAL ;

Python:

def  vs.Vec2Ang(Vect):
   return REAL

Description:

Returns the angle, in degrees, of the specified vector. If Vect is a 3D vector, Vec2Ang will return the 3D angle between Vect and the X axis. If Vect is {0,0,0}, Vec2Ang returns -90.

Parameters:

Vect Source vector.

Result:

Returns the angle of the specified vector in degrees.