This requires
Matrix1 Utilities.
The vector CSV functions in this snippet provides you with what you need to quickly output text or assign values containing the position, rotation, scale or size of objects or limbs.
Rather than writing the following frequently used operation:
Text 0, 0, Str$( X Vector3(id), 1) + "," + Str$( Y Vector3(id), 1) + "," + Str$( Z Vector3(id), 1)
You can perform the same with less code by writing the following:
Text 0, 0, Vec3$( id, iDecimalPoints )
Each function has an additional version which returns the comma seperated string with spaces. All functions require a decimal point count.
Note: If a vector used with the string return function does not exist; or is of the wrong vector type; an error string is returned.
The object vector equivalent has been posted
here
//==================================================
Function Vec4$(iVec4, iDec)
If Vector Type(iVec4) <> 3
s$ = "[Invalid Vector4 at Index: " + Str$(iVec4) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector4(iVec4), iDec ) + ","
s$ = s$ + Str$( Y Vector4(iVec4), iDec ) + ","
s$ = s$ + Str$( Z Vector4(iVec4), iDec ) + ","
s$ = s$ + Str$( W Vector4(iVec4), iDec )
EndFunction S$
//==================================================
Function Vec3$(iVec3, iDec)
If Vector Type(iVec3) <> 2
s$ = "[Invalid Vector3 at Index: " + Str$(iVec3) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector3(iVec3), iDec ) + ","
s$ = s$ + Str$( Y Vector3(iVec3), iDec ) + ","
s$ = s$ + Str$( Z Vector3(iVec3), iDec )
EndFunction S$
//==================================================
Function Vec2$(iVec2, iDec)
If Vector Type(iVec2) <> 1
s$ = "[Invalid Vector2 at Index: " + Str$(iVec2) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector2(iVec2), iDec ) + ","
s$ = s$ + Str$( Y Vector2(iVec2), iDec )
EndFunction S$
//==================================================
Function Vec4_$(iVec4, iDec)
If Vector Type(iVec4) <> 3
s$ = "[Invalid Vector4 at Index: " + Str$(iVec4) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector4(iVec4), iDec ) + ", "
s$ = s$ + Str$( Y Vector4(iVec4), iDec ) + ", "
s$ = s$ + Str$( Z Vector4(iVec4), iDec ) + ", "
s$ = s$ + Str$( W Vector4(iVec4), iDec )
EndFunction S$
//==================================================
Function Vec3_$(iVec3, iDec)
If Vector Type(iVec3) <> 2
s$ = "[Invalid Vector3 at Index: " + Str$(iVec3) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector3(iVec3), iDec ) + ", "
s$ = s$ + Str$( Y Vector3(iVec3), iDec ) + ", "
s$ = s$ + Str$( Z Vector3(iVec3), iDec )
EndFunction S$
//==================================================
Function Vec2_$(iVec2, iDec)
If Vector Type(iVec2) <> 1
s$ = "[Invalid Vector2 at Index: " + Str$(iVec2) + "]"
ExitFunction s$
Endif
s$ = Str$( X Vector2(iVec2), iDec ) + ", "
s$ = s$ + Str$( Y Vector2(iVec2), iDec )
EndFunction S$
![](http://www.binarymodular.com/sfbanner3.png)