Esempio n. 1
0
 def __call__(self, inter):
     func = GetShapeF1D()
     shapes = func(inter)
     for a in shapes:
         if a.id == self._id:
             return True
     return False
Esempio n. 2
0
 def __call__(self, inter):
     func = GetShapeF1D()
     shapes = func(inter)
     for s in shapes:
         if (s.id == self._id):
             return False
     it = inter.vertices_begin()
     itlast = inter.vertices_end()
     itlast.decrement()
     v = it.object
     vlast = itlast.object
     tvertex = v.viewvertex
     if type(tvertex) is TVertex:
         #print("TVertex: [ ", tvertex.id.first, ",",  tvertex.id.second," ]")
         eit = tvertex.edges_begin()
         while not eit.is_end:
             ve, incoming = eit.object
             if ve.id == self._id:
                 return True
             #print("-------", ve.id.first, "-", ve.id.second)
             eit.increment()
     tvertex = vlast.viewvertex
     if type(tvertex) is TVertex:
         #print("TVertex: [ ", tvertex.id.first, ",",  tvertex.id.second," ]")
         eit = tvertex.edges_begin()
         while not eit.is_end:
             ve, incoming = eit.object
             if ve.id == self._id:
                 return True
             #print("-------", ve.id.first, "-", ve.id.second)
             eit.increment()
     return False
Esempio n. 3
0
 def shade(self, stroke, func=GetShapeF1D(), curvemat=CurveMaterialF0D()):
     shape = func(stroke)[0].id.first
     item = self.shape_map.get(shape)
     if len(stroke) > 2:
         if item is not None:
             item[0].append(stroke)
         else:
             # the shape is not yet present, let's create it.
             material = curvemat(Interface0DIterator(stroke))
             *color, alpha = material.diffuse
             self.shape_map[shape] = ([stroke], color, alpha)
     # make the strokes of the second drawing invisible
     for v in stroke:
         v.attribute.visible = False
Esempio n. 4
0
    def __call__(self, inter):
        shapes = GetShapeF1D()(inter)
        if any(s.id == self._id for s in shapes):
            return False

        # construct iterators
        it = inter.vertices_begin()
        itlast = inter.vertices_end()
        itlast.decrement()

        vertex = next(it)
        if type(vertex) is TVertex:
            eit = vertex.edges_begin()
            if any(ve.id == self._id for (ve, incoming) in eit):
                return True

        vertex = next(itlast)
        if type(vertex) is TVertex:
            eit = tvertex.edges_begin()
            if any(ve.id == self._id for (ve, incoming) in eit):
                return True
        return False
Esempio n. 5
0
 def __call__(self, inter):
     shapes = GetShapeF1D()(inter)
     return any(a.id == self._id for a in shapes)
Esempio n. 6
0
 def __init__(self):
     UnaryPredicate1D.__init__(self)
     self.__func1 = GetOccludersF1D()
     self.__func2 = GetShapeF1D()