12 changed files with 785 additions and 328 deletions
@ -0,0 +1,22 @@ |
|||||
|
cmake_minimum_required(VERSION 3.16) |
||||
|
project(example4_curve_surface_intersection) |
||||
|
|
||||
|
# C++ 11 is required |
||||
|
set(CMAKE_CXX_STANDARD 11) |
||||
|
|
||||
|
# list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) |
||||
|
|
||||
|
# Libigl |
||||
|
include(libigl) |
||||
|
|
||||
|
# Enable the target igl::glfw |
||||
|
igl_include(glfw) |
||||
|
|
||||
|
|
||||
|
# add include directories |
||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) |
||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/3rdparty) |
||||
|
|
||||
|
add_executable(${PROJECT_NAME} main.cpp) |
||||
|
|
||||
|
target_link_libraries(${PROJECT_NAME} NurbsIntersection::nurbsintersect) |
@ -0,0 +1,131 @@ |
|||||
|
/*
|
||||
|
* @File Created: 2022-11-26, 16:52:29 |
||||
|
* @Last Modified: 2022-11-26, 18:51:06 |
||||
|
* @Author: forty-twoo |
||||
|
* @Copyright (c) 2022, Caiyue Li(li_caiyue@zju.edu.cn), All rights reserved. |
||||
|
*/ |
||||
|
|
||||
|
#include <igl/opengl/glfw/Viewer.h> |
||||
|
#include <tinynurbs/tinynurbs.h> |
||||
|
#include "bvh.hpp" |
||||
|
#include "show_libigl.hpp" |
||||
|
#include "intersection.hpp" |
||||
|
#include "newton.hpp" |
||||
|
|
||||
|
igl::opengl::glfw::Viewer viewer; |
||||
|
|
||||
|
int main(int argc, char* argv[]) |
||||
|
{ |
||||
|
|
||||
|
viewer.data().point_size = 5; |
||||
|
|
||||
|
tinynurbs::RationalCurve<double> crv; // Planar curve using float32
|
||||
|
crv.control_points = { glm::vec3(-4, 0, 0), // std::vector of 3D points
|
||||
|
glm::vec3(-1, -1.2, -0.5), |
||||
|
glm::vec3(2, 2.3, 1), |
||||
|
glm::vec3(-3, -1.8, -2), |
||||
|
|
||||
|
}; |
||||
|
crv.degree = 2; |
||||
|
crv.knots = { 0, 0, 0, 1, 2, 2, 2 }; // std::vector of floats
|
||||
|
crv.weights = { 1, 1, 1, 1 }; |
||||
|
|
||||
|
|
||||
|
tinynurbs::RationalSurface<double> srf; |
||||
|
srf.degree_u = 3; |
||||
|
srf.degree_v = 3; |
||||
|
srf.knots_u = { 0, 0, 0, 0, 1, 1, 1, 1 }; |
||||
|
srf.knots_v = { 0, 0, 0, 0, 1, 1, 1, 1 }; |
||||
|
|
||||
|
srf.control_points = { 4, 4, { |
||||
|
glm::vec3(2, -2, -2), glm::vec3(-2.5, -2.2, -1.5), glm::vec3(-2, -2, -0.5), glm::vec3(-2, -2, 1.5), |
||||
|
glm::vec3(2, -1, -2), glm::vec3(-2.5, -1.2, -1.5), glm::vec3(-2, -1, -0.5), glm::vec3(-2, -1, 1.5), |
||||
|
glm::vec3(3, 1.2, -2), glm::vec3(-2.5, 1.2, -1.5), glm::vec3(-2, 1.5, -0.5), glm::vec3(-2, 1.5, 1.5), |
||||
|
glm::vec3(2, 2, -2), glm::vec3(-2.5, 2, -1.5), glm::vec3(-2, 2.5, -0.5), glm::vec3(-2, 2, 1.5) |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
srf.weights = { 4, 4, |
||||
|
{ |
||||
|
1, 1, 1, 1, |
||||
|
1, 1, 1, 1, |
||||
|
1, 1, 1, 1, |
||||
|
1, 1, 1, 1, |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
BVH_AABB bvh_curve(10, 2, 100, crv); |
||||
|
BVH_AABB bvh_surface(6, 4, 100, srf); |
||||
|
ShowCurve_Igl(crv, 500, YELLOW); |
||||
|
ShowSurface_Igl(srf, 10, 10, BLUE); |
||||
|
|
||||
|
|
||||
|
|
||||
|
double tstep = *(crv.knots.end() - 1); |
||||
|
bvh_curve.Build_NurbsCurve(crv, bvh_curve.bvh_aabb_node, 0, 0, tstep); |
||||
|
|
||||
|
double ustep = *(srf.knots_u.end() - 1); |
||||
|
double vstep = *(srf.knots_v.end() - 1); |
||||
|
bvh_surface.Build_NurbsSurface(srf, bvh_surface.bvh_aabb_node, 0, 0, 0, ustep, vstep); |
||||
|
|
||||
|
//ShowBVHNode_Igl(bvh_curve.bvh_aabb_node, RED);
|
||||
|
//ShowBVHNode_Igl(bvh_surface.bvh_aabb_node, GREEN);
|
||||
|
|
||||
|
|
||||
|
std::vector<std::pair<BVH_AABB_NodePtr, BVH_AABB_NodePtr>> IstNodePtr; |
||||
|
if(BVHIntersect(bvh_curve.bvh_aabb_node, bvh_surface.bvh_aabb_node, IstNodePtr)) |
||||
|
{ |
||||
|
if(IstNodePtr.size() != 0) |
||||
|
std::cout << "Curve and Surface intersect!\n"; |
||||
|
else |
||||
|
std::cout << "Curve and Surface not intersect!\n"; |
||||
|
int idx = 0; |
||||
|
std::vector<glm::vec3> ansPoints; |
||||
|
|
||||
|
for(auto it : IstNodePtr) |
||||
|
{ |
||||
|
ShowAABB_Igl(it.first->bound, RED); |
||||
|
ShowAABB_Igl(it.second->bound, GREEN); |
||||
|
|
||||
|
std::cout << "The " << idx++ << "th boxes pair lie on\n" |
||||
|
<< " min_point (" |
||||
|
<< it.first->bound.Bmin.x << ", " << it.first->bound.Bmin.y << ", " << it.first->bound.Bmin.z << ") , max_point (" << it.first->bound.Bmax.x << ", " << it.first->bound.Bmax.y << ", " << it.first->bound.Bmax.z << ")\n"; |
||||
|
std::cout << " min_point (" |
||||
|
<< it.second->bound.Bmin.x << ", " << it.second->bound.Bmin.y << ", " << it.second->bound.Bmin.z << ") , max_point (" << it.second->bound.Bmax.x << ", " << it.second->bound.Bmax.y << ", " << it.second->bound.Bmax.z << ")\n"; |
||||
|
|
||||
|
|
||||
|
auto itsPoint = newton_curve_surface(it.first, it.second, 1e-12, true); |
||||
|
ansPoints.push_back(itsPoint); |
||||
|
std::cout << "\n\n\n"; |
||||
|
//std::cout << "(" << itsPoint.x << "," << itsPoint.y << "," << itsPoint.z << ")" << std::endl;
|
||||
|
//去重
|
||||
|
//else
|
||||
|
//{
|
||||
|
// //相距太近则判作同一个点
|
||||
|
// glm::dvec3 delt = itsPoint - ansPoints[ansPoints.size() - 1];
|
||||
|
// double dis = std::sqrt(delt.x * delt.x + delt.y * delt.y + delt.z * delt.z);
|
||||
|
// ansPoints.push_back(itsPoint);
|
||||
|
|
||||
|
// //if(dis > 1e-5)
|
||||
|
// //{
|
||||
|
// // std::cout << "distance between last and now: ";
|
||||
|
// // std::cout << std::setprecision(10) << dis << "\n";
|
||||
|
// //}
|
||||
|
|
||||
|
//}
|
||||
|
|
||||
|
} |
||||
|
for(auto it : ansPoints) |
||||
|
{ |
||||
|
viewer.data().add_points(Eigen::RowVector3d(it.x, it.y, it.z), BLACK); |
||||
|
std::cout << "(" << it.x << "," << it.y << "," << it.z << ")" << std::endl; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
viewer.launch(); |
||||
|
return 0; |
||||
|
|
||||
|
|
||||
|
} |
@ -1,95 +1,107 @@ |
|||||
#include "bvh.hpp" |
#include "bvh.hpp" |
||||
|
|
||||
AABB BVH_AABB::UnionBound(const AABB &a, const AABB &b) |
AABB BVH_AABB::UnionBound(const AABB& a, const AABB& b) |
||||
{ |
{ |
||||
AABB ret; |
AABB ret; |
||||
ret.Bmin = glm::vec3(fmin(a.Bmin.x, b.Bmin.x), |
ret.Bmin = glm::vec3(fmin(a.Bmin.x, b.Bmin.x), |
||||
fmin(a.Bmin.y, b.Bmin.y), |
fmin(a.Bmin.y, b.Bmin.y), |
||||
fmin(a.Bmin.z, b.Bmin.z)); |
fmin(a.Bmin.z, b.Bmin.z)); |
||||
|
|
||||
ret.Bmax = glm::vec3(fmax(a.Bmax.x, b.Bmax.x), |
ret.Bmax = glm::vec3(fmax(a.Bmax.x, b.Bmax.x), |
||||
fmax(a.Bmax.y, b.Bmax.y), |
fmax(a.Bmax.y, b.Bmax.y), |
||||
fmax(a.Bmax.z, b.Bmax.z)); |
fmax(a.Bmax.z, b.Bmax.z)); |
||||
return ret; |
return ret; |
||||
} |
} |
||||
|
|
||||
AABB BVH_AABB::UpdateBound(const AABB &bound, const glm::vec3 &p) |
AABB BVH_AABB::UpdateBound(const AABB& bound, const glm::vec3& p) |
||||
{ |
{ |
||||
AABB ret; |
AABB ret; |
||||
ret.Bmin = glm::vec3(fmin(bound.Bmin.x, p.x), |
ret.Bmin = glm::vec3(fmin(bound.Bmin.x, p.x), |
||||
fmin(bound.Bmin.y, p.y), |
fmin(bound.Bmin.y, p.y), |
||||
fmin(bound.Bmin.z, p.z)); |
fmin(bound.Bmin.z, p.z)); |
||||
|
|
||||
ret.Bmax = glm::vec3(fmax(bound.Bmax.x, p.x), |
ret.Bmax = glm::vec3(fmax(bound.Bmax.x, p.x), |
||||
fmax(bound.Bmax.y, p.y), |
fmax(bound.Bmax.y, p.y), |
||||
fmax(bound.Bmax.z, p.z)); |
fmax(bound.Bmax.z, p.z)); |
||||
return ret; |
return ret; |
||||
} |
} |
||||
|
|
||||
BVH_AABB_NodePtr BVH_AABB::Build_NurbsCurve(tinynurbs::RationalCurve<double> &curve, BVH_AABB_NodePtr &curNode, int curLevel, double t, double tstep) |
BVH_AABB_NodePtr BVH_AABB::Build_NurbsCurve(tinynurbs::RationalCurve<double>& curve, BVH_AABB_NodePtr& curNode, int curLevel, double t, double tstep) |
||||
{ |
{ |
||||
curNode->myBVH = this; |
curNode->myBVH = this; |
||||
if (curLevel + 1 == Hlevel) |
if(curLevel + 1 == Hlevel) |
||||
{ |
{ |
||||
for (double i = t; i < t + tstep; i += tstep / sampleNum) |
for(double i = t; i < t + tstep; i += tstep / sampleNum) |
||||
{ |
{ |
||||
curNode->bound = UpdateBound(curNode->bound, tinynurbs::curvePoint(curve, i)); |
curNode->bound = UpdateBound(curNode->bound, tinynurbs::curvePoint(curve, i)); |
||||
} |
} |
||||
curNode->childPtr.clear(); |
curNode->childPtr.clear(); |
||||
curNode->param.push_back(std::make_pair(t, t + tstep)); |
curNode->param.push_back(std::make_pair(t, t + tstep)); |
||||
|
|
||||
return curNode; |
return curNode; |
||||
} |
} |
||||
BVH_AABB_NodePtr childNode1 = new BVH_AABB_Node; |
BVH_AABB_NodePtr childNode1 = new BVH_AABB_Node; |
||||
BVH_AABB_NodePtr childNode2 = new BVH_AABB_Node; |
BVH_AABB_NodePtr childNode2 = new BVH_AABB_Node; |
||||
|
|
||||
double tstep_ = tstep / (double)BranchNum; |
double tstep_ = tstep / (double)BranchNum; |
||||
Build_NurbsCurve(curve, childNode1, curLevel + 1, t, tstep_); |
Build_NurbsCurve(curve, childNode1, curLevel + 1, t, tstep_); |
||||
Build_NurbsCurve(curve, childNode2, curLevel + 1, t + tstep_, tstep_); |
Build_NurbsCurve(curve, childNode2, curLevel + 1, t + tstep_, tstep_); |
||||
|
|
||||
curNode->bound = UnionBound(curNode->bound, childNode1->bound); |
curNode->bound = UnionBound(curNode->bound, childNode1->bound); |
||||
curNode->bound = UnionBound(curNode->bound, childNode2->bound); |
curNode->bound = UnionBound(curNode->bound, childNode2->bound); |
||||
|
|
||||
curNode->childPtr.push_back(childNode1); |
curNode->childPtr.push_back(childNode1); |
||||
curNode->childPtr.push_back(childNode2); |
curNode->childPtr.push_back(childNode2); |
||||
|
|
||||
curNode->param.push_back(std::make_pair(t, t + tstep)); |
curNode->param.push_back(std::make_pair(t, t + tstep)); |
||||
|
|
||||
return curNode; |
return curNode; |
||||
} |
} |
||||
BVH_AABB_NodePtr BVH_AABB::Build_NurbsSurface(tinynurbs::RationalSurface<double> &surface, BVH_AABB_NodePtr &curNode, int curLevel, double u, double v, double ustep, double vstep) |
BVH_AABB_NodePtr BVH_AABB::Build_NurbsSurface(tinynurbs::RationalSurface<double>& surface, BVH_AABB_NodePtr& curNode, int curLevel, double u, double v, double ustep, double vstep) |
||||
{ |
{ |
||||
curNode->myBVH = this; |
curNode->myBVH = this; |
||||
if (curLevel == Hlevel) |
if(curLevel + 1 == Hlevel) |
||||
{ |
{ |
||||
for (double i = u; i < u + ustep; i++) |
for(double i = u; i < u + ustep; i += ustep / sampleNum) |
||||
{ |
{ |
||||
for (double j = v; j < v + vstep; j++) |
for(double j = v; j < v + vstep; j += vstep / sampleNum) |
||||
{ |
{ |
||||
curNode->bound = UpdateBound(curNode->bound, tinynurbs::surfacePoint(surface, i, j)); |
curNode->bound = UpdateBound(curNode->bound, tinynurbs::surfacePoint(surface, i, j)); |
||||
} |
} |
||||
} |
} |
||||
curNode->childPtr.clear(); |
curNode->childPtr.clear(); |
||||
curNode->param.push_back(std::make_pair(u, u + ustep)); |
//std::cout << curNode->bound.Bmin.x << "," << curNode->bound.Bmin.y << "," << curNode->bound.Bmin.z << "\n";
|
||||
curNode->param.push_back(std::make_pair(v, v + vstep)); |
curNode->param.push_back(std::make_pair(u, u + ustep)); |
||||
|
curNode->param.push_back(std::make_pair(v, v + vstep)); |
||||
return curNode; |
|
||||
} |
return curNode; |
||||
BVH_AABB_NodePtr childNode1 = new BVH_AABB_Node; |
} |
||||
BVH_AABB_NodePtr childNode2 = new BVH_AABB_Node; |
BVH_AABB_NodePtr childNode1 = new BVH_AABB_Node; |
||||
BVH_AABB_NodePtr childNode3 = new BVH_AABB_Node; |
BVH_AABB_NodePtr childNode2 = new BVH_AABB_Node; |
||||
BVH_AABB_NodePtr childNode4 = new BVH_AABB_Node; |
BVH_AABB_NodePtr childNode3 = new BVH_AABB_Node; |
||||
|
BVH_AABB_NodePtr childNode4 = new BVH_AABB_Node; |
||||
double ustep_ = ustep / (double)BranchNum; |
|
||||
double vstep_ = vstep / (double)BranchNum; |
double ustep_ = ustep / (double)2; |
||||
|
double vstep_ = vstep / (double)2; |
||||
Build_NurbsSurface(surface, childNode1, curLevel + 1, u, v, ustep_, vstep_); |
|
||||
Build_NurbsSurface(surface, childNode2, curLevel + 1, u + ustep_, v, ustep_, vstep_); |
Build_NurbsSurface(surface, childNode1, curLevel + 1, u, v, ustep_, vstep_); |
||||
Build_NurbsSurface(surface, childNode3, curLevel + 1, u, v + vstep_, ustep_, vstep_); |
Build_NurbsSurface(surface, childNode2, curLevel + 1, u + ustep_, v, ustep_, vstep_); |
||||
Build_NurbsSurface(surface, childNode4, curLevel + 1, u + ustep_, v + vstep_, ustep_, vstep_); |
Build_NurbsSurface(surface, childNode3, curLevel + 1, u, v + vstep_, ustep_, vstep_); |
||||
|
Build_NurbsSurface(surface, childNode4, curLevel + 1, u + ustep_, v + vstep_, ustep_, vstep_); |
||||
curNode->param.push_back(std::make_pair(u, u + ustep)); |
|
||||
curNode->param.push_back(std::make_pair(v, v + vstep)); |
curNode->bound = UnionBound(curNode->bound, childNode1->bound); |
||||
|
curNode->bound = UnionBound(curNode->bound, childNode2->bound); |
||||
return curNode; |
curNode->bound = UnionBound(curNode->bound, childNode3->bound); |
||||
|
curNode->bound = UnionBound(curNode->bound, childNode4->bound); |
||||
|
|
||||
|
curNode->childPtr.push_back(childNode1); |
||||
|
curNode->childPtr.push_back(childNode2); |
||||
|
curNode->childPtr.push_back(childNode3); |
||||
|
curNode->childPtr.push_back(childNode4); |
||||
|
|
||||
|
curNode->param.push_back(std::make_pair(u, u + ustep)); |
||||
|
curNode->param.push_back(std::make_pair(v, v + vstep)); |
||||
|
|
||||
|
//std::cout << curNode->bound.Bmin.x << "," << curNode->bound.Bmin.y << "," << curNode->bound.Bmin.z << "\n";
|
||||
|
return curNode; |
||||
} |
} |
@ -1,84 +1,108 @@ |
|||||
#include "bvh.hpp" |
#include "bvh.hpp" |
||||
#include "show_libigl.hpp" |
#include "show_libigl.hpp" |
||||
|
|
||||
void ShowCurve_Igl(tinynurbs::RationalCurve<double> &curve, double sampleNum, Eigen::RowVector3d color) |
void ShowCurve_Igl(tinynurbs::RationalCurve<double>& curve, double sampleNum, Eigen::RowVector3d color) |
||||
{ |
{ |
||||
double T = *(curve.knots.end() - 1); |
double T = *(curve.knots.end() - 1); |
||||
|
|
||||
for (double i = 0; i < T; i += T / sampleNum) |
for(double i = 0; i < T; i += T / sampleNum) |
||||
{ |
{ |
||||
auto point = tinynurbs::curvePoint(curve, i); |
auto point = tinynurbs::curvePoint(curve, i); |
||||
Eigen::RowVector3d pt; |
Eigen::RowVector3d pt; |
||||
pt << point.x, point.y, point.z; |
pt << point.x, point.y, point.z; |
||||
viewer.data().add_points(pt, color); |
viewer.data().add_points(pt, color); |
||||
} |
} |
||||
} |
} |
||||
void ShowSurface_Igl(tinynurbs::RationalSurface<double> &surface, double sampleNumU, double sampleNumV, Eigen::RowVector3d color) |
void ShowSurface_Igl(tinynurbs::RationalSurface<double>& surface, double sampleNumU, double sampleNumV, Eigen::RowVector3d color) |
||||
{ |
{ |
||||
double U = *(surface.knots_u.end() - 1); |
double U = *(surface.knots_u.end() - 1); |
||||
double V = *(surface.knots_v.end() - 1); |
double V = *(surface.knots_v.end() - 1); |
||||
|
|
||||
for (double u = 0; u <= U; u += U / sampleNumU) |
/*
|
||||
{ |
for(double u = 0; u <= U; u += U / sampleNumU) |
||||
for (double v = 0; v <= V; v += V / sampleNumV) |
{ |
||||
{ |
for(double v = 0; v <= V; v += V / sampleNumV) |
||||
auto point = tinynurbs::surfacePoint(surface, u, v); |
{ |
||||
Eigen::RowVector3d pt; |
auto point = tinynurbs::surfacePoint(surface, u, v); |
||||
pt << point.x, point.y, point.z; |
Eigen::RowVector3d pt; |
||||
viewer.data().add_points(pt, color); |
pt << point.x, point.y, point.z; |
||||
} |
viewer.data().add_points(pt, color); |
||||
} |
} |
||||
|
} |
||||
|
*/ |
||||
|
for(double u = 0; u <= U; u += U / 50) |
||||
|
{ |
||||
|
for(double v = 0; v <= V; v += V / 100) |
||||
|
{ |
||||
|
auto point = tinynurbs::surfacePoint(surface, u, v); |
||||
|
Eigen::RowVector3d pt; |
||||
|
pt << point.x, point.y, point.z; |
||||
|
viewer.data().add_points(pt, color); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
for(double v = 0; v <= V; v += V / 50) |
||||
|
{ |
||||
|
for(double u = 0; u <= U; u += U / 100) |
||||
|
{ |
||||
|
auto point = tinynurbs::surfacePoint(surface, u, v); |
||||
|
Eigen::RowVector3d pt; |
||||
|
pt << point.x, point.y, point.z; |
||||
|
viewer.data().add_points(pt, color); |
||||
|
} |
||||
|
} |
||||
|
//viewer.data().point_size = 3;
|
||||
} |
} |
||||
|
|
||||
void ShowAABB_Igl(AABB bound, Eigen::RowVector3d color) |
void ShowAABB_Igl(AABB bound, Eigen::RowVector3d color) |
||||
{ |
{ |
||||
|
|
||||
Eigen::Vector3d m; |
Eigen::Vector3d m; |
||||
m << bound.Bmin.x, bound.Bmin.y, bound.Bmin.z; |
m << bound.Bmin.x, bound.Bmin.y, bound.Bmin.z; |
||||
Eigen::Vector3d M; |
Eigen::Vector3d M; |
||||
M << bound.Bmax.x, bound.Bmax.y, bound.Bmax.z; |
M << bound.Bmax.x, bound.Bmax.y, bound.Bmax.z; |
||||
|
|
||||
Eigen::MatrixXd V_box(8, 3); |
Eigen::MatrixXd V_box(8, 3); |
||||
V_box << m(0), m(1), m(2), |
V_box << m(0), m(1), m(2), |
||||
M(0), m(1), m(2), |
M(0), m(1), m(2), |
||||
M(0), M(1), m(2), |
M(0), M(1), m(2), |
||||
m(0), M(1), m(2), |
m(0), M(1), m(2), |
||||
m(0), m(1), M(2), |
m(0), m(1), M(2), |
||||
M(0), m(1), M(2), |
M(0), m(1), M(2), |
||||
M(0), M(1), M(2), |
M(0), M(1), M(2), |
||||
m(0), M(1), M(2); |
m(0), M(1), M(2); |
||||
|
|
||||
Eigen::MatrixXi E_box(12, 2); |
Eigen::MatrixXi E_box(12, 2); |
||||
E_box << 0, 1, |
E_box << 0, 1, |
||||
1, 2, |
1, 2, |
||||
2, 3, |
2, 3, |
||||
3, 0, |
3, 0, |
||||
4, 5, |
4, 5, |
||||
5, 6, |
5, 6, |
||||
6, 7, |
6, 7, |
||||
7, 4, |
7, 4, |
||||
0, 4, |
0, 4, |
||||
1, 5, |
1, 5, |
||||
2, 6, |
2, 6, |
||||
7, 3; |
7, 3; |
||||
|
|
||||
for (unsigned i = 0; i < E_box.rows(); ++i) |
for(unsigned i = 0; i < E_box.rows(); ++i) |
||||
viewer.data().add_edges( |
viewer.data().add_edges( |
||||
V_box.row(E_box(i, 0)), |
V_box.row(E_box(i, 0)), |
||||
V_box.row(E_box(i, 1)), |
V_box.row(E_box(i, 1)), |
||||
color); |
color); |
||||
return; |
return; |
||||
} |
} |
||||
|
|
||||
void ShowBVHNode_Igl(BVH_AABB_NodePtr bvhNode, Eigen::RowVector3d color) |
void ShowBVHNode_Igl(BVH_AABB_NodePtr bvhNode, Eigen::RowVector3d color) |
||||
{ |
{ |
||||
if (bvhNode == NULL) |
if(bvhNode == NULL) |
||||
return; |
return; |
||||
|
|
||||
ShowAABB_Igl(bvhNode->bound, color); |
ShowAABB_Igl(bvhNode->bound, color); |
||||
|
|
||||
for (auto it : bvhNode->childPtr) |
for(auto it : bvhNode->childPtr) |
||||
{ |
{ |
||||
ShowBVHNode_Igl(it, color); |
ShowBVHNode_Igl(it, color); |
||||
} |
} |
||||
} |
} |
||||
|
Loading…
Reference in new issue