Exemplo n.º 1
0
    def boxFromDragResize(self, box, ray):
        point = self.dragResizePoint(ray)

        side = self.dragResizeFace & 1
        dragdim = self.dragResizeFace >> 1

        origin, size = list(box.origin), list(box.size)
        if side:
            origin[dragdim] += size[dragdim]
        size[dragdim] = 0

        otherSide = BoundingBox(origin, size)
        origin[dragdim] = int(numpy.floor(point[dragdim] + 0.5))
        thisSide = BoundingBox(origin, size)

        return thisSide.union(otherSide)
Exemplo n.º 2
0
    def boxFromDragResize(self, box, ray):
        point = self.dragResizePoint(ray)

        side = self.dragResizeFace & 1
        dragdim = self.dragResizeFace >> 1

        origin, size = list(box.origin), list(box.size)
        if side:
            origin[dragdim] += size[dragdim]
        size[dragdim] = 0

        otherSide = BoundingBox(origin, size)
        origin[dragdim] = int(numpy.floor(point[dragdim] + 0.5))
        thisSide = BoundingBox(origin, size)

        return thisSide.union(otherSide)
Exemplo n.º 3
0
    def boxFromDragSelect(self, ray):
        """
        Create a flat selection from dragging the mouse outside the selection.

        :type ray: mcedit2.util.geometry.Ray
        :rtype: BoundingBox
        """
        point = self.dragStartPoint
        face = self.dragStartFace
        size = [1, 1, 1]

        dim = face >> 1
        size[dim] = 0
        s = [0,0,0]

        if face & 1 == 0:
            s[dim] = 1
            point = point + s

        startBox = BoundingBox(point, size)
        endPoint = ray.intersectPlane(dim, point[dim])
        endBox = BoundingBox(endPoint.intfloor(), size)

        return startBox.union(endBox)
Exemplo n.º 4
0
    def boxFromDragSelect(self, event):
        """
        Create a flat selection from dragging the mouse outside the selection.

        Parameters
        ----------

        ray: mcedit2.util.geometry.Ray

        Returns
        -------

        box: BoundingBox
        """
        point = self.dragStartPoint
        face = self.dragStartFace
        size = [1, 1, 1]

        if self.classicSelection:
            endPoint = event.blockPosition
        else:
            ray = event.ray
            dim = face >> 1
            size[dim] = 0
            s = [0, 0, 0]

            if face & 1 == 0:
                s[dim] = 1
                point = point + s

            endPoint = ray.intersectPlane(dim, point[dim])

        startBox = BoundingBox(point, size)
        endBox = BoundingBox(endPoint.intfloor(), size)

        return startBox.union(endBox)
Exemplo n.º 5
0
    def boxFromDragSelect(self, event):
        """
        Create a flat selection from dragging the mouse outside the selection.

        Parameters
        ----------

        ray: mcedit2.util.geometry.Ray

        Returns
        -------

        box: BoundingBox
        """
        point = self.dragStartPoint
        face = self.dragStartFace
        size = [1, 1, 1]

        if self.classicSelection:
            endPoint = event.blockPosition
        else:
            ray = event.ray
            dim = face >> 1
            size[dim] = 0
            s = [0,0,0]

            if face & 1 == 0:
                s[dim] = 1
                point = point + s

            endPoint = ray.intersectPlane(dim, point[dim])

        startBox = BoundingBox(point, size)
        endBox = BoundingBox(endPoint.intfloor(), size)

        return startBox.union(endBox)
Exemplo n.º 6
0
    def boxFromDragSelect(self, ray):
        """
        Create a flat selection from dragging the mouse outside the selection.

        :type ray: mcedit2.util.geometry.Ray
        :rtype: BoundingBox
        """
        point = self.dragStartPoint
        face = self.dragStartFace
        size = [1, 1, 1]

        dim = face >> 1
        size[dim] = 0
        s = [0, 0, 0]

        if face & 1 == 0:
            s[dim] = 1
            point = point + s

        startBox = BoundingBox(point, size)
        endPoint = ray.intersectPlane(dim, point[dim])
        endBox = BoundingBox(endPoint.intfloor(), size)

        return startBox.union(endBox)