Did I find the right examples for you? yes no      Crawl my project      Python Jobs

# Rhino.Geometry.Vector3d.Unitize

All Samples(13)  |  Call(13)  |  Derive(0)  |  Import(0)

```    vector1 = Rhino.Geometry.Vector3d(vector1.X, vector1.Y, vector1.Z)
vector2 = Rhino.Geometry.Vector3d(vector2.X, vector2.Y, vector2.Z)
if not vector1.Unitize() or not vector2.Unitize():
raise ValueError("unable to unitize vector")
dot = vector1 * vector2
```
```    vector = rhutil.coerce3dvector(vector, True)
rc = Rhino.Geometry.Vector3d(vector.X, vector.Y, vector.Z)
if rc.Unitize(): return rc

```

```            northVector = rc.Geometry.Vector3d.YAxis
northVector.Unitize()
except Exception, e:
# print `e`
try:
northVector = rc.Geometry.Vector3d(north)
northVector.Unitize()
```
```        basePoint.Rotate((self.angle2North + self.solAz) + PI, rc.Geometry.Vector3d.ZAxis, self.cenPt)
sunVector = rc.Geometry.Vector3d(self.cenPt - basePoint.Location)
sunVector.Unitize()

```

```
lastVector = rc.Geometry.Vector3d(ptList[-2] - ptList[-1])
lastVector.Unitize()

crossProductNormal = rc.Geometry.Vector3d.CrossProduct(intNormal, lastVector)
```

```    for pt in visiblePts:
movingVector = rc.Geometry.Vector3d(pt- cenPt)
movingVector.Unitize()

```

```
lastVector = rc.Geometry.Vector3d(ptList[-2] - ptList[-1])
lastVector.Unitize()

crossProductNormal = rc.Geometry.Vector3d.CrossProduct(intNormal, lastVector)
```

```        xaxis = rhutil.coerce3dvector(xaxis, True)
xaxis = Rhino.Geometry.Vector3d(xaxis)#prevent original xaxis parameter from being unitized too
xaxis.Unitize()
yaxis = Rhino.Geometry.Vector3d.CrossProduct(rc.Normal, xaxis)
rc = Rhino.Geometry.Plane(origin, xaxis, yaxis)
```

```    def getUnitizedMovingVector(Pt1, Pt2):
movingVec = rc.Geometry.Vector3d(Pt2 - Pt1)
movingVec.Unitize()
return movingVec

```

```            for pt in pts:
movingVector = rc.Geometry.Vector3d(cenPt-pt)
movingVector.Unitize()
newPt = rc.Geometry.Point3d.Add(pt, movingVector * 2 * sc.doc.ModelAbsoluteTolerance)
insetPts.append(newPt)
```

```            for pt in pts: