/
spivag
/
command_occ
Обзор
Документация
Войти
/
spivag
/
command_occ
Код
Запросы
1
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
initial
commands/utils.h
59 строк
1 KB
Степанов Никита
Запрос на слияние 'topology_iterators' (
#3
) из topology_iterators в initial
27 апр 2026, 21:55
Верифицирован
27 апр 2026, 21:55
c047a95
Код
Авторство
О чём код?
#ifndef UTILS_H #define UTILS_H #include <geometry_types.h> #include <gp_Ax2.hxx> #include <gp_Ax3.hxx> #include <gp_Trsf.hxx> #include <gp_Pnt.hxx> #include <gp_Dir.hxx> #include <gp_Vec.hxx> //======================================================================================= // Вспомогательные функции преобразования типов //======================================================================================= inline gp_Pnt MakeOccPnt(R3::Point const& p) { return gp_Pnt{ p.x(), p.y(), p.z() }; } inline R3::Point MakeR3Point(gp_Pnt const& p) { return R3::Point{ p.X(), p.Y(), p.Z() }; } inline gp_Vec MakeOccVec(R3::Vector const& v) { return gp_Vec{ v.x(), v.y(), v.z() }; } inline gp_Ax2 MakeOccAx2(R3::Placement const& p) { gp_Vec ox = MakeOccVec(p.m_ox); gp_Vec oy = MakeOccVec(p.m_oy); return gp_Ax2{ MakeOccPnt(p.m_origin), gp_Dir(ox.Crossed(oy)), gp_Dir(ox) }; } inline gp_Trsf MakeOccTrsf(R3::Placement const& p) { gp_Vec ox = MakeOccVec(p.m_ox); gp_Vec oy = MakeOccVec(p.m_oy); gp_Ax3 target{ MakeOccPnt(p.m_origin), gp_Dir(ox.Crossed(oy)), gp_Dir(ox) }; gp_Trsf trsf; trsf.SetDisplacement(gp_Ax3{}, target); return trsf; } inline gp_Trsf MakeOccTrsf(R3::Transform const& t) { gp_Ax3 target{ MakeOccPnt(t.m_origin), gp_Dir(MakeOccVec(t.m_oz)), gp_Dir(MakeOccVec(t.m_ox)) }; gp_Trsf trsf; trsf.SetDisplacement(gp_Ax3{}, target); return trsf; } #endif // !UTILS_H