VS:Ang2Vec: Difference between revisions

From Vectorworks Developer
Jump to navigation Jump to search
m (1 revision)
(add remark about 3-dimensional size)
Line 36: Line 36:
</lineList>
</lineList>
</params>
</params>
-----------------------------------------------------------------------------------------------------------
<remark>
([[User:CBM-c-|_c_]], 2022.01.19) The vector returned is always 3-dimensional -in Pascal in the form {0, 0, 0}, in Python as tuple in the form (0, 0, 0)- whereby the last item is always 0.
</remark>
-----------------------------------------------------------------------------------------------------------
<sample>
==== VectorScript ====
<code lang=pas>
Message( Ang2Vec(45, 1)); { 3-dimensional vector whose z item is always 0 }
</code>
==== Python ====
<code lang="py">
v = vs.Ang2Vec(45, 1)
vs.Message( str( v ) ) # 3-dimensional tuple whose last item is always 0
</code>
</sample>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------
<return>
<return>
Returns a 2-dimensional vector.</return>
Returns a 2-dimensional vector.
</return>


-----------------------------------------------------------------------------------------------------------
-----------------------------------------------------------------------------------------------------------

Revision as of 03:56, 20 January 2022

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

Description

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

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

Parameters

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

Return Value

Returns a 2-dimensional vector.

Remarks

(_c_, 2022.01.19) The vector returned is always 3-dimensional -in Pascal in the form {0, 0, 0}, in Python as tuple in the form (0, 0, 0)- whereby the last item is always 0.

Example

VectorScript

Message( Ang2Vec(45, 1)); { 3-dimensional vector whose z item is always 0 }

Python

v = vs.Ang2Vec(45, 1)
vs.Message( str( v ) ) # 3-dimensional tuple whose last item is always 0

Version

Availability: from All Versions