以此文来纪念我本科的图形学生涯
Visual studio(确认可以运行c++,例如输出“hello world”)
CGAL配置
(感谢我zc师姐,本教程来自于我师姐,永远爱师姐捏)
安装顺序:
Boost
CGAL
CGAL下载
下载最新版CGAL zip文件 (https://github.com/CGAL/cgal/releases)
下载红框内的两个文件,解压后得到两个文件夹,如图所示直接拖拽auxiliary到CGAL-5.4文件夹中,覆盖掉auxiliary
打开“项目-属性”,按照图示填写好路径
新建cpp文件,拷贝代码,运行后得到对话框,验证配置成功
#include <CGAL/IO/io.h>
#include <CGAL/Algebraic_structure_traits.h>
#include <CGAL/number_utils.h>
#include <CGAL/int.h>
template< typename NT > NT unit_part(const NT& x);
template< typename NT >
NT unit_part_(const NT& x, CGAL::Field_tag);
template< typename NT >
NT unit_part_(const NT& x, CGAL::Integral_domain_without_division_tag);
template< typename NT >
NT unit_part(const NT& x) {
// the unit part of 0 is defined as 1.
if (x == 0) return NT(1);
typedef CGAL::Algebraic_structure_traits<NT> AST;
typedef typename AST::Algebraic_category Algebraic_category;
return unit_part_(x, Algebraic_category());
}
template< typename NT >
NT unit_part_(const NT& x, CGAL::Integral_domain_without_division_tag) {
// For many other types the only units are just -1 and +1.
return NT(int(CGAL::sign(x)));
}
template< typename NT >
NT unit_part_(const NT& x, CGAL::Field_tag) {
// For Fields every x != 0 is a unit.
// Therefore, every x != 0 is its own unit part.
return x;
}
int main() {
// Function call for a model of EuclideanRing, i.e. int.
std::cout << "int: unit_part(-3 ): " << unit_part(-3) << std::endl;
// Function call for a model of FieldWithSqrt, i.e. double
std::cout << "double: unit_part(-3.0): " << unit_part(-3.0) << std::endl;
return 0;
}
// Note that this is just an example
// This implementation for unit part won't work for some types, e.g.,
// types that are not RealEmbeddable or types representing structures that have
// more units than just -1 and +1. (e.g. MP_Float representing Z[1/2])
// From there Algebraic_structure_traits provides the functor Unit_part.
EIGEN配置
下载链接:
https://eigen.tuxfamily.org/index.php?title=Main_Page
Eigen不需要构建任何东西来安装。 只需将 eigen 添加到vs项目的包含路径并包含相关的标头(具体见"最后的配置结果")。
LIBGIL
下载链接:https://github.com/libigl/libigl/r在这里插入图片描述
eleases/tag/v2.4.0
Libigl 是一个只有头文件的库。 不需要构建任何东西来安装。 只需将 libigl/include 添加到vs项目的包含路径并包含相关的标头(具体见"最后的配置结果")。
最后的配置结果