VS:CrossProduct

From Vectorworks Developer
Revision as of 10:03, 12 May 2021 by Ptr (talk | contribs)
Jump to navigation Jump to search

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

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.

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

Parameters

v1 VECTOR Source vector 1.
v2 VECTOR Source vector 2.

Return Value

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

Remarks

This is provided for cross-platform compatibility.


To elaborate a little... The first vector defines the X axis of a new coordinate system; the second vector defines the positive Y direction in that coordinate system. The cross product of those vectors will be in the positive Z direction.

Ptr [2021.05.12]: Since in Python a VECTOR doesn't exist, you need to use tuples instead.

Version

Availability: from VectorWorks8.5