mirror of https://github.com/CGAL/cgal
Replace iso(-|_)value with isovalue
This commit is contained in:
parent
0336c3315f
commit
67bf9af86a
|
|
@ -72,7 +72,7 @@ struct IWPValue {
|
|||
const FT x = alpha * (point.x() + 1) * M_PI;
|
||||
const FT y = alpha * (point.y() + 1) * M_PI;
|
||||
const FT z = alpha * (point.z() + 1) * M_PI;
|
||||
return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // iso-value = 0
|
||||
return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // isovalue = 0
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -120,12 +120,12 @@ Each algorithm can be called by a single templated function, and the function si
|
|||
|
||||
\code{.cpp}
|
||||
template <typename Concurrency_tag = Sequential_tag, class Domain_, class PointRange, class PolygonRange>
|
||||
void marching_cubes(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points, PolygonRange& polygons);
|
||||
void marching_cubes(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points, PolygonRange& polygons);
|
||||
\endcode
|
||||
|
||||
The input is provided in the form of a `domain` (see \ref secmydomains).
|
||||
|
||||
The `iso_value` scalar parameter denotes the value used for sampling the input scalar field for generating the isosurface.
|
||||
The `isovalue` scalar parameter denotes the value used for sampling the input scalar field for generating the isosurface.
|
||||
|
||||
[why using the term collection below ? how about containers? ]
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ int main() {
|
|||
const FT x = alpha * (point.x() + 1) * CGAL_PI;
|
||||
const FT y = alpha * (point.y() + 1) * CGAL_PI;
|
||||
const FT z = alpha * (point.z() + 1) * CGAL_PI;
|
||||
return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // iso-value = 0
|
||||
return cos(x) * cos(y) + cos(y) * cos(z) + cos(z) * cos(x) - cos(x) * cos(y) * cos(z); // isovalue = 0
|
||||
};
|
||||
|
||||
auto iwp_gradient = [alpha](const Point& point) {
|
||||
|
|
|
|||
|
|
@ -39,26 +39,26 @@ namespace Isosurfacing {
|
|||
* `RandomAccessContainer` and `BackInsertionSequence` whose value type is itself a model of the concepts
|
||||
* `RandomAccessContainer` and `BackInsertionSequence` whose value type is `std::size_t`.
|
||||
*
|
||||
* \tparam Positioning is a functor containing the function `position` that takes `domain`, `iso_value`, `cell`, and `position`
|
||||
* \tparam Positioning is a functor containing the function `position` that takes `domain`, `isovalue`, `cell`, and `position`
|
||||
* as input and returns a boolean that is `true` if the isosurface intersects the cell.
|
||||
*
|
||||
* \param domain the domain providing input data and its topology
|
||||
* \param iso_value value of the isosurface
|
||||
* \param isovalue value of the isosurface
|
||||
* \param points points of the polzgons in the created indexed face set
|
||||
* \param polygons each element in the vector describes a polygon using the indices of the points in `points`
|
||||
* \param positioning the functor dealing with vertex positioning inside a cell
|
||||
*/
|
||||
template <typename Concurrency_tag = Sequential_tag, class Domain_, class PointRange, class PolygonRange,
|
||||
class Positioning = internal::Positioning::QEM_SVD<true>>
|
||||
void dual_contouring(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points,
|
||||
void dual_contouring(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points,
|
||||
PolygonRange& polygons, const Positioning& positioning = Positioning()) {
|
||||
|
||||
// create vertices in each relevant cell
|
||||
internal::Dual_contouring_vertex_positioning<Domain_, Positioning> pos_func(domain, iso_value, positioning);
|
||||
internal::Dual_contouring_vertex_positioning<Domain_, Positioning> pos_func(domain, isovalue, positioning);
|
||||
domain.template iterate_cells<Concurrency_tag>(pos_func);
|
||||
|
||||
// connect vertices around an edge to form a face
|
||||
internal::Dual_contouring_face_generation<Domain_> face_generation(domain, iso_value);
|
||||
internal::Dual_contouring_face_generation<Domain_> face_generation(domain, isovalue);
|
||||
domain.template iterate_edges<Concurrency_tag>(face_generation);
|
||||
|
||||
// copy vertices to point range
|
||||
|
|
|
|||
|
|
@ -54,14 +54,14 @@ public:
|
|||
* \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`.
|
||||
*
|
||||
* \param domain the domain providing input data and its topology
|
||||
* \param iso_value value of the isosurface
|
||||
* \param isovalue value of the isosurface
|
||||
* \param cell the cell within the domain for which the vertex position ins computed
|
||||
* \param point the point position of the vertex that belongs to that cell
|
||||
*
|
||||
* \return true, if the voxel intersects the isosurface
|
||||
*/
|
||||
template <class Domain_>
|
||||
bool position(const Domain_& domain, const typename Domain_::FT iso_value,
|
||||
bool position(const Domain_& domain, const typename Domain_::FT isovalue,
|
||||
const typename Domain_::Cell_descriptor& cell, typename Domain_::Point& point) const {
|
||||
typedef typename Domain_::Point Point;
|
||||
typedef typename Domain_::Geom_traits::Vector_3 Vector;
|
||||
|
|
@ -90,8 +90,8 @@ public:
|
|||
const auto& p0 = domain.position(v0);
|
||||
const auto& p1 = domain.position(v1);
|
||||
|
||||
if ((val0 <= iso_value) != (val1 <= iso_value)) { // this edge is intersected by the isosurface
|
||||
const FT u = (val0 - iso_value) / (val0 - val1);
|
||||
if ((val0 <= isovalue) != (val1 <= isovalue)) { // this edge is intersected by the isosurface
|
||||
const FT u = (val0 - isovalue) / (val0 - val1);
|
||||
const Point p_lerp = CGAL::ORIGIN + ((1 - u) * (p0 - CGAL::ORIGIN) + u * (p1 - CGAL::ORIGIN));
|
||||
edge_intersections.push_back(p_lerp);
|
||||
edge_intersection_normals.push_back(domain.gradient(p_lerp));
|
||||
|
|
@ -164,14 +164,14 @@ public:
|
|||
* \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`.
|
||||
*
|
||||
* \param domain the domain providing input data and its topology
|
||||
* \param iso_value value of the isosurface
|
||||
* \param isovalue value of the isosurface
|
||||
* \param cell the cell within the domain for which the vertex position ins computed
|
||||
* \param point the point position of the vertex that belongs to that cell
|
||||
*
|
||||
* \return true, if the voxel intersects the isosurface
|
||||
*/
|
||||
template <class Domain_>
|
||||
bool position(const Domain_& domain, const typename Domain_::FT iso_value,
|
||||
bool position(const Domain_& domain, const typename Domain_::FT isovalue,
|
||||
const typename Domain_::Cell_descriptor& vh, typename Domain_::Point& point) const {
|
||||
typedef typename Domain_::Point Point;
|
||||
typedef typename Domain_::Geom_traits::Vector_3 Vector;
|
||||
|
|
@ -188,7 +188,7 @@ public:
|
|||
bool allSmaller = true;
|
||||
bool allGreater = true;
|
||||
for (const auto& v : vertices) {
|
||||
const bool& b = domain.value(v) <= iso_value;
|
||||
const bool& b = domain.value(v) <= isovalue;
|
||||
allSmaller = allSmaller && b;
|
||||
allGreater = allGreater && !b;
|
||||
}
|
||||
|
|
@ -218,14 +218,14 @@ public:
|
|||
* \tparam Domain_ must be a model of `IsosurfacingDomainWithGradient`.
|
||||
*
|
||||
* \param domain the domain providing input data and its topology
|
||||
* \param iso_value value of the isosurface
|
||||
* \param isovalue value of the isosurface
|
||||
* \param cell the cell within the domain for which the vertex position ins computed
|
||||
* \param point the point position of the vertex that belongs to that cell
|
||||
*
|
||||
* \return true, if the voxel intersects the isosurface
|
||||
*/
|
||||
template <class Domain_>
|
||||
bool position(const Domain_& domain, const typename Domain_::FT iso_value,
|
||||
bool position(const Domain_& domain, const typename Domain_::FT isovalue,
|
||||
const typename Domain_::Cell_descriptor& cell, typename Domain_::Point& point) const {
|
||||
typedef typename Domain_::Point Point;
|
||||
typedef typename Domain_::Geom_traits::Vector_3 Vector;
|
||||
|
|
@ -247,8 +247,8 @@ public:
|
|||
const auto& p0 = domain.position(v0);
|
||||
const auto& p1 = domain.position(v1);
|
||||
|
||||
if ((val0 <= iso_value) != (val1 <= iso_value)) { // this edge is intersected by the isosurface
|
||||
const FT u = (val0 - iso_value) / (val0 - val1);
|
||||
if ((val0 <= isovalue) != (val1 <= isovalue)) { // this edge is intersected by the isosurface
|
||||
const FT u = (val0 - isovalue) / (val0 - val1);
|
||||
const Point p_lerp = CGAL::ORIGIN + ((1 - u) * (p0 - CGAL::ORIGIN) + u * (p1 - CGAL::ORIGIN));
|
||||
edge_intersections.push_back(p_lerp);
|
||||
}
|
||||
|
|
@ -277,13 +277,13 @@ private:
|
|||
typedef typename Domain::Cell_descriptor Cell_descriptor;
|
||||
|
||||
public:
|
||||
Dual_contouring_vertex_positioning(const Domain& domain, FT iso_value, const Positioning& positioning)
|
||||
: domain(domain), iso_value(iso_value), positioning(positioning), points_counter(0) {}
|
||||
Dual_contouring_vertex_positioning(const Domain& domain, FT isovalue, const Positioning& positioning)
|
||||
: domain(domain), isovalue(isovalue), positioning(positioning), points_counter(0) {}
|
||||
|
||||
void operator()(const Cell_descriptor& v) {
|
||||
// compute dc-vertices
|
||||
Point p;
|
||||
if (positioning.position(domain, iso_value, v, p)) {
|
||||
if (positioning.position(domain, isovalue, v, p)) {
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
map_voxel_to_point[v] = p;
|
||||
|
|
@ -293,7 +293,7 @@ public:
|
|||
|
||||
// private:
|
||||
const Domain& domain;
|
||||
FT iso_value;
|
||||
FT isovalue;
|
||||
const Positioning& positioning;
|
||||
|
||||
std::map<Cell_descriptor, std::size_t> map_voxel_to_point_id;
|
||||
|
|
@ -313,7 +313,7 @@ private:
|
|||
typedef typename Domain_::Cell_descriptor Cell_descriptor;
|
||||
|
||||
public:
|
||||
Dual_contouring_face_generation(const Domain& domain, FT iso_value) : domain(domain), iso_value(iso_value) {}
|
||||
Dual_contouring_face_generation(const Domain& domain, FT isovalue) : domain(domain), isovalue(isovalue) {}
|
||||
|
||||
void operator()(const Edge_descriptor& e) {
|
||||
// save all faces
|
||||
|
|
@ -321,13 +321,13 @@ public:
|
|||
const FT s0 = domain.value(vertices[0]);
|
||||
const FT s1 = domain.value(vertices[1]);
|
||||
|
||||
if (s0 <= iso_value && s1 > iso_value) {
|
||||
if (s0 <= isovalue && s1 > isovalue) {
|
||||
const auto& voxels = domain.cells_incident_to_edge(e);
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
faces[e].insert(faces[e].begin(), voxels.begin(), voxels.end());
|
||||
|
||||
} else if (s1 <= iso_value && s0 > iso_value) {
|
||||
} else if (s1 <= isovalue && s0 > isovalue) {
|
||||
const auto& voxels = domain.cells_incident_to_edge(e);
|
||||
|
||||
std::lock_guard<std::mutex> lock(mutex);
|
||||
|
|
@ -339,7 +339,7 @@ public:
|
|||
std::map<Edge_descriptor, std::vector<Cell_descriptor>> faces;
|
||||
|
||||
const Domain& domain;
|
||||
FT iso_value;
|
||||
FT isovalue;
|
||||
|
||||
std::mutex mutex;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -60,9 +60,9 @@ namespace CGAL {
|
|||
namespace Isosurfacing {
|
||||
namespace internal {
|
||||
|
||||
// Interpolate linearly between two vertex positions v0, v1 with values d0 and d1 according to the iso_value
|
||||
// Interpolate linearly between two vertex positions v0, v1 with values d0 and d1 according to the isovalue
|
||||
template <class Point_3, typename FT>
|
||||
Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, const FT d1, const FT iso_value) {
|
||||
Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0, const FT d1, const FT isovalue) {
|
||||
|
||||
FT mu;
|
||||
|
||||
|
|
@ -70,7 +70,7 @@ Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0,
|
|||
if (abs(d1 - d0) < 0.000001) {
|
||||
mu = 0.5; // if both points have the same value, assume isolevel is in the middle
|
||||
} else {
|
||||
mu = (iso_value - d0) / (d1 - d0);
|
||||
mu = (isovalue - d0) / (d1 - d0);
|
||||
}
|
||||
|
||||
assert(mu >= 0.0 || mu <= 1.0);
|
||||
|
|
@ -82,7 +82,7 @@ Point_3 vertex_interpolation(const Point_3& p0, const Point_3& p1, const FT d0,
|
|||
// Retrieve the corner vertices and their values of a cell and return the lookup index
|
||||
template <class Domain_, typename Corners_, typename Values_>
|
||||
std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell_descriptor& cell,
|
||||
const typename Domain_::FT iso_value, Corners_& corners, Values_& values) {
|
||||
const typename Domain_::FT isovalue, Corners_& corners, Values_& values) {
|
||||
|
||||
typedef typename Domain_::Vertex_descriptor Vertex_descriptor;
|
||||
|
||||
|
|
@ -94,7 +94,7 @@ std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell
|
|||
corners[v_id] = domain.position(v);
|
||||
values[v_id] = domain.value(v);
|
||||
|
||||
if (values[v_id] >= iso_value) {
|
||||
if (values[v_id] >= isovalue) {
|
||||
index.set(v_id);
|
||||
}
|
||||
// next cell vertex
|
||||
|
|
@ -106,7 +106,7 @@ std::size_t get_cell_corners(const Domain_& domain, const typename Domain_::Cell
|
|||
|
||||
// Create the vertices on the edges of one cell
|
||||
template <class CellEdges, typename FT, typename Corners_, typename Values_, typename Vertices_>
|
||||
void mc_construct_vertices(const CellEdges& cell_edges, const FT iso_value, const std::size_t i_case,
|
||||
void mc_construct_vertices(const CellEdges& cell_edges, const FT isovalue, const std::size_t i_case,
|
||||
const Corners_& corners, const Values_& values, Vertices_& vertices) {
|
||||
|
||||
// compute for this case the vertices
|
||||
|
|
@ -123,7 +123,7 @@ void mc_construct_vertices(const CellEdges& cell_edges, const FT iso_value, cons
|
|||
const int v0 = Cube_table::edge_to_vertex[e_id][0];
|
||||
const int v1 = Cube_table::edge_to_vertex[e_id][1];
|
||||
|
||||
vertices[e_id] = vertex_interpolation(corners[v0], corners[v1], values[v0], values[v1], iso_value);
|
||||
vertices[e_id] = vertex_interpolation(corners[v0], corners[v1], values[v0], values[v1], isovalue);
|
||||
}
|
||||
flag <<= 1;
|
||||
e_id++;
|
||||
|
|
@ -181,7 +181,7 @@ private:
|
|||
|
||||
public:
|
||||
// Create a Marching Cubes functor for a domain and iso value
|
||||
Marching_cubes_3(const Domain& domain, const FT iso_value) : domain(domain), iso_value(iso_value) {}
|
||||
Marching_cubes_3(const Domain& domain, const FT isovalue) : domain(domain), isovalue(isovalue) {}
|
||||
|
||||
// Compute one cell
|
||||
void operator()(const Cell_descriptor& cell) {
|
||||
|
|
@ -192,7 +192,7 @@ public:
|
|||
|
||||
FT values[8];
|
||||
Point corners[8];
|
||||
const int i_case = get_cell_corners(domain, cell, iso_value, corners, values);
|
||||
const int i_case = get_cell_corners(domain, cell, isovalue, corners, values);
|
||||
|
||||
const int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1
|
||||
if (i_case == 0 || i_case == all_bits_set) {
|
||||
|
|
@ -200,7 +200,7 @@ public:
|
|||
}
|
||||
|
||||
std::array<Point, 12> vertices;
|
||||
mc_construct_vertices(domain.cell_edges(cell), iso_value, i_case, corners, values, vertices);
|
||||
mc_construct_vertices(domain.cell_edges(cell), isovalue, i_case, corners, values, vertices);
|
||||
|
||||
mc_construct_triangles(i_case, vertices, triangle_list);
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ public:
|
|||
|
||||
private:
|
||||
const Domain& domain;
|
||||
FT iso_value;
|
||||
FT isovalue;
|
||||
|
||||
Triangle_list triangle_list;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -72,14 +72,14 @@ private:
|
|||
typedef unsigned int uint;
|
||||
|
||||
public:
|
||||
TMC_functor(const Domain& domain, const FT iso_value, Point_range& points, Polygon_range& polygons)
|
||||
: domain(domain), iso_value(iso_value), points(points), polygons(polygons) {}
|
||||
TMC_functor(const Domain& domain, const FT isovalue, Point_range& points, Polygon_range& polygons)
|
||||
: domain(domain), isovalue(isovalue), points(points), polygons(polygons) {}
|
||||
|
||||
void operator()(const Cell_descriptor& cell) {
|
||||
|
||||
FT values[8];
|
||||
Point corners[8];
|
||||
const int i_case = get_cell_corners(domain, cell, iso_value, corners, values);
|
||||
const int i_case = get_cell_corners(domain, cell, isovalue, corners, values);
|
||||
|
||||
const int all_bits_set = (1 << (8 + 1)) - 1; // last 8 bits are 1
|
||||
if (Cube_table::intersected_edges[i_case] == 0 || Cube_table::intersected_edges[i_case] == all_bits_set) {
|
||||
|
|
@ -89,12 +89,12 @@ public:
|
|||
// this is the only difference to mc
|
||||
int tcm = (int)Cube_table::t_ambig[i_case];
|
||||
if (tcm == 105) {
|
||||
p_slice(cell, iso_value, values, corners, i_case);
|
||||
p_slice(cell, isovalue, values, corners, i_case);
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<Point, 12> vertices;
|
||||
mc_construct_vertices(domain.cell_edges(cell), iso_value, i_case, corners, values, vertices);
|
||||
mc_construct_vertices(domain.cell_edges(cell), isovalue, i_case, corners, values, vertices);
|
||||
|
||||
// TODO: improve triangle generation
|
||||
// construct triangles
|
||||
|
|
@ -199,7 +199,7 @@ public:
|
|||
|
||||
// compute oriented contours
|
||||
// A countour consists of segment at the faces connecting the intersection of the
|
||||
// iso-surface with the edges. For each edge we store the edge to which the segment
|
||||
// isosurface with the edges. For each edge we store the edge to which the segment
|
||||
// is outgoing and the edge from which the segment in comming. Therefore a contour
|
||||
// cab be reconstructed by connecting the edges in the direccion of the outgoing.
|
||||
// The contour is oriented in such a way, that the positive vertices are outside.
|
||||
|
|
@ -954,7 +954,7 @@ public:
|
|||
|
||||
private:
|
||||
const Domain& domain;
|
||||
FT iso_value;
|
||||
FT isovalue;
|
||||
|
||||
Point_range& points;
|
||||
Polygon_range& polygons;
|
||||
|
|
|
|||
|
|
@ -39,22 +39,22 @@ namespace Isosurfacing {
|
|||
* `RandomAccessContainer` and `BackInsertionSequence` whose value type is `std::size_t`.
|
||||
*
|
||||
* \param domain the domain providing input data and its topology
|
||||
* \param iso_value value of the isosurface
|
||||
* \param isovalue value of the isosurface
|
||||
* \param points points of the triangles in the created indexed face set
|
||||
* \param triangles each element in the vector describes a triangle using the indices of the points in `points`
|
||||
* \param topologically_correct decides whether the topologically correct variant of Marching Cubes should be used
|
||||
*/
|
||||
template <typename Concurrency_tag = Sequential_tag, class Domain_, class PointRange, class TriangleRange>
|
||||
void marching_cubes(const Domain_& domain, const typename Domain_::FT iso_value, PointRange& points,
|
||||
void marching_cubes(const Domain_& domain, const typename Domain_::FT isovalue, PointRange& points,
|
||||
TriangleRange& triangles, bool topologically_correct = true) {
|
||||
|
||||
if (topologically_correct) {
|
||||
// run TMC and directly write the result to points and triangles
|
||||
internal::TMC_functor<Domain_, PointRange, TriangleRange> functor(domain, iso_value, points, triangles);
|
||||
internal::TMC_functor<Domain_, PointRange, TriangleRange> functor(domain, isovalue, points, triangles);
|
||||
domain.template iterate_cells<Concurrency_tag>(functor);
|
||||
} else {
|
||||
// run MC
|
||||
internal::Marching_cubes_3<Domain_> functor(domain, iso_value);
|
||||
internal::Marching_cubes_3<Domain_> functor(domain, isovalue);
|
||||
domain.template iterate_cells<Concurrency_tag>(functor);
|
||||
// copy the result to points and triangles
|
||||
internal::to_indexed_face_set(functor.triangles(), points, triangles);
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ struct Sphere_function {
|
|||
};
|
||||
|
||||
template <class Domain_>
|
||||
void run(const Domain_& domain, const FT iso_value, Point_range& points, Polygon_range& polygons) {
|
||||
CGAL::Isosurfacing::marching_cubes<CGAL::Parallel_tag>(domain, iso_value, points, polygons);
|
||||
void run(const Domain_& domain, const FT isovalue, Point_range& points, Polygon_range& polygons) {
|
||||
CGAL::Isosurfacing::marching_cubes<CGAL::Parallel_tag>(domain, isovalue, points, polygons);
|
||||
}
|
||||
|
||||
void test_implicit_sphere() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue