Browse Source

Direction molecules: Now we include reference point, consider it when test if molecules found

Bastien Sevajol 9 years ago
parent
commit
183d15a518
1 changed files with 4 additions and 2 deletions
  1. 4 2
      intelligine/simulation/molecule/DirectionMolecule.py

+ 4 - 2
intelligine/simulation/molecule/DirectionMolecule.py View File

24
         around_molecules_points = cls._get_around_molecules(context, point, molecule_type,
24
         around_molecules_points = cls._get_around_molecules(context, point, molecule_type,
25
                                                             molecule_filter=around_molecule_filter)
25
                                                             molecule_filter=around_molecule_filter)
26
 
26
 
27
-        if not around_molecules_points:
27
+        if not around_molecules_points \
28
+           or (len(around_molecules_points) == 1 and around_molecules_points[0][0] == point):
28
             raise NoMolecule()
29
             raise NoMolecule()
29
 
30
 
30
         shuffle(around_molecules_points)
31
         shuffle(around_molecules_points)
74
             except NoMolecule:
75
             except NoMolecule:
75
                 pass  # Ok, no molecule, continue to sniff around
76
                 pass  # Ok, no molecule, continue to sniff around
76
 
77
 
77
-        if not around_molecules_points:
78
+        if not around_molecules_points \
79
+           or (len(around_molecules_points) == 1 and around_molecules_points[0][0] == reference_point):
78
             raise NoMolecule()
80
             raise NoMolecule()
79
 
81
 
80
         shuffle(around_molecules_points)
82
         shuffle(around_molecules_points)