@@ -806,7 +806,7 @@ We're ready to write our three rules:
806
806
807
807
# Normalize the result
808
808
norm = np.sqrt((target* target).sum(axis = 1 )).reshape(n, 1 )
809
- target *= np.divide(target, norm, out = target, where = norm != 0 )
809
+ np.divide(target, norm, out = target, where = norm != 0 )
810
810
811
811
# Alignment at constant speed
812
812
target *= max_velocity
@@ -827,7 +827,7 @@ We're ready to write our three rules:
827
827
828
828
# Normalize the result
829
829
norm = np.sqrt((target* target).sum(axis = 1 )).reshape(n, 1 )
830
- target *= np.divide(target, norm, out = target, where = norm != 0 )
830
+ np.divide(target, norm, out = target, where = norm != 0 )
831
831
832
832
# Cohesion at constant speed (max_velocity)
833
833
target *= max_velocity
@@ -843,15 +843,15 @@ We're ready to write our three rules:
843
843
repulsion = np.dstack((dx, dy))
844
844
845
845
# Force is inversely proportional to the distance
846
- repulsion = np.divide(repulsion, distance.reshape(n, n, 1 )** 2 , out = repulsion,
847
- where = distance.reshape(n, n, 1 ) != 0 )
846
+ np.divide(repulsion, distance.reshape(n, n, 1 )** 2 , out = repulsion,
847
+ where = distance.reshape(n, n, 1 ) != 0 )
848
848
849
849
# Compute direction away from others
850
850
target = (repulsion* mask.reshape(n, n, 1 )).sum(axis = 1 )/ count.reshape(n, 1 )
851
851
852
852
# Normalize the result
853
853
norm = np.sqrt((target* target).sum(axis = 1 )).reshape(n, 1 )
854
- target *= np.divide(target, norm, out = target, where = norm != 0 )
854
+ np.divide(target, norm, out = target, where = norm != 0 )
855
855
856
856
# Separation at constant speed (max_velocity)
857
857
target *= max_velocity
0 commit comments