CGAL 6.0 - 3D Isosurfacing
Loading...
Searching...
No Matches
CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy > Class Template Reference

#include <CGAL/Isosurfacing_3/Cartesian_grid_3.h>

Definition

template<typename GeomTraits, typename MemoryPolicy = Do_not_cache_positions>
class CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >

The class Cartesian_grid_3 represents a 3D Cartesian grid, that is the partition of an iso-cuboid into identical iso-cuboidal cells.

Is model of
IsosurfacingPartition_3

The class Cartesian_grid_3 is one of the possible space partitioning data structures that can be used along with value and gradient fields to make up a domain.

Template Parameters
GeomTraitsmust be a model of IsosurfacingTraits_3.
MemoryPolicywhether the geometric positions of the grid vertices are stored or not. Possible values are CGAL::Isosurfacing::Cache_positions and CGAL::Isosurfacing::Do_not_cache_positions.
See also
CGAL::Isosurfacing::Marching_cubes_domain_3()
CGAL::Isosurfacing::Dual_contouring_domain_3()
Examples
Isosurfacing_3/contouring_discrete_data.cpp, Isosurfacing_3/contouring_implicit_data.cpp, Isosurfacing_3/contouring_inrimage.cpp, Isosurfacing_3/contouring_mesh_offset.cpp, Isosurfacing_3/contouring_vtk_image.cpp, Isosurfacing_3/dual_contouring.cpp, and Isosurfacing_3/marching_cubes.cpp.

Public Types

using Geom_traits = GeomTraits
 
using FT = typename Geom_traits::FT
 
using Point_3 = typename Geom_traits::Point_3
 
using Vector_3 = typename Geom_traits::Vector_3
 
using Iso_cuboid_3 = typename Geom_traits::Iso_cuboid_3
 
using Positioner = internal::Cartesian_grid_position< GeomTraits, MemoryPolicy >
 

Public Member Functions

 Cartesian_grid_3 ()
 Default constructor.
 
 Cartesian_grid_3 (const Iso_cuboid_3 &span, const std::array< std::size_t, 3 > &dimensions, const Geom_traits &gt=Geom_traits())
 creates a Cartesian grid with dimensions[0]*dimensions[1]*dimensions[2] grid vertices.
 
 Cartesian_grid_3 (const Point_3 &p, const Point_3 &q, const std::array< std::size_t, 3 > &dimensions, const Geom_traits &gt=Geom_traits())
 creates a Cartesian grid with dimensions[0]*dimensions[1]*dimensions[2] grid vertices.
 
 Cartesian_grid_3 (const Iso_cuboid_3 &span, const Vector_3 &spacing, const Geom_traits &gt=Geom_traits())
 creates a Cartesian grid using a prescribed grid step spacing.
 
 Cartesian_grid_3 (const Point_3 &p, const Point_3 &q, const Vector_3 &spacing, const Geom_traits &gt=Geom_traits())
 creates a Cartesian grid using a prescribed grid step.
 
const Geom_traitsgeom_traits () const
 returns the geometric traits class.
 
const Iso_cuboid_3span () const
 returns an iso-cuboid representing the geometric span of the Cartesian grid.
 
std::size_t xdim () const
 returns the number of grid vertices in the x direction.
 
std::size_t ydim () const
 returns the number of grid vertices in the y direction.
 
std::size_t zdim () const
 returns the number of grid vertices in the z direction.
 
const Vector_3spacing () const
 returns the spacing of the Cartesian grid, that is a vector whose coordinates are the grid steps in the x, y, and z directions, respectively.
 
std::size_t linear_index (const std::size_t i, const std::size_t j, const std::size_t k) const
 returns the index of a grid cell given its indices (i.e., (k * y_dim + j) * x_dim + i).
 
std::array< std::size_t, 3 > index (const Point_3 &p) const
 returns the coordinates of the grid cell that contains a given point.
 
decltype(auto) point (const std::size_t i, const std::size_t j, const std::size_t k) const
 returns the geometric position of the grid vertex described by its three indices.
 

Constructor & Destructor Documentation

◆ Cartesian_grid_3() [1/4]

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::Cartesian_grid_3 ( const Iso_cuboid_3 span,
const std::array< std::size_t, 3 > &  dimensions,
const Geom_traits gt = Geom_traits() 
)

creates a Cartesian grid with dimensions[0]*dimensions[1]*dimensions[2] grid vertices.

The grid covers the space described by the iso-cuboid span.

Parameters
spanthe geometric span of the grid
dimensionsthe number of grid vertices in the x, y, and z directions
gtthe geometric traits
Precondition
all dimensions are (strictly) positive.

◆ Cartesian_grid_3() [2/4]

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::Cartesian_grid_3 ( const Point_3 p,
const Point_3 q,
const std::array< std::size_t, 3 > &  dimensions,
const Geom_traits gt = Geom_traits() 
)

creates a Cartesian grid with dimensions[0]*dimensions[1]*dimensions[2] grid vertices.

The grid covers the space described by the iso-cuboid span, itself described through two diagonal corners p and q.

Parameters
pthe lexicographically smallest corner of the iso-cuboid
qthe lexicographically largest corner of the iso-cuboid
dimensionsthe number of grid vertices in the x, y, and z directions
gtthe geometric traits
Precondition
p is lexicographically (strictly) smaller than q
all dimensions are (strictly) positive.

◆ Cartesian_grid_3() [3/4]

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::Cartesian_grid_3 ( const Iso_cuboid_3 span,
const Vector_3 spacing,
const Geom_traits gt = Geom_traits() 
)

creates a Cartesian grid using a prescribed grid step spacing.

The grid covers the space described by the iso-cuboid span.

Parameters
spanthe geometric span of the grid
spacingthe dimension of the paving cell, in the x, y, and z directions
gtthe geometric traits
Precondition
the diagonal of span has length a multiple of spacing

◆ Cartesian_grid_3() [4/4]

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::Cartesian_grid_3 ( const Point_3 p,
const Point_3 q,
const Vector_3 spacing,
const Geom_traits gt = Geom_traits() 
)

creates a Cartesian grid using a prescribed grid step.

The grid covers the space described by an iso-cuboid, itself described through two diagonal corners.

Parameters
pthe lexicographically smallest corner of the iso-cuboid
qthe lexicographically largest corner of the iso-cuboid
spacingthe dimension of the paving cell, in the x, y, and z directions, respectively.
gtthe geometric traits
Precondition
p is lexicographically (strictly) smaller than q
the diagonal of the iso-cuboid has length a multiple of spacing

Member Function Documentation

◆ index()

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
std::array< std::size_t, 3 > CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::index ( const Point_3 p) const

returns the coordinates of the grid cell that contains a given point.

Parameters
pthe point to be located
Precondition
p is inside the grid.

◆ point()

template<typename GeomTraits , typename MemoryPolicy = Do_not_cache_positions>
decltype(auto) CGAL::Isosurfacing::Cartesian_grid_3< GeomTraits, MemoryPolicy >::point ( const std::size_t  i,
const std::size_t  j,
const std::size_t  k 
) const

returns the geometric position of the grid vertex described by its three indices.

Depending on the value of the template parameter cache_points, positions might not be stored but calculated on-the-fly.

Parameters
ithe index in the x direction
jthe index in the y direction
kthe index in the z direction
Precondition
i < xdim() and j < ydim() and k < zdim()
Returns
a const reference or a newly constructed point, depending on the caching policy.