Exemplo n.º 1
0
    def action_on_pspict(self, pspict):
        from yanntricks.src.segment import Segment

        # self.intersection is the point where the angle is located.

        P1 = self.inter_point(self.intersection, self.d1.F, self.n1, pspict)
        P2 = self.inter_point(self.intersection, self.d2.F, self.n2, pspict)

        Q = P1 + P2 - self.intersection
        l1 = Segment(Q, P1)
        l2 = Segment(Q, P2)

        l1.parameters = self.parameters.copy()
        l2.parameters = self.parameters.copy()
        pspict.DrawGraphs(l1, l2)
Exemplo n.º 2
0
    def action_on_pspict(self, pspict=None):
        from yanntricks.src.segment import Segment
        from yanntricks.src.Constructors import CustomSurface
        from yanntricks.src.Exceptions import ShouldNotHappenException
        c1 = self.curve1.graph(self.mx1, self.Mx1)
        c2 = self.curve2.graph(self.mx2, self.Mx2)

        # By convention, the first line goes from left to right
        # and the second one to right to left.
        # The same is followed in SurfaceBetweenLines

        if c1.I.x > c1.F.x:
            c1 = c1.reverse()
        if c2.I.x < c2.F.x:
            c2 = c2.reverse()

        reIsegment = Segment(c2.F, c1.I)
        reFsegment = Segment(c1.F, c2.I)
        reIsegment.parameters = self.Isegment.parameters
        reFsegment.parameters = self.Fsegment.parameters

        if self.parameters._filled or self.parameters._hatched:
            custom = CustomSurface(c1, reFsegment, c2, reIsegment)
            custom.parameters = self.parameters.copy()
            pspict.DrawGraphs(custom)
        else:
            raise ShouldNotHappenException(
                "You are speaking of a surface but you don't want neither to fill it neither to hatch it ?"
            )

        if self.parameters.color != None:
            self.Isegment.parameters.color = self.parameters.color
            self.Fsegment.parameters.color = self.parameters.color
            self.curve1.parameters.color = self.parameters.color
            self.curve2.parameters.color = self.parameters.color

        pspict.DrawGraphs(self.curve1, self.curve2)

        if self.draw_Isegment:
            pspict.DrawGraphs(reIsegment)
        if self.draw_Fsegment:
            pspict.DrawGraphs(reFsegment)