envire::Map<3>::Extents MapSegment::getExtents() const { // combine the extents of the children of this map Eigen::AlignedBox<double, 3> extents; for( std::vector<Part>::const_iterator it = parts.begin(); it != parts.end(); it++ ) { const envire::CartesianMap *map = it->map.get(); const Map<2>* map2 = dynamic_cast<const Map<2>*>( map ); const Map<3>* map3 = dynamic_cast<const Map<3>*>( map ); assert( this->isAttached() ); assert( map->isAttached() ); Eigen::Affine3d g2m = map->getFrameNode()->relativeTransform( this->getFrameNode() ); // currently this assumes that child grids are not rotated // TODO handle rotated child grids here if( map3 ) { extents.extend( map3->getExtents().translate( g2m.translation() ) ); } else if( map2 ) { Eigen::AlignedBox<double, 3> e3; e3.min().head<2>() = map2->getExtents().min(); e3.max().head<2>() = map2->getExtents().max(); extents.extend( e3.translate( g2m.translation() ) ); } } return extents; }
Eigen::AlignedBox<double, 2> MLSMap::getExtents() const { // combine the extents of the children of this map Eigen::AlignedBox<double, 2> extents; std::list<const Layer*> children = env->getChildren( this ); for( std::list<const Layer*>::const_iterator it = children.begin(); it != children.end(); it++ ) { const envire::MLSGrid *grid = dynamic_cast<const envire::MLSGrid*>( *it ); // currently this assumes that child grids are not rotated // TODO handle rotated child grids here Eigen::Affine3d g2m = grid->getFrameNode()->relativeTransform( this->getFrameNode() ); extents.extend( grid->getExtents().translate( g2m.translation().head<2>() ) ); } return extents; }
void igl::copyleft::offset_surface( const Eigen::MatrixBase<DerivedV> & V, const Eigen::MatrixBase<DerivedF> & F, const isolevelType isolevel, const typename Derivedside::Scalar s, const SignedDistanceType & signed_distance_type, Eigen::PlainObjectBase<DerivedSV> & SV, Eigen::PlainObjectBase<DerivedSF> & SF, Eigen::PlainObjectBase<DerivedGV> & GV, Eigen::PlainObjectBase<Derivedside> & side, Eigen::PlainObjectBase<DerivedS> & S) { typedef typename DerivedV::Scalar Scalar; typedef typename DerivedF::Scalar Index; { Eigen::AlignedBox<Scalar,3> box; typedef Eigen::Matrix<Scalar,1,3> RowVector3S; assert(V.cols() == 3 && "V must contain positions in 3D"); RowVector3S min_ext = V.colwise().minCoeff().array() - isolevel; RowVector3S max_ext = V.colwise().maxCoeff().array() + isolevel; box.extend(min_ext.transpose()); box.extend(max_ext.transpose()); igl::voxel_grid(box,s,1,GV,side); } const Scalar h = (GV.col(0).maxCoeff()-GV.col(0).minCoeff())/((Scalar)(side(0)-1)); const Scalar lower_bound = isolevel-sqrt(3.0)*h; const Scalar upper_bound = isolevel+sqrt(3.0)*h; { Eigen::Matrix<Index,Eigen::Dynamic,1> I; Eigen::Matrix<typename DerivedV::Scalar,Eigen::Dynamic,3> C,N; igl::signed_distance( GV,V,F,signed_distance_type,lower_bound,upper_bound,S,I,C,N); } igl::flood_fill(side,S); DerivedS SS = S.array()-isolevel; igl::copyleft::marching_cubes(SS,GV,side(0),side(1),side(2),SV,SF); }