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

# pyrr.vector.squared_length

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

```        vec.ndim with the last dimension being size 1.
"""
return vector.squared_length( quat )

def length( quat ):
```

```        vec.ndim with the last dimension being size 1.
"""
return vector.squared_length( quat )

def length( quat ):
```

```    # do a dot product against the render direction
lengths = pyrr.vector.squared_length(
relative_positions
)

```

```    # do a dot product against the render direction
lengths = pyrr.vector.squared_length(
relative_positions
)

```

```    cross = vector.cross( rl, rp )
dot = vector.dot( rp, rl )
squared_length = vector.squared_length( rl )

if numpy.count_nonzero( cross ) > 0:
```
```    # check if the line has any length
rl = segment[ 1 ] - segment[ 0 ]
squared_length = vector.squared_length( rl )
if squared_length == 0.0:
return segment[ 0 ]
```

```        def single_vector():
vec = numpy.array( [ 1.0, 1.0, 1.0 ] )
result = vector.squared_length( vec )

expected = numpy.sum( vec ** 2 )
```
```        def batch_square_length():
vec = numpy.array( [ 1.0, 1.0, 1.0 ] )
batch = numpy.tile( vec, (3,1) )
result = vector.squared_length( batch )

```

```    cross = vector.cross( rl, rp )
dot = vector.dot( rp, rl )
squared_length = vector.squared_length( rl )

if numpy.count_nonzero( cross ) > 0:
```
```    # check if the line has any length
rl = segment[ 1 ] - segment[ 0 ]
squared_length = vector.squared_length( rl )
if squared_length == 0.0:
return segment[ 0 ]
```