Files
ViewDesignEngine/include/vde_render/section_view.h
T
hm e688c93f80 refactor(batch3): extract render module headers to vde_render/
Moved render_types.h, section_view.h, viewport_layout.h from include/vde/render/ to include/vde_render/

Moved appearance.h from include/vde/brep/ to include/vde_render/ (was orphan file)

Updated all include paths and cross-references
2026-08-06 16:32:36 +08:00

136 lines
4.6 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#pragma once
/**
* @file section_view.h
* @brief Interactive Section View API (VDE-209)
*
* 在 vde::render 命名空间下提供交互式截面视图功能:
* - 截面平面管理(添加/删除/激活/变换)
* - 体与截平面的精确求交 → NURBS 截面曲线
* - 截面封闭面(cap face)三角化
* - 截面操纵器(manipulator)状态查询
*
* 底层调用 vde::brep::section_plane 进行 B-Rep 级别求交。
*
* @ingroup render
*/
#include "vde_render/render_types.h"
#include "vde/brep/brep.h"
#include "vde/curves/nurbs_curve.h"
#include "vde/core/point.h"
#include "vde/core/matrix4d.h"
#include <vector>
#include <cstdint>
namespace vde::render {
// ═══════════════════════════════════════════════
// 截面曲线 + 三角面片
// ═══════════════════════════════════════════════
/**
* @brief 体与截面平面求交,返回截面 NURBS 曲线
*
* 委托给 vde::brep::section_plane 进行 B-Rep 级精确求交。
*
* @param body B-Rep 模型
* @param plane 截面平面定义(point + normal)
* @return 截面 NURBS 曲线集合(3D 世界坐标)
*/
[[nodiscard]] std::vector<curves::NurbsCurve> section_intersection_curves(
const brep::BrepModel& body,
const SectionPlane& plane);
/**
* @brief 截面封闭面(cap face)三角化
*
* 对截面曲线围成的封闭区域进行三角剖分,生成面片用于填充截面。
* 使用扇三角剖分(fan triangulation)——从截面曲线采样点构建三角形扇。
*
* @param body B-Rep 模型
* @param plane 截面平面
* @param cap_color 封口面颜色
* @return 三角面片列表
*/
[[nodiscard]] std::vector<TriangleFace> section_cap_faces(
const brep::BrepModel& body,
const SectionPlane& plane,
const Color& cap_color);
// ═══════════════════════════════════════════════
// 截面平面管理
// ═══════════════════════════════════════════════
/**
* @brief 为指定体添加截面平面
*
* 新截面平面自动注册并返回唯一索引。
*
* @param body B-Rep 模型
* @param point 平面上一点(世界坐标)
* @param normal 平面法向量
* @return 截面平面索引(≥ 0)
*/
int add_section_plane(const brep::BrepModel& body,
const core::Point3D& point,
const core::Vector3D& normal);
/**
* @brief 移除指定索引的截面平面
* @param index 截面平面索引(由 add_section_plane 返回)
*/
void remove_section_plane(int index);
/**
* @brief 设置截面平面的空间变换
*
* 更新指定截面平面的位置和朝向。
*
* @param index 截面平面索引
* @param transform 4×4 变换矩阵
*/
void set_section_plane_transform(int index,
const core::Matrix4D& transform);
// ═══════════════════════════════════════════════
// 截面操纵器
// ═══════════════════════════════════════════════
/**
* @brief 获取截面平面操纵器状态
*
* 返回操纵器的位置、旋转、缩放和可见性。
*
* @param plane_index 截面平面索引
* @return 操纵器状态
*/
[[nodiscard]] ManipulatorState section_manipulator_state(int plane_index);
// ═══════════════════════════════════════════════
// 活动截面平面状态管理
// ═══════════════════════════════════════════════
/**
* @brief 获取活动截面平面索引
* @return 当前活动截面平面索引(默认 -1 = 无)
*/
[[nodiscard]] int active_section_plane();
/**
* @brief 设置活动截面平面
* @param index 截面平面索引(-1 = 取消激活)
*/
void set_active_section_plane(int index);
/**
* @brief 获取指定索引的截面平面定义
* @param index 截面平面索引
* @return 截面平面数据
*/
[[nodiscard]] SectionPlane get_section_plane(int index);
/** @brief 获取当前所有截面平面数量 */
[[nodiscard]] int section_plane_count();
} // namespace vde::render