• S sverchok
  • Информация о проекте
    • Информация о проекте
    • Активность
    • Метки
    • Участники
  • Репозиторий
    • Репозиторий
    • Файлы
    • Коммиты
    • Ветки
    • Теги
    • Участники
    • Диаграмма
    • Сравнение
  • Задачи 148
    • Задачи 148
    • Список
    • Доски
    • Спринты
  • Запросы на слияние 21
    • Запросы на слияние 21
  • CI/CD
    • CI/CD
    • Конвейеры
    • Задания
    • Расписания
  • Развертывания
    • Развертывания
    • Окружения
    • Релизы
  • Пакеты и реестры
    • Пакеты и реестры
    • Реестр пакетов
    • Реестр контейнеров
  • Мониторинг
    • Мониторинг
    • Инциденты
  • Аналитика
    • Аналитика
    • Поток ценности
    • CI/CD
    • Репозиторий
  • Wiki
    • Wiki
  • Сниппеты
    • Сниппеты
  • Активность
  • Диаграмма
  • Создать новую задачу
  • Задания
  • Коммиты
  • Доски с задачами
Свернуть панель
  • nikitronn
  • sverchok
  • Задачи
  • #3259
Закр.
Открыто
Задача созд. Май 18, 2020 пользователемnikitronn@nikitronnВладелец

Surface from 4 curves/ cyclic curve

Created by: vicdoval

image image

I coded this SNL to create a surface from 4 curves (that could be one curve splitted if four pieces).

It could became a feature (or two features, cyclic and 4-curves) of "surface from curves" or a independent node. It is not perfect and produces some stretching in the boundary polygons, but it works in regular Sverchok.

By the moment it outputs vertices but i guess it could output a surface object.... What do you think @portnov? Are you planning to introduce a better algorithm for this task? You think is better to leave it as a SNL example till someone codes a better solution?

The script:

"""
in arc         C  
in U  s  d=0.1 n=1
in V  s  d=0.1 n=1
out verts      v
"""
from sverchok.utils.modules.geom_utils import interp_v3_v3v3 as lerp
from math import sin, pi


t_min0, t_max0 = arc[0].get_u_bounds()
t_min1, t_max1 = arc[1].get_u_bounds()
t_min2, t_max2 = arc[2].get_u_bounds()
t_min3, t_max3 = arc[3].get_u_bounds()

verts =[]
for v in V:
    for u in U:

        t0 = t_min0 + (t_max0 - t_min0) * u
        t2 = t_min2 + (t_max2 - t_min2) * (1-u)
        p0 =arc[0].evaluate(t0).tolist()
        p2 =arc[2].evaluate(t2).tolist()
        t1 = t_min1 + (t_max1 - t_min1) * v
        t3 = t_min3 + (t_max3 - t_min3) * (1-v)
        p1 =arc[1].evaluate(t1).tolist()
        p3 =arc[3].evaluate(t3).tolist()

        if v ==0 or v==1:
            f = 0
        elif u==0 or u==1:
            f = 1
        else:
            f1 = sin(v*pi)/2
            f2 = 1-sin(u*pi)/2
            f = f1+(f2 - f1) * sin(v * pi)
            #other possible interpolation
            # f = f1+(f2 - f1) * 0.5
            
            
        verts.append(lerp( lerp(p0, p2, v), lerp(p1, p3, 1-u), f))
    
verts = [verts]
Ответственный
Назначить
Оценка трудозатрат