Subject: CGAL users discussion list
List archive
- From: Zohar <>
- To:
- Subject: Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL
- Date: Mon, 17 Mar 2014 11:48:12 -0700 (PDT)
1. Roi pointed out to me that the shared memory idea might not work, since
the AABB tree would do its own allocations that would bypass it.
2. He also pointed out that .mex can be locked or use loadLibrary manually
from matlab to control its load/unload.
3. If the AABB tree doesn't have its own allocations, then instead of shared
memory you could pass a matlab variable to the mex, which can be used as a
persistent memory.
4. Most probably that AABB doesn't have serialization. You'll need to define
it yourself, or to the set of elements it was constructed with, and rebuild
it every time (costly).
5. I can't compile your code since I use cgal 4.2, but consider my full
example below. I'm not sure about emplace, but it sounds like it needs a
copy constructor. For that matter, since I don't think there's a way to just
allocate map elements like a vector, you should use pointers. Why don't you
use vector instead of map? Anyway, consider my example below that uses a
vector of trees and construct a map that points into it.
#include <iostream>
#include <list>
#include <vector>
using namespace std;
#include <CGAL/Simple_cartesian.h>
#include <CGAL/AABB_tree.h>
#include <CGAL/AABB_traits.h>
#include <CGAL/AABB_triangle_primitive.h>
typedef CGAL::Simple_cartesian<double> K;
typedef K::FT FT;
typedef K::Ray_3 Ray;
typedef K::Line_3 Line;
typedef K::Point_3 Point;
typedef K::Triangle_3 Triangle;
typedef std::list<Triangle>::iterator Iterator;
typedef CGAL::AABB_triangle_primitive<K,Iterator> Primitive;
typedef CGAL::AABB_traits<K, Primitive> AABB_triangle_traits;
typedef CGAL::AABB_tree<AABB_triangle_traits> Tree;
int main()
{
Point a(1.0, 0.0, 0.0);
Point b(0.0, 1.0, 0.0);
Point c(0.0, 0.0, 1.0);
Point d(0.0, 0.0, 0.0);
std::list<Triangle> triangles;
triangles.push_back(Triangle(a,b,c));
triangles.push_back(Triangle(a,b,d));
triangles.push_back(Triangle(a,d,c));
// constructs AABB tree
Tree tree(triangles.begin(),triangles.end());
// map
vector<Tree> vT(3);
vT[0].rebuild(triangles.begin(),triangles.end());
map<int,Tree*> mT;
mT.insert(make_pair(1, &vT[0]));
return EXIT_SUCCESS;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/can-t-create-stl-containers-of-type-AABB-tree-in-CGAL-tp4658973p4658983.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, dontcarebear, 03/17/2014
- Re: [cgal-discuss] can't create stl containers of type AABB tree in CGAL, Zohar, 03/17/2014
Archive powered by MHonArc 2.6.18.