Unitize vector VB


vector.unitize gives only true false in vb rhinocommon, how can i get value of unit vector.


The length of the unitized vector is always 1, no?

right, but i need direction unitized.

for ex, in pyhton script, rs.messagebox(rs.vectorunitize(vec)) gives vector (0,0,1), but vb gives true or false

This seems to work here:

Dim p0 As New Point3d(0.0, 0.0, 0.0)
Dim p1 As New Point3d(5.0, 4.0, 3.0)
Dim dir As Vector3d = p1 - p0
If (dir.Unitize()) Then
    ' TODO....
End If

Note, an invalid or zero length vector cannot be unitized…

Unitize() works in-place, that is, it modifies the vector on which you call the method
After calling Unitize(), your vector becomes the unit vector you’re looking for