예제 #1
0
 def test(x1, y1, z1, x2, y2, z2):
     """Check a Vec pair for incorrect comparisons."""
     vec1 = Vec(x1, y1, z1)
     vec2 = Vec(x2, y2, z2)
     for op_func in comp_ops:
         if op_func is op.ne:
             # special-case - != uses or, not and
             corr_result = x1 != x2 or y1 != y2 or z1 != z2
         else:
             corr_result = op_func(x1, x2) and op_func(y1, y2) and op_func(
                 z1, z2)
         comp = ('Incorrect {{}} comparison for '
                 '({} {} {}) {} ({} {} {})'.format(x1, y1, z1,
                                                   op_func.__name__, x2, y2,
                                                   z2))
         assert op_func(vec1, vec2) == corr_result, comp.format('Vec')
         assert op_func(vec1, Vec_tuple(
             x2, y2, z2)) == corr_result, comp.format('Vec_tuple')
         assert op_func(vec1,
                        (x2, y2, z2)) == corr_result, comp.format('tuple')
         # Bare numbers compare magnitude..
         assert op_func(vec1, x2) == op_func(vec1.mag(),
                                             x2), comp.format('x')
         assert op_func(vec1, y2) == op_func(vec1.mag(),
                                             y2), comp.format('y')
         assert op_func(vec1, z2) == op_func(vec1.mag(),
                                             z2), comp.format('z')
예제 #2
0
    def _make_overlay(
        self,
        vmf: VMF,
        segment: Segment,
        pos: Vec,
        uax: Vec,
        vax: Vec,
        mat: AntTex,
    ) -> None:
        """Construct an antline overlay at this position."""
        overlay = make_overlay(
            vmf,
            segment.normal,
            pos,
            uax,
            vax,
            mat.texture,
            [],
            u_repeat=(uax.mag() / 16) * mat.scale,
        )
        if not mat.static:
            overlay['targetname'] = self.name

        for tile in segment.tiles:
            tile.bind_overlay(overlay)