使用libigl绘制implicit function图像 您所在的位置:网站首页 implicit和implicate 使用libigl绘制implicit function图像

使用libigl绘制implicit function图像

#使用libigl绘制implicit function图像| 来源: 网络整理| 查看: 265

思想是需要将隐函数 f : R 3 → R f: R^3\rightarrow R f:R3→R 转换为mesh网格(根据标量场scalar field生成mesh),常用的算法是marching cubes算法(siggraph 87’ 论文链接)。二维的变体是marching squares.

libigl集成了marching cubes算法,也在tutorial中给出了样例:libigl tutorial链接

705_MarchingCubes 样例715_MeshImplicitFunction 样例

结合上述样例,自己用libigl绘制了Torus图像: ( x 2 + y 2 + z 2 + R 2 − a 2 ) 2 − 4 R 2 ( x 2 + y 2 ) = 0 (x^2+y^2+z^2+R^2-a^2)^2-4R^2(x^2+y^2)=0 (x2+y2+z2+R2−a2)2−4R2(x2+y2)=0 在这里插入图片描述

#include #include #include #include #include #include #include int main(int argc, char* argv[]){ const std::function f = [&](const Eigen::RowVector3d & x)->double { double R = 4, a = 1; return pow( pow(x[0],2) + pow(x[1],2) + pow(x[2],2) + pow(R,2) - pow(a,2), 2) - 4*pow(R,2) * (pow(x[0],2) + pow(x[1],2)); }; Eigen::RowVector3d p0(3,4,0); std::cout


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有