Browse Source

modify some files

main
forty-twoo 2 years ago
parent
commit
2eb7ea88ac
  1. 19
      README.md
  2. 4
      include/bvh.hpp
  3. 4
      include/mathdef.hpp
  4. 1
      include/newton.hpp
  5. 18
      src/main.cpp
  6. 5
      src/newton.cpp

19
README.md

@ -1 +1,18 @@
Nurbs curve surface intersection calculation
Nurbs curve surface intersection check.
## Dependencies
**STL**, **Libigl**, **Eigen**, **Ginac** and the dependencies of the **igl::opengl::glfw::Viewer (OpenGL, glad and GLFW)**. The CMake build system will automatically download libigl and its dependencies using CMake FetchContent, thus requiring no setup on your part. **As for Ginac, you need to download it by yourself before the cmake build.**
## Compile
```
mkdir build
cd build
cmake ..
make
```
## Run
```
./NurbsIntersection
```

4
include/bvh.hpp

@ -43,10 +43,10 @@ public:
{
return bvh_aabb_node;
};
BVH_AABB_NodePtr Build_NurbsCurve(tinynurbs::RationalCurve<double> &curve, BVH_AABB_NodePtr &curNode, int curLevel, double t, double tstep);
BVH_AABB_NodePtr Build_NurbsSurface(tinynurbs::RationalSurface<double> &surface, BVH_AABB_NodePtr &curNode, int curLevel, double u, double v, double ustep, double vstep);
AABB UnionBound(const AABB &a, const AABB &b);
AABB UpdateBound(const AABB &bound, const glm::vec3 &p);
BVH_AABB_NodePtr Build_NurbsCurve(tinynurbs::RationalCurve<double> &curve, BVH_AABB_NodePtr &curNode, int curLevel, double t, double tstep);
BVH_AABB_NodePtr Build_NurbsSurface(tinynurbs::RationalSurface<double> &surface, BVH_AABB_NodePtr &curNode, int curLevel, double u, double v, double ustep, double vstep);
};
#endif // !BVH_H_

4
include/mathdef.hpp

@ -0,0 +1,4 @@
#ifndef MATHDEF_H_
#define MATHDEF_H_
#endif

1
include/newton.hpp

@ -1 +0,0 @@
#include <ginac/ginac.h>

18
src/main.cpp

@ -9,7 +9,6 @@ int main(int argc, char *argv[])
viewer.data().point_size = 5;
/*
tinynurbs::RationalCurve<double> crv; // Planar curve using float32
crv.control_points = {glm::vec3(-3, 0, 0), // std::vector of 3D points
glm::vec3(-2, 2, 3),
@ -21,11 +20,12 @@ int main(int argc, char *argv[])
crv.weights = {1, 1, 1, 1, 1};
ShowCurve_Igl(viewer, crv, 100);
BVH_AABB bvh_curve(5, 2, 100);
BVH_AABB bvh_curve(8, 2, 100);
double tstep = *(crv.knots.end() - 1);
bvh_curve.Build_NurbsCurve(crv, bvh_curve.bvh_aabb_node, 0, 0, tstep);
ShowBVHNode(viewer, bvh_curve.bvh_aabb_node);
*/
/*
tinynurbs::RationalCurve<double> crv; // Planar curve using float32
crv.control_points = {glm::vec3(-3, -3, -3), // std::vector of 3D points
glm::vec3(-2, -2, -2),
@ -35,12 +35,24 @@ int main(int argc, char *argv[])
crv.knots = {0, 0, 0, 1, 2, 3, 3, 3}; // std::vector of floats
crv.degree = 2;
crv.weights = {1, 1, 1, 1, 1};
*/
/*
ShowCurve_Igl(viewer, crv, 100);
BVH_AABB bvh_curve(5, 2, 100);
double tstep = *(crv.knots.end() - 1);
bvh_curve.Build_NurbsCurve(crv, bvh_curve.bvh_aabb_node, 0, 0, tstep);
ShowBVHNode(viewer, bvh_curve.bvh_aabb_node);
*/
/*
double u = 0.5;
std::vector<double> basis = tinynurbs::bsplineBasis(crv.degree, tinynurbs::findSpan(crv.degree, crv.knots, u), crv.knots, u);
for (auto it : basis)
{
std::cout << it << std::endl;
}
*/
viewer.launch();
}

5
src/newton.cpp

@ -1,8 +1,7 @@
#include "newton.hpp"
#include "mathdef.hpp"
/*
// 默认id参数不用传,表示四个变量四个方程,id=1 or 2 的时候是2x2的方程组, id=3时是6x6的方程组, id=4 (x0,x1,x2... xn-1) 表示的方程组
/*
vector<numeric> newton(const MUL_F &F, const vector<numeric> &init_point, const numeric &eps, bool &isConvergence, int id)
{
vector<symbol> symbols = {get_symbol("u"), get_symbol("v"), get_symbol("s"), get_symbol("t")};

Loading…
Cancel
Save