Ejemplo n.º 1
0
Archivo: math.py Proyecto: bedlamzd/vkr
def diap(start, end, step=1) -> List[float]:
    """ Принимает две точки пространства и возвращает точки распределенные на заданном расстоянии
     между данными двумя.
    :param Iterable[float] start: начальная точка в пространстве
    :param Iterable[float] end: конечная точка в пространстве
    :param float step: шаг между точками
    :return: точка между start и end
    """
    start = Vector(start)
    end = Vector(end)
    d = start.distance(end)
    number_of_steps = int(d / step)
    ratio = step / d
    for i in range(number_of_steps):
        yield list(start.lerp(end, i * ratio))
    yield list(end)
Ejemplo n.º 2
0
 def _arc_caps(start: Vector, end: Vector, color1: int, color2: int):
     attribs = _dxfattribs(mline)
     center = start.lerp(end)
     radius = (end - start).magnitude / 2.0
     angle = (start - center).angle_deg
     attribs['center'] = center
     attribs['radius'] = radius
     attribs['color'] = color1
     attribs['start_angle'] = angle
     attribs['end_angle'] = angle + (180 if color1 == color2 else 90)
     arc1 = factory.new('ARC', dxfattribs=attribs, doc=doc)
     if color1 == color2:
         return arc1,
     attribs['start_angle'] = angle + 90
     attribs['end_angle'] = angle + 180
     attribs['color'] = color2
     arc2 = factory.new('ARC', dxfattribs=attribs, doc=doc)
     return arc1, arc2