diff --git a/.gitattributes b/.gitattributes index 9f401098a08..6faf6fc3de8 100644 --- a/.gitattributes +++ b/.gitattributes @@ -213,6 +213,27 @@ Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha_shapes_3_large.png -text Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha_shapes_3_small.png -text Alpha_shapes_3/doc_tex/Alpha_shapes_3/alphashape.gif -text svneol=unset#image/gif Alpha_shapes_3/doc_tex/Alpha_shapes_3/alphashape.pdf -text svneol=unset#application/pdf +Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.pdf -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.png -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3/gen-reg-ex.png -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeCellBase_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeTraits_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeVertexBase_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedWeightedAlphaShapeTraits_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_cell_base_3.tex -text +Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_vertex_base_3.tex -text +Alpha_shapes_3/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp -text +Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_3.h -text +Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_cell_base_3.h -text +Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_vertex_base_3.h -text +Alpha_shapes_3/include/CGAL/internal/Classification_type.h -text +Alpha_shapes_3/test/Alpha_shapes_3/Filtered_weighted_alpha_shape_euclidean_traits_3.h -text +Alpha_shapes_3/test/Alpha_shapes_3/copy_tds.h -text +Alpha_shapes_3/test/Alpha_shapes_3/data/small-exp.in -text +Alpha_shapes_3/test/Alpha_shapes_3/data/small.in -text +Alpha_shapes_3/test/Alpha_shapes_3/test_fixed_alpha_shape_3.cmd -text +Alpha_shapes_3/test/Alpha_shapes_3/test_fixed_alpha_shape_3.cpp -text Apollonius_graph_2/doc_tex/Apollonius_graph_2/apollonius-both_vertices.gif -text svneol=unset#image/gif Apollonius_graph_2/doc_tex/Apollonius_graph_2/apollonius-both_vertices_bw.png -text svneol=unset#image/png Apollonius_graph_2/doc_tex/Apollonius_graph_2/apollonius-entire_edge.gif -text svneol=unset#image/gif diff --git a/.gitignore b/.gitignore index fda3d047681..75ec4d41438 100644 --- a/.gitignore +++ b/.gitignore @@ -41,6 +41,11 @@ Alpha_shapes_3/demo/Alpha_shapes_3/*.vcproj Alpha_shapes_3/demo/Alpha_shapes_3/Makefile Alpha_shapes_3/demo/Alpha_shapes_3/alpha_shapes_3 Alpha_shapes_3/demo/Alpha_shapes_3/weighted_alpha_shapes_3 +Alpha_shapes_3/test/Alpha_shapes_3/CMakeLists.txt +Alpha_shapes_3/test/Alpha_shapes_3/cgal_test_with_cmake +Alpha_shapes_3/test/Alpha_shapes_3/test_alpha_shape_3 +Alpha_shapes_3/test/Alpha_shapes_3/test_fixed_alpha_shape_3 +Alpha_shapes_3/test/Alpha_shapes_3/test_weighted_alpha_shape_3 Apollonius_graph_2/demo/Apollonius_graph_2/*.exe Apollonius_graph_2/demo/Apollonius_graph_2/*.vcproj Apollonius_graph_2/demo/Apollonius_graph_2/Makefile diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex index 96e1ec184de..ed6b9ca031f 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/PkgDescription.tex @@ -1,11 +1,18 @@ \begin{ccPkgDescription}{3D Alpha Shapes\label{Pkg:AlphaShapes3}} \ccPkgHowToCiteCgal{cgal:dy-as3-10} -\ccPkgSummary{This package offers a data structure encoding the whole family of alpha-complexes -related to a given 3D Delaunay or regular triangulation. In particular, the data structure +\ccPkgSummary{ +This package offers a data structure encoding +either one alpha-complex or +the whole family of alpha-complexes +related to a given 3D Delaunay or regular triangulation. +% In particular, +In the latter case, +the data structure allows to retrieve the alpha-complex for any alpha value, the whole spectrum of critical alpha values and a filtration on the triangulation faces (this filtration is based on the first -alpha value for which each face is included on the alpha-complex).} +alpha value for which each face is included on the alpha-complex). +} \ccPkgDependsOn{\ccRef[2D Triangulation]{Pkg:Triangulation3}} \ccPkgIntroducedInCGAL{2.3} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex index a6bb18efd96..401aa06ede9 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/alpha3.tex @@ -72,22 +72,47 @@ The alpha complex is a subcomplex of the Delaunay triangulation. For a given value of $\alpha$, the alpha complex includes all the simplices in the Delaunay triangulation which have -an empty circumsphere with squared radius equal or smaller than $\alpha$. +an empty circumscribing sphere with squared radius equal or smaller than $\alpha$. Here ``empty'' means that the open sphere do not include any points of $S$. The alpha shape is then simply the domain covered by the simplices of the alpha complex (see \cite{em-tdas-94}). -In general, an alpha complex is a non-connected and non-pure complex. +In general, an alpha complex is a disconnected and non-pure complex: This means in particular that the alpha complex may have singular faces. For $0 \leq k \leq d-1$, a $k$-simplex of the alpha complex is said to be -singular if it is not a facet of a $(k+1)$-simplex of the complex -CGAL provides two versions of the alpha shapes. In the general mode, +singular if it is not a facet of a $(k+1)$-simplex of the complex. +CGAL provides two versions of alpha shapes. In the general mode, the alpha shapes correspond strictly to the above definition. -The regularized mode provides a regularized version of the alpha shapes -corresponding to the domain covered by a regularized version -of the alpha complex where singular faces are removed. +The regularized mode provides a regularized version of the alpha shapes. +It corresponds to the domain covered by a regularized version +of the alpha complex where singular faces are removed +(See Figure \ref{fig-gen-reg-ex} for an example). + + +\begin{figure} +\begin{ccTexOnly} +\begin{center} +\includegraphics[width=15cm]{Alpha_shapes_3/gen-reg-ex.png} +\end{center} +\end{ccTexOnly} +\begin{ccHtmlOnly} +
+General vs. regularized alpha-shape +
+\end{ccHtmlOnly} + +\caption{Comparison of general and regularized alpha-shape. +\textbf{Left:} Some points are taken on the surface of a torus, +three points being taken relatively +far from the surface of the torus; +\textbf{Middle:} The general alpha-shape (for a large enough alpha value) +contains the singular triangle facet of the three isolated points; +\textbf{Right:} The regularized version (for the same value of alpha) does not contains any singular facet. +\label{fig-gen-reg-ex}} +\end{figure} + @@ -135,8 +160,8 @@ regular triangulation triangulation such that there is a sphere orthogonal to the weighted points associated with the vertices of the simplex and suborthogonal to all the other input weighted points. Once again the alpha shape is then defined as -the domain covered by a the alpha complex and arise in two versions -general or regularized. +the domain covered by a the alpha complex and comes in general and +regularized versions. @@ -145,6 +170,8 @@ general or regularized. \section{Functionality \label{I1_SectAlpha_Shape_3}} +\subsection{Family of alpha shapes} + The class \ccc{CGAL::Alpha_shape_3
} represents the whole family of alpha shapes for a given set of points. The class includes the underlying triangulation \ccc{Dt} @@ -153,25 +180,10 @@ of the set, and associates to each $k$-face of this triangulation for which values of $\alpha$ the face belongs to the alpha complex. - -The class \ccc{CGAL::Alpha_shape_3
} provides functions to set and +The class provides functions to set and get the current $\alpha$-value, as well as an iterator that enumerates the $\alpha$ values where the alpha shape changes. -The class provides member functions to classify for a given value -of $alpha$ the different faces of the triangulation as -\ccc{EXTERIOR}, \ccc{SINGULAR}, \ccc{REGULAR} or -\ccc{INTERIOR} with respect -to the alpha shape. A $k$ face on the boundary of the alpha complex -is said to be \ccc{REGULAR} if it is a subface of the alpha complex -which is a subface of some $k+1$ face of the alpha complex -and \ccc{SINGULAR} otherwise. - -The class provides also output iterators to get for a given $alpha$ value -the vertices, edges, facets and cells of the different types -(\ccc{EXTERIOR}, \ccc{SINGULAR}, \ccc{REGULAR} or -\ccc{INTERIOR}). - Also the class has a filtration member function that, given an output iterator with \ccc{CGAL::object} as value type, outputs the faces of the triangulation @@ -189,30 +201,84 @@ such that the alpha shape satisfies the following two properties~\\ \smallskip The current implementation is static, that is after its construction points cannot be inserted or removed. + +\subsection{Alpha shape for a fixed alpha} +Given a value of alpha, the class \ccc{CGAL::Fixed_alpha_shape_3
} represents one +alpha shape for a given set of points. +The class includes the underlying triangulation \ccc{Dt} +of the set, and associates to each $k$-face of this triangulation +a classification type. + +\smallskip +The current implementation of this class is dynamic, that is after its construction +points can be inserted or removed. + +\subsection{Classification and iterators} +Both classes provide member functions to classify for a (given) value +of $alpha$ the different faces of the triangulation as +\ccc{EXTERIOR}, \ccc{SINGULAR}, \ccc{REGULAR} or +\ccc{INTERIOR} with respect +to the alpha shape. A $k$-face on the boundary of the alpha complex +is said to be: \ccc{REGULAR} if it is a subface of the alpha-complex which +is a subface of a $(k+1)$-face of the alpha complex, and \ccc{SINGULAR} otherwise. +A $k$-face of the alpha complex which is not on the boundary of the alpha complex +is said to be \ccc{INTERIOR}. See Figure \ref{fig-classif} for a 2D illustration. + + +\begin{figure} +\begin{ccTexOnly} +\begin{center} +\includegraphics[width=15cm]{Alpha_shapes_3/classif} +\end{center} +\end{ccTexOnly} +\begin{ccHtmlOnly} +
+Classification of simplices. +
+\end{ccHtmlOnly} + +\caption{Classification of simplices, a 2D example. +\textbf{Left:} The 2D Delaunay triangulation of a set of points; +\textbf{Right:} Classification of simplices for a given alpha (the squared radius of the red circle). +\ccc{INTERIOR}, \ccc{REGULAR} and \ccc{SINGULAR} simplices are depicted in black, green and blue +respectively. \ccc{EXTERIOR} simplices are not depicted. The vertex \ccc{s} and the edge \ccc{tu} are \ccc{SINGULAR} +since all higher dimension simplices they are incident to are \ccc{EXTERIOR}. +The facet \ccc{pqr} is \ccc{EXTERIOR} because the squared radius of its circumscribed circle is larger +than alpha. +\label{fig-classif}} +\end{figure} + + +The classes provide also output iterators to get for a given $alpha$ value +the vertices, edges, facets and cells of the different types +(\ccc{EXTERIOR}, \ccc{SINGULAR}, \ccc{REGULAR} or +\ccc{INTERIOR}). + + %---------------------------------------------------------------------- \section{Concepts and Models\label{I1_SectDtClass3D}} We currently do not specify concepts for the underlying triangulation -type. Models that work for a basic alpha-shape are the instantiations +type. Models that work for a familly alpha-shapes are the instantiations of the classes \ccc{CGAL::Delaunay_triangulation_3} and \ccc{CGAL::Periodic_3_Delaunay_triangulation_3} (see -example~\ref{l1_SectPeriodicAS3D}). +example~\ref{l1_SectPeriodicAS3D}). A model that works for a fixed alpha-shape are the instantiations +of the class \ccc{CGAL::Delaunay_triangulation_3}. A model that works for a weighted alpha-shape is -the class \ccc{CGAL::Regular_triangulation_3}. +the class \ccc{CGAL::Regular_triangulation_3}. The triangulation needs a geometric traits class +and a triangulation data structure as template parameters. -The triangulation needs a geometric traits class as argument. -The requirements of this class are described in the -concept \ccc{CGAL::AlphaShapeTraits_3} for which -the \cgal\ kernels are models in the non-weighted case, and for which -the class \ccc{CGAL::Regular_triangulation_euclidean_traits_3} is model +For the class \ccc{CGAL::Alpha_shape_3
}, the requirements of +the traits class are described in the concepts \ccc{CGAL::AlphaShapeTraits_3} +in the non-weighted case and \ccc{CGAL::WeightedAlphaShapeTraits_3} in the weighted case. +The \cgal\ kernels are models in the non-weighted case, and +the class \ccc{CGAL::Regular_triangulation_euclidean_traits_3} is a model in the weighted case. - -The triangulation data structure of the triangulation with any -has to be a model of the concept \ccc{CGAL::TriangulationDataStructure_3}. -However it must be parameterized with -vertex and cell classes, which are models of the concepts +The triangulation data structure of the triangulation +has to be a model of the concept \ccc{CGAL::TriangulationDataStructure_3}, +and it must be parameterized with vertex and cell classes, which are model of the concepts \ccc{AlphaShapeVertex_3} and \ccc{AlphaShapeCell_3}. The package provides by default the classes \ccc{CGAL::Alpha_shape_vertex_base_3} and @@ -225,6 +291,51 @@ triangulation the vertex and cell classes need to be models to both (see example~\ref{l1_SectPeriodicAS3D}). + +For the class \ccc{CGAL::Fixed_alpha_shape_3
}, the requirements of +the traits class are described in the concepts \ccc{CGAL::FixedAlphaShapeTraits_3} +in the non-weighted case and \ccc{CGAL::FixedWeightedAlphaShapeTraits_3} in the weighted case. +The \cgal\ kernels are models in the non-weighted case, and +the class \ccc{CGAL::Regular_triangulation_euclidean_traits_3} is a model +in the weighted case. +The triangulation data structure of the triangulation +has to be a model of the concept \ccc{CGAL::TriangulationDataStructure_3}, +and it must be parameterized with vertex and cell classes, which are model of the concepts +\ccc{FixedAlphaShapeVertex_3} and \ccc{FixedAlphaShapeCell_3}. +The package provides models \ccc{CGAL::Fixed_alpha_shape_vertex_base_3} +and \ccc{CGAL::Fixed_alpha_shape_cell_base_3}, respectively. + + + +\section{\ccc{Alpha_shape_3} or \ccc{Fixed_alpha_shape_3}} + +The class \ccc{CGAL::Alpha_shape_3
} represents the whole family +of alpha shapes for a given set of points while the class \ccc{CGAL::Fixed_alpha_shape_3
} +represents only one alpha shape (for a fixed alpha). When using the same kernel, +\ccc{CGAL::Fixed_alpha_shape_3
} being a lighter version, it is naturally much more efficient +when the alpha-shape is needed for a single given value of alpha. +In addition note that the class \ccc{CGAL::Alpha_shape_3
} +requires constructions (squared radius of simplices) while the +class \ccc{CGAL::Fixed_alpha_shape_3
} uses only predicates. +This implies that a certified construction of one (several) +alpha-shape, using the \ccc{CGAL::Alpha_shape_3
} requires a kernel +with exact predicates and exact constructions while using a kernel +with exact predicates is sufficient for the class \ccc{CGAL::Fixed_alpha_shape_3
}. +This makes the class \ccc{CGAL::Fixed_alpha_shape_3
} even more efficient in this setting. +In addition, note that the \ccc{Fixed} version is the only of the +two that supports incremental insertion and removal of points. + +We give the time spent while computing the alpha shape of a protein (considered +as a set of weighted points) featuring 4251 atoms (using \ccc{gcc 4.3} under Linux with \ccc{-O3} +and \ccc{-DNDEBUG} flags, on a 2.27GHz Intel(R) Xeon(R) E5520 CPU): +Using \ccc{CGAL::Exact_predicates_inexact_constructions_kernel}, building +the regular triangulation requires 0.06s, then the class \ccc{CGAL::Fixed_alpha_shape_3
} +required 0.05s while the class \ccc{CGAL::Alpha_shape_3
} requires 0.35s. + + + + + %---------------------------------------------------------------------- \section{Examples} @@ -241,7 +352,7 @@ as underlying triangulation. When many points are input in the alpha shape, say more than 10 000, it may pay off to use a Delaunay triangulation with \ccc{Fast_location} policy as underlying triangulation in order to speed up point location -quesries (cf. \ref{Triangulation3-sec-locpol}). +queries (cf. \ref{Triangulation3-sec-locpol}). \ccIncludeExampleCode{Alpha_shapes_3/ex_alpha_shapes_with_fast_location_3.cpp} %---------------------------------------------------------------------- @@ -255,6 +366,12 @@ The alpha shape is built in \ccc{GENERAL} mode. \ccIncludeExampleCode{Alpha_shapes_3/ex_weighted_alpha_shapes_3.cpp} +\subsection{Example for Fixed Weighted Alpha-Shapes\label{I1_SectFxWeightedAS3D}} + +Same example as previous but using a fixed value of alpha. + +\ccIncludeExampleCode{Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp} + \subsection{Example for periodic Alpha Shapes\label{l1_SectPeriodicAS3D}} @@ -276,4 +393,6 @@ covering space is degenerate. In this case an exact constructions kernel needs to be used to compute the alpha shapes. Otherwise the results will suffer from round-off problems. -\ccIncludeExampleCode{Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp} \ No newline at end of file +\ccIncludeExampleCode{Alpha_shapes_3/ex_periodic_alpha_shapes_3.cpp} + + diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.pdf b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.pdf new file mode 100644 index 00000000000..d5fba871c5f Binary files /dev/null and b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.pdf differ diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.png b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.png new file mode 100644 index 00000000000..c7bc8271bd3 Binary files /dev/null and b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/classif.png differ diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/gen-reg-ex.png b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/gen-reg-ex.png new file mode 100644 index 00000000000..43070c6005f Binary files /dev/null and b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/gen-reg-ex.png differ diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/main.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/main.tex index 6ff81da565d..c7d0f46c274 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3/main.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3/main.tex @@ -5,7 +5,8 @@ \ccUserChapter{3D Alpha Shapes\label{I1_ChapterAlphashapes3D}} -\ccChapterAuthor{Tran Kai Frank Da \and Mariette Yvinec} +\ccChapterAuthor{Tran Kai Frank Da \and +S\'ebastien Loriot \and Mariette Yvinec} \input{Alpha_shapes_3/PkgDescription} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/AlphaShapeTraits_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/AlphaShapeTraits_3.tex index ac4e9e8068b..6faf9019b10 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/AlphaShapeTraits_3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/AlphaShapeTraits_3.tex @@ -74,12 +74,12 @@ provides the following. \ccNestedType{Compute_squared_radius_3} {An object constructor able to compute: \\ the squared radius of the - smallest circumsphere of 4 points \ccc{p0, p1, p2, p3},\\ + smallest circumscribing sphere of 4 points \ccc{p0, p1, p2, p3},\\ the squared radius of the -smallest circumsphere of 3 points \ccc{p0, p1, p2},\\ -the squared radius of the smallest circumsphere +smallest circumscribing sphere of 3 points \ccc{p0, p1, p2},\\ +the squared radius of the smallest circumscribing sphere of 2 points \ccc{p0, p1}, \\ -and also the squared radius of the smallest circumsphere +and also the squared radius of the smallest circumscribing sphere to a single point \ccc{p0} (which is \ccc{NT(0)}).} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_3.tex index c80db7b57f3..6d9fa69da8b 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_3.tex @@ -50,7 +50,7 @@ \ccDefinition The class \ccClassTemplateName\ represents the family of -alpha shapes of points in the 3D space for {\em all} positive +alpha shapes of points in the 3D space for {\em all} real $\alpha$. It maintains an underlying triangulation of the class \ccc{Dt} which represents connectivity and order among its faces. Each @@ -259,7 +259,7 @@ to \ccc{alpha}.} \ccMethod{Classification_type classify(Facet f, const FT& alpha = get_alpha()) const;} -{Classifies the facet \ccc{e} of the underlying triangulation with +{Classifies the facet \ccc{f} of the underlying triangulation with respect to \ccc{alpha}.} \ccMethod{Classification_type @@ -282,7 +282,7 @@ of the underlying triangulation with respect to \ccc{alpha}.} const FT& alpha = get_alpha());} {Write the cells which are of type \ccc{type} for the alpha value \ccc{alpha} to the sequence -pointed to by the output iterator \ccc{it}. Return past the end +pointed to by the output iterator \ccc{it}. Returns past the end of the output sequence.} @@ -293,7 +293,7 @@ template const FT& alpha= get_alpha());} {Write the facets which are of type \ccc{type} for the alpha value \ccc{alpha} to the sequence -pointed to by the output iterator \ccc{it}. Return past the end +pointed to by the output iterator \ccc{it}. Returns past the end of the output sequence.} \ccMethod { @@ -303,17 +303,17 @@ template const FT& alpha = get_alpha());} {Write the edges which are of type \ccc{type} for the alpha value \ccc{alpha} to the sequence -pointed to by the output iterator \ccc{it}. Return past the end +pointed to by the output iterator \ccc{it}. Returns past the end of the output sequence.} \ccMethod { template OutputIterator get_alpha_shape_vertices(OutputIterator it, Classification_type type, - const FT& alphaget_alpha());} + const FT& alpha);} {Write the vertices which are of type \ccc{type} for the alpha value \ccc{alpha} to the sequence -pointed to by the output iterator \ccc{it}. Return past the end +pointed to by the output iterator \ccc{it}. Returns past the end of the output sequence.} \ccMethod { @@ -383,7 +383,7 @@ is an internal format. \ccFunction{Geomview_stream& operator<<(Geomview_stream& W, const Alpha_shape_3
& A);} {Inserts the alpha shape \ccVar\ for the current alpha value into the Geomview stream \ccc{W}. -\ccPrecond The insert operator must be defined for \ccc{Point} and \ccc{Triangle}.} +\ccPrecond The insert operator must be defined for \ccc{GT::Point} and \ccc{GT::Triangle}.} \ccImplementation diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_cell_base_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_cell_base_3.tex index b5eef98e384..2a87e8fa682 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_cell_base_3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_cell_base_3.tex @@ -52,7 +52,7 @@ The class \ccRefName\ is the default model for the concept \ccc{AlphaShapeCell_3}. -The class has to parameters. The traits class \ccc{Traits} +The class has two parameters. The traits class \ccc{Traits} provides the number type for alpha values. The second parameter \ccc{Fb} is a base class instantiated by default with \ccc{CGAL::Triangulation_cell_base_3}. diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_vertex_base_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_vertex_base_3.tex index 45990650bf1..c78e4a88c6e 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_vertex_base_3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Alpha_shape_vertex_base_3.tex @@ -52,7 +52,7 @@ The class \ccRefName\ is the default model for the concept \ccc{AlphaShapeVertex_3}. -The class has to parameters : the traits class \ccc{Traits} +The class has two parameters : the traits class \ccc{Traits} which provides the type for the points or the weighted points. The second parameter \ccc{Vb} is a base class instantiated by default with \ccc{CGAL::Triangulation_vertex_base_3}. diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeCellBase_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeCellBase_3.tex new file mode 100644 index 00000000000..63e3a5f4cc6 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeCellBase_3.tex @@ -0,0 +1,38 @@ +\begin{ccRefConcept}{FixedAlphaShapeCell_3} + +\ccDefinition +This concept describes the requirements for the base cell of a alpha shape with a fixed value alpha. + + +\ccRefines +\ccc{TriangulationCellBase_3}. + + +\ccCreationVariable{f} + +\ccCreation + + +\ccConstructor{Alpha_shape_cell_base_3();}{default constructor.} +\ccGlue +\ccConstructor{Alpha_shape_cell_base_3(const Vertex_handle& v0, const Vertex_handle& v1, const Vertex_handle& v2, const Vertex_handle& v3);}{constructor setting the incident vertices.} +\ccGlue +\ccConstructor{Alpha_shape_cell_base_3(const Vertex_handle& v0, const Vertex_handle& v1, const Vertex_handle& v2, const Vertex_handle& v3, +const Cell_handle& n0, const Cell_handle& n1, const Cell_handle& n2, const Cell_handle& n3);} +{constructor setting the incident vertices and the neighboring cells.} + + + +\ccAccessFunctions +\ccMethod{Classification_type get_classification_type();}{Returns the classification of the cell.} +\ccMethod{Classification_type get_facet_classification_type(int i);}{Returns the classification of the i-th facet of the cell.} + + +\ccModifiers +\ccMethod{void set_classification_type(Classification_type type);} + { Sets classification of the cell.} +\ccMethod{void set_facet_classification_type(int i, Classification_type type);} +{Sets the classification of the i-th facet of the cell.} + + +\end{ccRefConcept} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeTraits_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeTraits_3.tex new file mode 100644 index 00000000000..a2308e58013 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeTraits_3.tex @@ -0,0 +1,62 @@ +%---------------------------------------------------------------------- + +\begin{ccRefConcept} {FixedAlphaShapeTraits_3} + +\ccCreationVariable{t} + +\ccDefinition +The concept \ccRefName\ describes the requirements +for the geometric traits class +of the underlying Delaunay triangulation of a basic alpha shape with a fixed value alpha. + + +\ccRefines +\ccc{DelaunayTriangulationTraits_3} + +In addition to the requirements described in the concept +\ccc{DelaunayTriangulationTraits_3}, +the geometric traits class of a +Delaunay triangulation plugged in a basic alpha shape with fixed alpha value +provides the following. + + +\ccTypes + +\ccNestedType{Comparison_result}{\ccc{CGAL::Comparison_result} or \ccc{Uncertain}} + +\ccNestedType{Compare_squared_radius_3} +{An object constructor able to compare \\ +the squared radius of the smallest circumscribing sphere of +either four, three, two or one point(s) +with a given value of alpha. +It provides:\\ +\ccc{Comparison_result operator()(Point_3,Point_3,Point_3,Point_3)}\\ +\ccc{Comparison_result operator()(Point_3,Point_3,Point_3)}\\ +\ccc{Comparison_result operator()(Point_3,Point_3)}\\ +\ccc{Comparison_result operator()(Point_3)}\\ +} + + +\ccCreation +\ccCreationVariable{traits} +\ccThree{TriangulationTraits_3xxx();}{Triangulation_traits_3 & tr}{} +\ccThreeToTwo + +\ccConstructor{AlphaShapeTraits_3();}{Default constructor.} + + +\ccAccessFunctions +\ccMethod{Compare_squared_radius_3 compare_squared_radius_3_object();} {} + +\ccHasModels +All \ccc{CGAL} kernels.\\ +\ccc{CGAL::Exact_predicates_inexact_constructions_kernel} (recommended)\\ +\ccc{CGAL::Exact_predicates_exact_constructions_kernel}\\ +\ccc{CGAL::Filtered_kernel}\\ +\ccc{CGAL::Cartesian}\\ +\ccc{CGAL::Simple_cartesian}\\ +\ccc{CGAL::Homogeneous}\\ +\ccc{CGAL::Simple_homogeneous} + + +\end{ccRefConcept} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeVertexBase_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeVertexBase_3.tex new file mode 100644 index 00000000000..8f83ef966f5 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedAlphaShapeVertexBase_3.tex @@ -0,0 +1,44 @@ +%---------------------------------------------------------------------- + +\begin{ccRefConcept}{FixedAlphaShapeVertex_3} + +\ccDefinition +This concept describes the requirements for the base vertex of a alpha shape with a fixed value alpha. + + +\ccRefines +\ccc{TriangulationVertexBase_3}. + +\ccCreationVariable{v} + +\ccTypes +\ccNestedType{Point} +{Must be the same as the point type provided by +the geometric traits class of the triangulation.} + +\ccCreation +\ccConstructor{Alpha_shape_vertex_base_3();}{default constructor.} +\ccGlue +\ccConstructor{Alpha_shape_vertex_base_3(Point p);}{constructor setting +the point associated to.} +\ccGlue +\ccConstructor{Alpha_shape_vertex_base_3(Point p, const Cell_handle& c);} +{constructor setting the point associated to and an incident cell.} + + +\ccAccessFunctions +\ccMethod{bool is_on_chull();} +{Returns a boolean indicating whether the point is on the convex hull of the point of the triangulation.} +\ccMethod{Classification_type get_classification_type();} +{Returns the classification of the vertex.} + + +\ccModifiers +\ccMethod{void set_classification_type(Classification_type type);} +{Sets the classification of the vertex.} + +\ccMethod{void is_on_chull(bool b);} +{Sets whether the vertex is on the convex hull.} + + +\end{ccRefConcept} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedWeightedAlphaShapeTraits_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedWeightedAlphaShapeTraits_3.tex new file mode 100644 index 00000000000..938cd66bd2a --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/FixedWeightedAlphaShapeTraits_3.tex @@ -0,0 +1,48 @@ +\begin{ccRefConcept}{FixedWeightedAlphaShapeTraits_3} + +%% \ccHtmlCrossLink{} %% add further rules for cross referencing links +%% \ccHtmlIndexC[concept]{} %% add further index entries + +\ccDefinition + +The concept \ccRefName\ describes the requirements +for the geometric traits class of the underlying regular triangulation of a weighted alpha shape with fixed alpha value. + +\ccRefines +\ccc{RegularTriangulationTraits_3} + +In addition to the requirements described in the concept +\ccc{RegularTriangulationTraits_3}, +the geometric traits class of a +Regular triangulation plugged in a weighted alpha shape with fixed alpha value +provides the following. + +\ccTypes +\ccNestedType{Comparison_result}{\ccc{CGAL::Comparison_result} or \ccc{Uncertain}} + +\ccNestedType{Compare_weighted_squared_radius_3} +{An object constructor able to compare the squared radius of the + smallest sphere orthogonal to either four, three, two or one weighted point(s) + to a given value of alpha. +It provides:\\ +\ccc{Comparison_result operator()(Weighted_point_3 ,Weighted_point_3 ,Weighted_point_3 ,Weighted_point_3 )}\\ +\ccc{Comparison_result operator()(Weighted_point_3 ,Weighted_point_3 ,Weighted_point_3 )}\\ +\ccc{Comparison_result operator()(Weighted_point_3 ,Weighted_point_3 )}\\ +\ccc{Comparison_result operator()(Weighted_point_3 )}\\ +} + +\ccCreation +\ccCreationVariable{wast} %% choose variable name + +\ccConstructor{WeightedAlphaShapeTraits_3();}{default constructor.} + +\ccAccessFunctions +\ccMethod{Compare_weighted_squared_radius_3 compare_weighted_squared_radius_3_object();} {} + + +\ccHasModels + +\ccc{CGAL::Regular_triangulation_euclidean_traits_3}, + +\end{ccRefConcept} + diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_3.tex new file mode 100644 index 00000000000..ddd930f7c88 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_3.tex @@ -0,0 +1,188 @@ +%---------------------------------------------------------------------- + +\begin{ccRefClass} {Fixed_alpha_shape_3
} + +\ccDefinition + +The class \ccClassTemplateName\ represents one (fixed) +alpha shape of points in the 3D space for a real +$\alpha$. It maintains an underlying triangulation +of the class \ccc{Dt} which +represents connectivity and order among its faces. Each +$k$-dimensional face of the \ccc{Dt} is associated with +a classification that specifies its status in the alpha complex, alpha being fixed. + +Note that this class can be used at the same time to build a {\em basic} or +a {\em weighted} Alpha Shape\ccIndexMainItem[C]{Weighted_alpha_shapes_3}. + + +\ccInclude{CGAL/Fixed_alpha_shape_3.h} + +\ccInheritsFrom + +\ccc{Dt} + +This class is the underlying triangulation class. + +The modifying functions \ccc{insert} and \ccc{remove} will overwrite +the inherited functions. + +\ccTypes +\ccSetThreeColumns{Oriented_side}{}{\hspace*{10cm}} +\ccThreeToTwo + +\ccNestedType{Gt}{the alpha shape traits type.} +it has to derive from a triangulation traits class. +For example \ccc{Dt::Point} is a Point class. + +\ccTypedef{typedef Gt::FT FT;}{the number type of alpha.} + +%\ccNestedType{Alpha_shape_vertices_iterator}{A bidirectional and non-mutable iterator that allow to traverse +%the vertices which belongs to the alpha shape for a fixed $\alpha$. +%\ccPrecond Its \ccc{value_type} is \ccc{Dt::Vertex_handle}} + +%\ccNestedType{Alpha_shape_facets_iterator}{A bidirectional and non-mutable iterator that allow to traverse +%the facets which belongs to the alpha shape for a fixed $\alpha$. +%\ccPrecond Its \ccc{value_type} is \ccc{Dt::Facet}} + +\ccEnum{enum Classification_type {EXTERIOR, SINGULAR, REGULAR, INTERIOR};} +{Enum to classify the simplices of the underlying +triangulation with respect to a given alpha value.\\ +Each k-dimensional simplex of the triangulation +can be classified as EXTERIOR, SINGULAR, REGULAR +or INTERIOR. +A $k$ simplex is REGULAR if it is on the boundary +of the alpha complex and belongs to a $k+1$ simplex in this complex +and it is SINGULAR if it is a boundary simplex that is not included in a $k+1$ simplex of the complex. \\ +} + + + + +\ccCreation +\ccCreationVariable{A} + +\ccConstructor{Alpha_shape_3(FT alpha = 0);} +{Introduces an empty alpha shape data structure +\ccVar\ and set the alpha value to \ccc{alpha}.} + +\ccConstructor{ Alpha_shape_3(Dt& dt,FT alpha = 0);} +{Builds an alpha shape from the triangulation \ccc{dt}, +and set the alpha value to \ccc{alpha}. +Be careful that this operation destroys the triangulation.} + +\ccConstructor{template < class InputIterator > + Alpha_shape_3( + InputIterator first, + InputIterator last, + const FT& alpha = 0);} +{Builds an alpha shape data structure +for the points in the range +$\left[\right.$\ccc{first}, \ccc{last}$\left.\right)$ and +set the alpha value to \ccc{alpha}. +\ccRequire The \ccc{value_type} of \ccc{first} and +\ccc{last} is \ccc{Point} (the type point of the underlying +triangulation.)} + + +\ccModifiers + +\ccMethod{Vertex_handle insert (Point p,Cell_handle start = Cell_handle());} +{ +Inserts point p in the underlying triangulation and returns the corresponding vertex. +The optional argument \ccc{start} is used as a starting place for the search. +The classification types of the new simplices are computed and that of the simplices incident +to the new ones are updated. +} + +\ccMethod{void remove (Vertex_handle v);} +{ +Removes the vertex v from the underlying triangulation. +The classification types of new simplices and their incident faces are set or reset +} + +\ccMethod{void + clear();} +{Clears the structure.} + + +\ccHeading{Query Functions} + + +\ccMethod{const FT& + get_alpha(void) const;} +{Returns the $\alpha$-value.} + +\ccMethod{Classification_type + classify(Cell_handle c) const;} +{Classifies the cell \ccc{c} of the underlying triangulation in the alpha complex.} + +\ccMethod{Classification_type classify(Facet f) const;} +{Classifies the facet \ccc{f} of the underlying triangulation in the alpha complex.} + +\ccMethod{Classification_type classify(Cell_handle f, int i) const;} +{Classifies the facet of the cell \ccc{f} opposite to the vertex with index +\ccc{i} of the underlying triangulation in the alpha complex.} + +\ccMethod{Classification_type classify(const Edge& e) const;} +{Classifies the edge \ccc{e} of the underlying triangulation in the alpha complex. } + +\ccMethod{Classification_type classify(Vertex_handle v) const;} +{Classifies the vertex \ccc{v} of the underlying triangulation in the alpha complex.} + + + +\ccMethod {template + OutputIterator get_alpha_shape_cells(OutputIterator it, Classification_type type);} +{Writes the cells which are of type \ccc{type} in the alpha complex +to the sequence +pointed to by the output iterator \ccc{it}. Returns past the end +of the output sequence.} + + +\ccMethod { +template + OutputIterator get_alpha_shape_facets(OutputIterator it, Classification_type type);} +{Writes the facets which are of type \ccc{type} in the alpha complex +to the sequence pointed to by the output iterator \ccc{it}. Returns past the end +of the output sequence.} + +\ccMethod { +template + OutputIterator get_alpha_shape_edges(OutputIterator it, Classification_type type);} +{Writes the edges which are of type \ccc{type} in the alpha complex +to the sequence +pointed to by the output iterator \ccc{it}. Returns past the end +of the output sequence.} + +\ccMethod { + template + OutputIterator get_alpha_shape_vertices(OutputIterator it, Classification_type type);} +{Writes the vertices which are of type \ccc{type} in the alpha complex +to the sequence pointed to by the output iterator \ccc{it}. Returns past the end +of the output sequence.} + +\ccHeading{I/O} + +The I/O operators are defined for \ccc{iostream}, and for +the window stream provided by \cgal. The format for the iostream +is an internal format. + +\ccInclude{CGAL/IO/io.h} + +\ccFunction{ostream& operator<<(ostream& os, + const Alpha_shape_3
& A);} +{Inserts the alpha shape \ccVar\ for the alpha value of \ccc{A} into the stream \ccc{os}. +\ccRequire The insert operator must be defined for \ccc{GT::Point}.} + +\ccInclude{CGAL/IO/Geomview_stream.h} + +\ccInclude{CGAL/IO/alpha_shape_geomview_ostream_3.h} + +\ccFunction{Geomview_stream& operator<<(Geomview_stream& W, + const Alpha_shape_3
& A);} +{Inserts the alpha shape \ccVar\ into the Geomview stream \ccc{W}. +\ccRequire The insert operator must be defined for \ccc{GT::Point} and \ccc{GT::Triangle}.} + +\end{ccRefClass} + diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_cell_base_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_cell_base_3.tex new file mode 100644 index 00000000000..2e4e70d60c6 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_cell_base_3.tex @@ -0,0 +1,26 @@ +%---------------------------------------------------------------------- + +\begin{ccRefClass}{Fixed_alpha_shape_cell_base_3} + +\ccDefinition + +The class \ccRefName\ is the default model for the concept +\ccc{FixedAlphaShapeCell_3}. + +The class has two parameters. The traits class \ccc{Traits} +provides the number type for alpha values. +The second parameter \ccc{Fb} is a base class instantiated by default +with \ccc{CGAL::Triangulation_cell_base_3}. + + +\ccInclude{CGAL/Fixed_alpha_shape_cell_base_3.h} + +\ccIsModel +\ccc{FixedAlphaShapeCellBase_3} + +\ccInheritsFrom + +\ccc{Fb} + + +\end{ccRefClass} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_vertex_base_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_vertex_base_3.tex new file mode 100644 index 00000000000..00c48a8c196 --- /dev/null +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/Fixed_alpha_shape_vertex_base_3.tex @@ -0,0 +1,27 @@ +%---------------------------------------------------------------------- + +\begin{ccRefClass}{Fixed_alpha_shape_vertex_base_3} + +\ccDefinition + +The class \ccRefName\ is the default model for the concept +\ccc{FixedAlphaShapeVertex_3}. + +The class has two parameters : the traits class \ccc{Traits} +which provides the type for the points or the weighted points. +The second parameter \ccc{Vb} is a base class instantiated by default +with \ccc{CGAL::Triangulation_vertex_base_3}. + + +\ccInclude{CGAL/Fixed_alpha_shape_vertex_base_3.h} + + +\ccIsModel +\ccc{FixedAlphaShapeVertexBase_3} + + +\ccInheritsFrom + +\ccc{Vb} + +\end{ccRefClass} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/WeightedAlphaShapeTraits_3.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/WeightedAlphaShapeTraits_3.tex index d4b91e61766..f920f745295 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/WeightedAlphaShapeTraits_3.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/WeightedAlphaShapeTraits_3.tex @@ -43,7 +43,7 @@ and the squared radius of the smallest sphere orthogonal to three weighted points \ccc{p0, p1, p2}, and the squared radius of smallest sphere orthogonal to two weighted points \ccc{p0, p1}, -and the squared radius of the smallest spere orthogonal to a single +and the squared radius of the smallest sphere orthogonal to a single point \ccc{p0}.} \ccCreation diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/intro.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/intro.tex index f56aa6b7b01..d74ff1ea419 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/intro.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/intro.tex @@ -51,7 +51,8 @@ %\section{Reference pages for Alpha Shapes in 3D} \ccRefChapter{3D Alpha Shapes} -\ccChapterAuthor{Tran Kai Frank Da \and Mariette Yvinec} +\ccChapterAuthor{Tran Kai Frank Da \and +S\'ebastien Loriot \and Mariette Yvinec} Alpha shapes definition is based on an underlying triangulation that may be a Delaunay triangulation @@ -65,7 +66,7 @@ The alpha complex is a subcomplex of the Delaunay triangulation. For a given value of $\alpha$, the alpha complex includes all the simplices in the Delaunay triangulation which have -an empty circumsphere with squared radius equal or smaller than $\alpha$. +an empty circumscribing sphere with squared radius equal or smaller than $\alpha$. Here ``empty'' means that the open sphere do not include any points of $S$. The alpha shape is then simply the domain covered by the simplices @@ -76,11 +77,6 @@ This means in particular that the alpha complex may have singular faces. For $0 \leq k \leq d-1$, a $k$-simplex of the alpha complex is said to be singular if it is not a facet of a $(k+1)$-simplex of the complex -CGAL provides two versions of the alpha shapes. In the general mode, -the alpha shapes correspond strictly to the above definition. -The regularized mode provides a regularized version of the alpha shapes -corresponding to the domain covered by a regularized version -of the alpha complex where singular faces are removed. The alpha shapes of a set of points $S$ form a discrete family, even though they @@ -95,7 +91,6 @@ easily. Furthermore, we can select the optimal value of $\alpha$ to get an alpha shape including all data points and having less than a given number of connected components. - The definition is analog in the case of weighted alpha shapes. The input set is now a set of weighted points (which can be regarded as spheres) and the underlying triangulation @@ -110,8 +105,16 @@ regular triangulation triangulation such that there is a sphere orthogonal to the weighted points associated with the vertices of the simplex and suborthogonal to all the other input weighted points. Once again the alpha shape is then defined as -the domain covered by a the alpha complex and arise in two versions -general or regularized. +the domain covered by a the alpha complex. + +CGAL provides two versions to compute alpha shapes. +The first one gives access to an explicit classification of all the simplices for a fixed alpha value. +The second one gives access to the entire family of alpha shapes of a set of points. +This latter version comes with two modes. In the general mode, +the alpha shapes correspond strictly to the definition previously made. +The regularized mode provides a regularized version of the alpha shapes +corresponding to the domain covered by a regularized version +of the alpha complex where singular faces are removed. \section{Classified Reference Pages} @@ -122,6 +125,10 @@ general or regularized. \ccRefConceptPage{WeightedAlphaShapeTraits_3} \\ \ccRefConceptPage{AlphaShapeCell_3}\\ \ccRefConceptPage{AlphaShapeVertex_3}\\ +\ccRefConceptPage{FixedAlphaShapeTraits_3}\\ +\ccRefConceptPage{FixedWeightedAlphaShapeTraits_3} \\ +\ccRefConceptPage{FixedAlphaShapeCell_3}\\ +\ccRefConceptPage{FixedAlphaShapeVertex_3}\\ \subsection*{Classes} @@ -130,3 +137,7 @@ general or regularized. %\ccRefIdfierPage{CGAL::Weighted_alpha_shape_euclidean_traits_3}\\ \ccRefIdfierPage{CGAL::Alpha_shape_vertex_base_3}\\ \ccRefIdfierPage{CGAL::Alpha_shape_cell_base_3} + +\ccRefIdfierPage{CGAL::Fixed_alpha_shape_3
}\\ +\ccRefIdfierPage{CGAL::Fixed_alpha_shape_vertex_base_3}\\ +\ccRefIdfierPage{CGAL::Fixed_alpha_shape_cell_base_3} diff --git a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/main.tex b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/main.tex index bc0e8aa5e81..15ca63e59f3 100644 --- a/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/main.tex +++ b/Alpha_shapes_3/doc_tex/Alpha_shapes_3_ref/main.tex @@ -17,4 +17,12 @@ \input{Alpha_shapes_3_ref/WeightedAlphaShapeTraits_3.tex} \input{Alpha_shapes_3_ref/Weighted_alpha_shape_euclidean_traits_3.tex} +\input{Alpha_shapes_3_ref/FixedAlphaShapeTraits_3.tex} +\input{Alpha_shapes_3_ref/FixedAlphaShapeCellBase_3.tex} +\input{Alpha_shapes_3_ref/FixedAlphaShapeVertexBase_3.tex} +\input{Alpha_shapes_3_ref/Fixed_alpha_shape_3.tex} +\input{Alpha_shapes_3_ref/Fixed_alpha_shape_cell_base_3.tex} +\input{Alpha_shapes_3_ref/Fixed_alpha_shape_vertex_base_3.tex} +\input{Alpha_shapes_3_ref/FixedWeightedAlphaShapeTraits_3.tex} + %% EOF diff --git a/Alpha_shapes_3/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp index e212923c0ee..0712f4f039e 100644 --- a/Alpha_shapes_3/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_alpha_shapes_3.cpp @@ -34,7 +34,7 @@ int main() // compute alpha shape Alpha_shape_3 as(lp.begin(),lp.end()); - std::cout << "Alpha shape computed in REGULARIZED mode by defaut" + std::cout << "Alpha shape computed in REGULARIZED mode by default" << std::endl; // find optimal alpha value diff --git a/Alpha_shapes_3/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp new file mode 100644 index 00000000000..e80c12498f9 --- /dev/null +++ b/Alpha_shapes_3/examples/Alpha_shapes_3/ex_fixed_weighted_alpha_shapes_3.cpp @@ -0,0 +1,57 @@ +#include +#include +#include +#include +#include +#include +#include + +typedef CGAL::Exact_predicates_inexact_constructions_kernel K; + +typedef CGAL::Regular_triangulation_euclidean_traits_3 Gt; + +typedef CGAL::Fixed_alpha_shape_vertex_base_3 Vb; +typedef CGAL::Fixed_alpha_shape_cell_base_3 Fb; +typedef CGAL::Triangulation_data_structure_3 Tds; +typedef CGAL::Regular_triangulation_3 Triangulation_3; +typedef CGAL::Fixed_alpha_shape_3 Fixed_alpha_shape_3; + +typedef Fixed_alpha_shape_3::Cell_handle Cell_handle; +typedef Fixed_alpha_shape_3::Vertex_handle Vertex_handle; +typedef Fixed_alpha_shape_3::Facet Facet; +typedef Fixed_alpha_shape_3::Edge Edge; +typedef Gt::Weighted_point Weighted_point; +typedef Gt::Bare_point Bare_point; + +int main() +{ + std::list lwp; + + //input : a small molecule + lwp.push_back(Weighted_point(Bare_point( 1, -1, -1), 4)); + lwp.push_back(Weighted_point(Bare_point(-1, 1, -1), 4)); + lwp.push_back(Weighted_point(Bare_point(-1, -1, 1), 4)); + lwp.push_back(Weighted_point(Bare_point( 1, 1, 1), 4)); + lwp.push_back(Weighted_point(Bare_point( 2, 2, 2), 1)); + + //build one alpha_shape with alpha=0 + Fixed_alpha_shape_3 as(lwp.begin(), lwp.end(), 0); + + //explore the 0-shape - It is dual to the boundary of the union. + std::list cells; + std::list facets; + std::list edges; + as.get_alpha_shape_cells(std::back_inserter(cells), + Fixed_alpha_shape_3::INTERIOR); + as.get_alpha_shape_facets(std::back_inserter(facets), + Fixed_alpha_shape_3::REGULAR); + as.get_alpha_shape_facets(std::back_inserter(facets), + Fixed_alpha_shape_3::SINGULAR); + as.get_alpha_shape_edges(std::back_inserter(edges), + Fixed_alpha_shape_3::SINGULAR); + std::cout << " The 0-shape has : " << std::endl; + std::cout << cells.size() << " interior tetrahedra" << std::endl; + std::cout << facets.size() << " boundary facets" << std::endl; + std::cout << edges.size() << " singular edges" << std::endl; + return 0; +} diff --git a/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_3.h b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_3.h new file mode 100644 index 00000000000..0461ab84b12 --- /dev/null +++ b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_3.h @@ -0,0 +1,1123 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the so +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_FIXED_ALPHA_SHAPE_3_H +#define CGAL_FIXED_ALPHA_SHAPE_3_H + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#ifdef CGAL_USE_GEOMVIEW +#include // TBC +#endif + +#include + +#include + + +namespace CGAL{ + +namespace internal{ + //small utility to select the correct predicate in the weighted case + template + struct Simplex_classif_predicate; + + template + struct Simplex_classif_predicate{ + static + typename One_alpha::Triangulation::Geom_traits::Compare_squared_radius_3 + predicate(const typename One_alpha::Triangulation& T){ + return T.geom_traits().compare_squared_radius_3_object(); + } + }; + + template + struct Simplex_classif_predicate{ + static + typename One_alpha::Triangulation::Geom_traits::Compare_weighted_squared_radius_3 + predicate(const typename One_alpha::Triangulation& T){ + return T.geom_traits().compare_weighted_squared_radius_3_object(); + } + }; + + //small utility to insert hidden vertices after a removal (in non-weighted case do nothing) + template + struct Hidden_inserter + { + typedef typename One_alpha::Triangulation Dt; + + template + static void insert(One_alpha& one_alpha, Vertex_remover& remover) + { + typename One_alpha::Cell_handle c; + for (typename Vertex_remover::Hidden_points_iterator + hi = remover.hidden_points_begin(); + hi != remover.hidden_points_end(); ++hi) + { + typename One_alpha::Vertex_handle hv = one_alpha.insert (*hi, c); + if (hv != typename One_alpha::Vertex_handle()) c = hv->cell(); + } + } + }; + + template + struct Hidden_inserter{ + typedef typename One_alpha::Triangulation Dt; + template + static void insert(const One_alpha&,const Vertex_remover&){} + }; + + +} //internal + + +template < class Dt > +class Fixed_alpha_shape_3 : public Dt +{ + // DEFINITION The class Fixed_alpha_shape_3
represents the + // alpha-shape for a set of points (or a set of weighted points) + // for a given value of alpha. The alphashape is defined through + // the Delaunay tetrahedralization of the points + // (or the Regular tetrahedralization in case of weighted points) + // and depends on the value of a parameter called alpha. + // The alpha_shape is the domain of a subcomplex of this triangulation + // called the Alpha_complex. The alpha_complex includes any simplex + // having a circumscribing sphere (an orthogonal sphere + // in case of weighted points) empty of other points + // (or suborthogonal to other sites in case of weighted points) + // with squared radius equal or less than alpha + + // In each k-dimensional simplex of the triangulation + // for (k=0,1,2) + // can be classified as EXTERIOR, SINGULAR, REGULAR + // or INTERIOR with respect to the alpha shape. + // A $k$ simplex is REGULAR if it is on the boundary + // of the alpha_complex and belongs to a $k+1$ simplex in the complex + // and it is SINGULAR simplex if it is a boundary simplex tht is not + // included in a $k+1$ simplex of the complex. + + // Roughly, the Fixed_alpha_shape data structure computes and stores, + // for each simplex it classification type. + + + //------------------------- TYPES ------------------------------------ + +public: + typedef Dt Triangulation; + typedef typename Dt::Geom_traits Gt; + typedef typename Dt::Triangulation_data_structure Tds; + + //Classification type: no longer an enum inside the class as Vertex and cell must know it + typedef internal::Classification_type Classification_type; + static const Classification_type EXTERIOR = internal::EXTERIOR; + static const Classification_type REGULAR = internal::REGULAR; + static const Classification_type INTERIOR = internal::INTERIOR; + static const Classification_type SINGULAR = internal::SINGULAR; + + typedef typename Gt::FT Coord_type; + typedef Coord_type NT; + typedef Coord_type FT; + + typedef typename Gt::Point_3 Point; + + typedef typename Dt::Cell_handle Cell_handle; + typedef typename Dt::Vertex_handle Vertex_handle; + typedef typename Dt::Facet Facet; + typedef typename Dt::Edge Edge; + + typedef typename Dt::Cell_circulator Cell_circulator; + typedef typename Dt::Facet_circulator Facet_circulator; + + typedef typename Dt::Cell_iterator Cell_iterator; + typedef typename Dt::Facet_iterator Facet_iterator; + typedef typename Dt::Edge_iterator Edge_iterator; + typedef typename Dt::Vertex_iterator Vertex_iterator; + + typedef typename Dt::Finite_cells_iterator Finite_cells_iterator; + typedef typename Dt::Finite_facets_iterator Finite_facets_iterator; + typedef typename Dt::Finite_edges_iterator Finite_edges_iterator; + typedef typename Dt::Finite_vertices_iterator Finite_vertices_iterator; + + typedef typename Dt::Locate_type Locate_type; + typedef typename Dt::Weighted_tag Weighted_tag; + + using Dt::dimension; + using Dt::finite_facets_begin; + using Dt::finite_facets_end; + using Dt::finite_edges_begin; + using Dt::finite_edges_end; + using Dt::all_edges_begin; + using Dt::all_edges_end; + using Dt::finite_vertices_begin; + using Dt::finite_vertices_end; + using Dt::finite_cells_begin; + using Dt::finite_cells_end; + using Dt::VERTEX; + using Dt::EDGE; + using Dt::FACET; + using Dt::CELL; + using Dt::OUTSIDE_CONVEX_HULL; + using Dt::OUTSIDE_AFFINE_HULL; + using Dt::vertex_triple_index; + using Dt::finite_adjacent_vertices; + using Dt::find_conflicts; + using Dt::is_edge; + using Dt::incident_vertices; + using Dt::incident_facets; + using Dt::is_infinite; + using Dt::is_Gabriel; + using Dt::tds; + + typedef std::pair Vertex_handle_pair; + typedef std::map Edge_status_map; + + //test if a simplex is exterior to the alpha-shape + class Exterior_simplex_test{ + const Fixed_alpha_shape_3 * _as; + public: + Exterior_simplex_test() {} + Exterior_simplex_test(const Fixed_alpha_shape_3 * as) {_as = as;} + bool operator() ( const Finite_cells_iterator& fci) const { + return _as->classify(fci) == EXTERIOR ; + } + bool operator() ( const Finite_vertices_iterator& fvi) const { + return _as->classify(fvi) == EXTERIOR ; + } + bool operator() ( const Finite_facets_iterator& ffi) const { + return _as->classify(*ffi) == EXTERIOR ; + } + bool operator() ( const Finite_edges_iterator& fei) const { + return _as->classify(*fei) == EXTERIOR ; + } + }; + + typedef Filter_iterator< Finite_vertices_iterator, Exterior_simplex_test> Alpha_shape_vertices_iterator; + typedef Filter_iterator< Finite_facets_iterator, Exterior_simplex_test> Alpha_shape_facets_iterator; + typedef Filter_iterator< Finite_edges_iterator, Exterior_simplex_test> Alpha_shape_edges_iterator; + typedef Filter_iterator< Finite_cells_iterator, Exterior_simplex_test> Alpha_shape_cells_iterator; + + + Vertex_handle + insert(const Point& p,Cell_handle start=Cell_handle()) + { + if (this->dimension() < 3){ + Vertex_handle new_v=Triangulation::insert(p,start); + if (this->dimension() == 3) initialize_alpha(); + return new_v; + } + + //Handle only case of dimension 3 of insert_in_conflict from Triangulation_3 class. + typename Triangulation::Locate_type lt; + int li, lj; + Cell_handle c = this->locate(p, lt, li, lj, start); + typename Triangulation::Conflict_tester_3 tester(p, this); + if ((lt == VERTEX) && + (tester.compare_weight(c->vertex(li)->point(), p)==0) ) { + return c->vertex(li); + } + // If the new point is not in conflict with its cell, it is hidden. + if (!tester.test_initial_cell(c)) { + this->hidden_point_visitor.hide_point(c,p); + return Vertex_handle(); + } + + // Ok, we really insert the point now. + // First, find the conflict region. + std::vector cells; + std::vector facets_on_the_boundary_of_the_hole; + + cells.reserve(32); + this->find_conflicts + (c, tester, make_triple(std::back_inserter(facets_on_the_boundary_of_the_hole), + std::back_inserter(cells), + Emptyset_iterator())); + + Facet facet=*boost::prior(facets_on_the_boundary_of_the_hole.end()); + + // Remember the points that are hidden by the conflicting cells, + // as they will be deleted during the insertion. + this->hidden_point_visitor.process_cells_in_conflict(cells.begin(), cells.end()); + + + //Before insertion: + //recover edges on the boundary of the hole. + std::set hole_boundary_edges; + const int indices[3]={1,2,3}; + for (typename std::vector::iterator + it=facets_on_the_boundary_of_the_hole.begin(); + it!=facets_on_the_boundary_of_the_hole.end(); + ++it) + { + Facet f=it->first->tds_data().is_in_conflict()?this->mirror_facet(*it):*it; + CGAL_precondition(!f.first->tds_data().is_in_conflict()); + for (int i=0;i<3;++i){ + Edge edge(f.first,(indices[i]+f.second)%4,(indices[(i+1)%3]+f.second)%4); + if (!this->is_infinite(edge)) + hole_boundary_edges.insert(edge); + } + } + // Erase from edge_status_map, edges that will disappear: + // they are not on the boudary of the hole + std::set hole_edges; + std::pair::iterator,bool> it_hedge_and_not_already_seen; + for (typename std::vector::iterator it=cells.begin();it!=cells.end();++it){ + for (int i=0;i<3;++i) + for (int k=i+1;k<4;++k) + { + Edge edge(*it,i,k); + if (this->is_infinite(edge) || hole_boundary_edges.find(edge)!=hole_boundary_edges.end() ) continue; + it_hedge_and_not_already_seen=hole_edges.insert(edge); + if (!it_hedge_and_not_already_seen.second){ + edge_status_map.erase(make_vertex_handle_pair(*(it_hedge_and_not_already_seen.first))); //for infinite edges it does nothing + } + } + } + + //Insertion using base triangulation + Vertex_handle v = this->_insert_in_hole(p, cells.begin(), cells.end(), + facet.first, facet.second); + + //After insertion + //--set classification of new cells and facets that were on the boundary of the hole + cells.clear(); + this->finite_incident_cells(v,std::back_inserter(cells)); + for (typename std::vector::iterator it=cells.begin();it!=cells.end();++it){ + set_cell_status(*it); //set cell status + set_facet_classification_type( Facet( (*it),(*it)->index(v) ) ); //set facet status (incident to one cell of the hole) + } + //--set classification of new facets + std::vector facets; + this->finite_incident_facets(v,std::back_inserter(facets)); + for (typename std::vector::iterator fit=facets.begin();fit!=facets.end();++fit) + set_facet_classification_type(*fit); + //--init classif of new vertex + v->set_classification_type(SINGULAR); + std::vector edges; + this->finite_incident_edges(v,std::back_inserter(edges)); + //--set status of new edges + update status of new vertex + for (typename std::vector::iterator eit=edges.begin();eit!=edges.end();++eit){ + Classification_type status=compute_edge_status(eit->first, eit->second, eit->third); + Vertex_handle_pair vhp = make_vertex_handle_pair( *eit ); + CGAL_precondition( edge_status_map.find(vhp)==edge_status_map.end() ); + edge_status_map.insert(std::make_pair(vhp, status)); + update_vertex_status(v,status); + } + //--set final status of new vertex + Cell_handle tmp; + int itmp1,itmp2; + v->is_on_chull( this->is_edge(this->infinite_vertex(),v,tmp,itmp1,itmp2) ); + finalize_status_of_vertex(v); + + //--set classification of old edges + for (typename std::set::iterator + eit=hole_boundary_edges.begin();eit!=hole_boundary_edges.end();++eit) + { + CGAL_precondition (!this->is_infinite(*eit)); + Classification_type status=compute_edge_status(eit->first, eit->second, eit->third); + Vertex_handle_pair vhp = make_vertex_handle_pair( *eit ); + typename Edge_status_map::iterator it_status=edge_status_map.find(vhp); + CGAL_precondition(it_status!=edge_status_map.end()); + it_status->second = status; + } + + //--set status of old vertices + update is_on_chull + //TODO: find a better way to do it : make an update + std::vector vertices; + this->finite_adjacent_vertices(v,std::back_inserter(vertices)); + for (typename std::vector::iterator vit=vertices.begin();vit!=vertices.end();++vit){ + if ( (*vit)->is_on_chull() ) + { + (*vit)->is_on_chull( this->is_edge(this->infinite_vertex(),(*vit),tmp,itmp1,itmp2) ); + } + set_vertex_status(*vit); + } + + // Store the hidden points in their new cells. + this->hidden_point_visitor.reinsert_vertices(v); + return v; + } + + void remove (Vertex_handle vertex_to_remove) + { + CGAL_precondition(vertex_to_remove!=Vertex_handle()); + CGAL_precondition(vertex_to_remove!=this->infinite_vertex()); + + std::vector link; + std::vector vertices_to_update; + std::map old_classification; + + if (this->dimension() == 3) + { + //recover facet of the link: they are bounding + //the hole made when removing the vertex + std::vector incident_cells; + this->finite_incident_cells(vertex_to_remove,std::back_inserter(incident_cells)); + for (typename std::vector::iterator it= + incident_cells.begin();it!=incident_cells.end();++it) + { + int index=(*it)->index(vertex_to_remove); + link.push_back( this->mirror_facet(Facet(*it,index)) ); + CGAL_assertion (!this->is_infinite(link.back())); + } + + //get vertices that will need to be updated + this->finite_adjacent_vertices(vertex_to_remove,std::back_inserter(vertices_to_update)); + + //1-erase removed edges from edge_map + //2-store old classification of vertices and set it to SINGULAR + for(typename std::vector::iterator it=vertices_to_update.begin();it!=vertices_to_update.end();++it){ + CGAL_precondition(edge_status_map.find(make_vertex_handle_pair(*it,vertex_to_remove)) != edge_status_map.end()); + edge_status_map.erase(make_vertex_handle_pair(*it,vertex_to_remove)); + old_classification.insert(std::make_pair(*it,(*it)->get_classification_type())); + (*it)->set_classification_type(SINGULAR); + } + } + + //Do remove the vertex from the underlying triangulation + Dt tmp; + typename Dt:: template Vertex_remover
remover(tmp); + typedef CGAL::Triangulation_3 Tr_Base; + Tr_Base::remove(vertex_to_remove,remover); + + if (this->dimension()<3){ + edge_status_map.clear(); + return; + } + + //recover new cells + std::set new_cells;//cells in the hole + std::set outer;//cells that are not in the hole + std::queue to_visit; + for (typename std::vector::iterator it=link.begin();it!=link.end();++it){ + Facet mirror_facet=this->mirror_facet(*it); + if ( !this->is_infinite(mirror_facet.first) ) + { + to_visit.push( mirror_facet.first ); + outer.insert(it->first); + } + } + + while (!to_visit.empty()){ + Cell_handle cell=to_visit.front(); + to_visit.pop(); + if ( !new_cells.insert(cell).second ) continue; //already explored + //explore neighbor cells + for (int i=0;i<4;++i){ + Cell_handle candidate=cell->neighbor(i); + if ( !this->is_infinite(candidate) && outer.find(candidate)==outer.end()) + to_visit.push(candidate); + } + } + + //set status of new cells + for (typename std::set::iterator it=new_cells.begin();it!=new_cells.end();++it){ + CGAL_precondition(!this->is_infinite(*it)); + set_cell_status(*it); + } + + //recover new facets + link facets + //set vertex that are on the convex hull (those on a facet incident to infinite cell) + while (!new_cells.empty()) + { + Cell_handle cell=*new_cells.begin(); + new_cells.erase(new_cells.begin()); + for (int i=0;i<4;++i){ + if ( new_cells.find(cell->neighbor(i)) != new_cells.end() ) + link.push_back(Facet(cell,i)); + else{ + if ( this->is_infinite( cell->neighbor(i) ) ){ + link.push_back(Facet(cell,i)); + cell->vertex((i+1)%4)->is_on_chull(true); + cell->vertex((i+2)%4)->is_on_chull(true); + cell->vertex((i+3)%4)->is_on_chull(true); + } + } + } + } + + std::set new_edges; + //1- set status of these facets + //2- recover new edges + edges incident to link facets + const int index[3]={1,2,3}; + for (typename std::vector::iterator it=link.begin();it!=link.end();++it){ + set_facet_classification_type(*it); + for (int i=0;i<3;++i){ + new_edges.insert(Edge(it->first,(it->second+index[i])%4,(it->second+index[(i+1)%3])%4)); + } + } + + //set status of these edges + for(typename std::set::iterator it=new_edges.begin();it!=new_edges.end();++it){ + Classification_type status=compute_edge_status(it->first, it->second, it->third); + //cross links + Vertex_handle_pair vhp = make_vertex_handle_pair( *it ); + edge_status_map[vhp]=status; + + //update status of incident vertices + update_vertex_status(it->first->vertex(it->second),status); + update_vertex_status(it->first->vertex(it->third),status); + } + + //set final status of vertices + for(typename std::vector::iterator it=vertices_to_update.begin();it!=vertices_to_update.end();++it){ + //this one is working but should be more expensive + //set_vertex_status(*it); continue; + + Classification_type old_status=old_classification[*it]; + Classification_type status=(*it)->get_classification_type(); + + CGAL_precondition( status!=SINGULAR ); // at least on edge is incident to that vertex + + if (status==INTERIOR){ + if (old_status!=INTERIOR || (*it)->is_on_chull()) + (*it)->set_classification_type(REGULAR); + else + (*it)->set_classification_type(INTERIOR); + continue; + } + + if (status==REGULAR) continue; + + if ( status==EXTERIOR && ( old_status==REGULAR || old_status==INTERIOR) ){ //if vertex was EXTERIOR or SINGULAR other edges are not in the alpha complex + //check if former REGULAR vertex becomes EXTERIOR or SINGULAR + std::list incidentv; + finite_adjacent_vertices(*it,back_inserter(incidentv)); + + typename std::list::iterator vvit=incidentv.begin(); + for( ; vvit != incidentv.end(); ++vvit) { + //TODO: We take all edges -> WE SHOULD ONLY TAKE THOSE NOT IN THE HOLE + Vertex_handle_pair vhp = make_vertex_handle_pair( *vvit, *it); + CGAL_assertion(edge_status_map.find(vhp)!=edge_status_map.end()); + Classification_type status=edge_status_map[vhp]; + if (status!=EXTERIOR){ + (*it)->set_classification_type(REGULAR); + break; + } + } + + if ( vvit != incidentv.end() ) continue; + } + + if ( is_vertex_Gabriel((*it),Weighted_tag()) && is_gabriel_simplex_in_alpha_complex((*it)) ) + (*it)->set_classification_type(SINGULAR); + else + (*it)->set_classification_type(EXTERIOR); + } + + //Insert possible hidden points + internal::Hidden_inserter,Weighted_tag>::insert(*this,remover); + } + + + +private: + + typedef internal::Simplex_classif_predicate,Weighted_tag> Simplex_classif; + + +//data members + NT _alpha; //the value of alpha + Edge_status_map edge_status_map; //the map containing the status of edges + + + //------------------------- CONSTRUCTORS ------------------------------ +public: + Fixed_alpha_shape_3(NT alpha=0):_alpha(alpha){} + + Fixed_alpha_shape_3(Dt& dt, NT alpha = 0):_alpha(alpha){ + Dt::swap(dt); + if (dimension() == 3) initialize_alpha(); + } + + // Introduces an alpha-shape `A' for the alpha-value + // `alpha' that is initialized with the points in the range + // from first to last + template < class InputIterator > + Fixed_alpha_shape_3(const InputIterator& first, + const InputIterator& last, + const NT& alpha = 0): _alpha(alpha) + { + Dt::insert(first, last); + if (dimension() == 3) initialize_alpha(); + } + + + +private : + + template < class InputIterator > + int make_alpha_shape(const InputIterator& first, + const InputIterator& last) + { + clear(); + int n = Dt::insert(first, last); + if (dimension() == 3) initialize_alpha(); + return n; + } + + //--------------------- INITIALIZATION OF PRIVATE MEMBERS ----------- + void initialize_status_of_cells(); + void initialize_status_of_facets(); + void initialize_status_of_edges(); + void initialize_status_of_vertices(); + void finalize_status_of_vertex(Vertex_handle); + void initialize_alpha() { + //identify vertices on the convex hull + std::vector chull; + incident_vertices(this->infinite_vertex(),std::back_inserter(chull)); + for ( typename std::vector::iterator it=chull.begin();it!=chull.end();++it) + (*it)->is_on_chull(true); + + initialize_status_of_cells(); + initialize_status_of_facets(); + initialize_status_of_edges(); + initialize_status_of_vertices(); + } + +private : + // prevent default copy constructor and default assigment + Fixed_alpha_shape_3(const Fixed_alpha_shape_3&); + void operator=(const Fixed_alpha_shape_3&); + + static + Vertex_handle_pair + make_vertex_handle_pair( Vertex_handle v1, Vertex_handle v2) { + return v1 < v2 ? std::make_pair(v1,v2) + : std::make_pair(v2,v1); + } + + static + Vertex_handle_pair + make_vertex_handle_pair( const Edge& e) { + return make_vertex_handle_pair(e.first->vertex(e.second),e.first->vertex(e.third)); + } + + struct Compare_edge{ + bool operator()(const Edge& e1,const Edge& e2) const + { + return make_vertex_handle_pair(e1) + bool is_vertex_Gabriel(Vertexhandle v,Tag_true){return is_Gabriel(v);} + void update_vertex_status(Vertex_handle v,Classification_type edge_status); + void set_facet_classification_type(const Facet& f); + void set_vertex_status(Vertex_handle v); + inline void set_cell_status (Cell_handle c); + Classification_type compute_edge_status( const Cell_handle& c,int i,int j) const; + + //--------------------------------------------------------------------- + +public: + // Returns the current alpha-value. + const NT& get_alpha() const + { + return _alpha; + } + + void clear() + { + // clears the structure + Dt::clear(); + edge_status_map.clear(); + } + + //--------------------- PREDICATES ----------------------------------- + +public: + Classification_type classify(const Cell_handle& s) const { + if (is_infinite(s)) return EXTERIOR; + return s->get_classification_type(); + } + Classification_type classify(const Facet& f) const { + if (is_infinite(f)) return EXTERIOR; + return f.first->get_facet_classification_type(f.second); + } + Classification_type classify(const Edge& e) const { + if (is_infinite(e)) return EXTERIOR; + return edge_status_map.find(make_vertex_handle_pair(e))->second; + } + Classification_type classify(const Vertex_handle& v) const { + if (is_infinite(v)) return EXTERIOR; + return v->get_classification_type(); + } + + +//------------------- GEOMETRIC PRIMITIVES ---------------------------- +private: + bool + is_gabriel_simplex_in_alpha_complex (const Cell_handle& s) const{ + return + Simplex_classif::predicate(*this)( + s->vertex(0)->point(), + s->vertex(1)->point(), + s->vertex(2)->point(), + s->vertex(3)->point(), + get_alpha() + ) !=POSITIVE; + } + + bool + is_gabriel_simplex_in_alpha_complex (const Cell_handle& s, const int& i) const{ + return + Simplex_classif::predicate(*this)( + s->vertex(vertex_triple_index(i,0))->point(), + s->vertex(vertex_triple_index(i,1))->point(), + s->vertex(vertex_triple_index(i,2))->point(), + get_alpha() + ) != POSITIVE; + } + + bool + is_gabriel_simplex_in_alpha_complex (const Facet& f) { + return is_gabriel_simplex_in_alpha_complex(f.first, f.second); + } + + bool + is_gabriel_simplex_in_alpha_complex (const Cell_handle& s, const int& i, const int& j) const { + return + Simplex_classif::predicate(*this)( + s->vertex(i)->point(), + s->vertex(j)->point(), + get_alpha() + ) !=POSITIVE; + } + + bool + is_gabriel_simplex_in_alpha_complex (const Edge& e) const { + return is_gabriel_simplex_in_alpha_complex(e.first,e.second,e.third); + } + + bool + is_gabriel_simplex_in_alpha_complex (const Vertex_handle& v) const { + return + Simplex_classif::predicate(*this)( + v->point(), + get_alpha() + ) !=POSITIVE; + } + + //--------------------------------------------------------------------- +public: +#ifdef CGAL_USE_GEOMVIEW + void show_alpha_shape_faces(Geomview_stream &gv) const; +#endif + + + //Iterators + + //--------------------------------------------------------------------- + Alpha_shape_vertices_iterator alpha_shape_vertices_begin() const { + return CGAL::filter_iterator(finite_vertices_end(),Exterior_simplex_test(this),finite_vertices_begin());} + Alpha_shape_vertices_iterator alpha_shape_vertices_end() const { + return CGAL::filter_iterator(finite_vertices_end(),Exterior_simplex_test(this));} + //--------------------------------------------------------------------- + Alpha_shape_facets_iterator alpha_shape_facets_begin() const{ + return CGAL::filter_iterator(finite_facets_end(),Exterior_simplex_test(this),finite_facets_begin());} + Alpha_shape_facets_iterator alpha_shape_facets_end() const { + return CGAL::filter_iterator(finite_facets_end(),Exterior_simplex_test(this));} + //--------------------------------------------------------------------- + Alpha_shape_edges_iterator alpha_shape_edges_begin() const{ + return CGAL::filter_iterator(finite_edges_end(),Exterior_simplex_test(this),finite_edges_begin());} + Alpha_shape_edges_iterator alpha_shape_edges_end() const { + return CGAL::filter_iterator(finite_edges_end(),Exterior_simplex_test(this));} + //--------------------------------------------------------------------- + Alpha_shape_cells_iterator alpha_shape_cells_begin() const { + return CGAL::filter_iterator(finite_cells_end(),Exterior_simplex_test(this),finite_cells_begin()); + } + Alpha_shape_cells_iterator alpha_shape_cells_end() const { + return CGAL::filter_iterator(finite_cells_end(),Exterior_simplex_test(this)); + } + //--------------------------------------------------------------------- + // To extract simplices given a classification type + template + OutputIterator get_alpha_shape_cells(OutputIterator it, + Classification_type type) const + { + Finite_cells_iterator cit = finite_cells_begin(); + for( ; cit != finite_cells_end() ; ++cit){ + if (classify(cit) == type) *it++ = Cell_handle(cit); + } + return it; + } + + template + OutputIterator get_alpha_shape_facets(OutputIterator it, + Classification_type type) const + { + Finite_facets_iterator fit = finite_facets_begin(); + for( ; fit != finite_facets_end() ; ++fit){ + if (classify(*fit) == type) *it++ = *fit; + } + return it; + } + + template + OutputIterator get_alpha_shape_edges(OutputIterator it, + Classification_type type) const + { + Finite_edges_iterator eit = finite_edges_begin(); + for( ; eit != finite_edges_end() ; ++eit){ + if (classify(*eit) == type) *it++ = *eit; + } + return it; + } + + template + OutputIterator get_alpha_shape_vertices(OutputIterator it, + Classification_type type) const + { + Finite_vertices_iterator vit = finite_vertices_begin(); + for( ; vit != finite_vertices_end() ; ++vit){ + if (classify(vit) == type) *it++ = Vertex_handle(vit); + } + return it; + } + +}; + + +template < class Dt > +const typename Fixed_alpha_shape_3
::Classification_type Fixed_alpha_shape_3
::EXTERIOR; +template < class Dt > +const typename Fixed_alpha_shape_3
::Classification_type Fixed_alpha_shape_3
::REGULAR; +template < class Dt > +const typename Fixed_alpha_shape_3
::Classification_type Fixed_alpha_shape_3
::INTERIOR; +template < class Dt > +const typename Fixed_alpha_shape_3
::Classification_type Fixed_alpha_shape_3
::SINGULAR; + +//--------------------------------------------------------------------- +//--------------------- MEMBER FUNCTIONS------------------------------- +//--------------------------------------------------------------------- + + +//--------------------- INITIALIZATION OF PRIVATE MEMBERS ------------- + +template +void Fixed_alpha_shape_3
::set_cell_status(Cell_handle c){ + Classification_type status=is_infinite(c) ? EXTERIOR:( is_gabriel_simplex_in_alpha_complex(c) ? INTERIOR : EXTERIOR ); + c->set_classification_type(status); +} + +template +void +Fixed_alpha_shape_3
::initialize_status_of_cells() +{ + Finite_cells_iterator cell_it, done = finite_cells_end(); + for( cell_it = finite_cells_begin(); cell_it != done; ++cell_it) { + set_cell_status(cell_it); + } +} + + +//--------------------------------------------------------------------- + +template < class Dt > +void +Fixed_alpha_shape_3
:: +set_facet_classification_type( const Facet& f) { + Cell_handle pCell = f.first; + int i = f.second; + Cell_handle pNeighbor = pCell->neighbor(i); + int iNeigh = pNeighbor->index(pCell); + + unsigned nb_interior_cells=0; + + if(!is_infinite(pCell)){ + if (pCell->get_classification_type()==INTERIOR) + ++nb_interior_cells; + } + + if(!is_infinite(pNeighbor)){ + if (pNeighbor->get_classification_type()==INTERIOR) + ++nb_interior_cells; + } + + Classification_type status=EXTERIOR; + switch (nb_interior_cells){ + case 2: + status=INTERIOR; + break; + case 1: + status=REGULAR; + break; + default: + { + if ( is_Gabriel(f) ){ + if ( is_gabriel_simplex_in_alpha_complex(f) ) status=SINGULAR; + } + } + } + pCell->set_facet_classification_type(i,status); + pNeighbor->set_facet_classification_type(iNeigh,status); +} + + +template +void +Fixed_alpha_shape_3
::initialize_status_of_facets() +{ + for(Finite_facets_iterator fit = finite_facets_begin(); + fit != finite_facets_end(); ++fit) + set_facet_classification_type(*fit); +} + + + +template < class Dt > +typename Fixed_alpha_shape_3
::Classification_type +Fixed_alpha_shape_3
:: +compute_edge_status( const Cell_handle& c, int i, int j) const +{ + Facet_circulator fcirc, done; + fcirc = incident_facets(c,i,j); + done = fcirc; + + bool is_regular=false; + bool is_interior=true; + do{ + if (!is_infinite(*fcirc)){ + Classification_type status=(*fcirc).first->get_facet_classification_type((*fcirc).second); + if (status!=INTERIOR) is_interior=false; + if (status!=EXTERIOR) + is_regular=true; + else + if (is_regular) + break; + } + }while(++fcirc!=done); + if (is_interior) return INTERIOR; + if (is_regular) return REGULAR; + + if ( is_Gabriel(c,i,j) ){ + if ( is_gabriel_simplex_in_alpha_complex(c,i,j) ) return SINGULAR; + } + return EXTERIOR; +} + +template +void +Fixed_alpha_shape_3
::initialize_status_of_edges() +{ + for (Finite_edges_iterator eit = finite_edges_begin(); + eit != finite_edges_end(); ++eit) + { + Classification_type status=compute_edge_status(eit->first, eit->second, eit->third); + //cross links + Vertex_handle_pair vhp = make_vertex_handle_pair( *eit ); + edge_status_map.insert(std::make_pair(vhp, status)); + } +} + + +//this function is only to use for update (removal/update) +template +void +Fixed_alpha_shape_3
::set_vertex_status(Vertex_handle v){ + std::list incidentv; + finite_adjacent_vertices(v,back_inserter(incidentv)); + + bool is_interior=true; + bool is_regular=false; + typename std::list::iterator vvit=incidentv.begin(); + for( ; vvit != incidentv.end(); ++vvit) { + Vertex_handle_pair vhp = make_vertex_handle_pair( *vvit, v); + Classification_type status=edge_status_map[vhp]; + if (status!=INTERIOR) is_interior=false; + if (!is_interior && status!=EXTERIOR){ + is_regular=true; + break; + } + } + + Classification_type status=EXTERIOR; + if (is_interior) + status=v->is_on_chull() ? REGULAR : INTERIOR; + else{ + if (is_regular) + status=REGULAR; + else{ + if ( is_vertex_Gabriel(v,Weighted_tag()) ){ + if ( is_gabriel_simplex_in_alpha_complex(v) ) status=SINGULAR; + } + } + } + v->set_classification_type(status); +} + +template +void +Fixed_alpha_shape_3
::update_vertex_status(Vertex_handle v,Classification_type edge_status){ + Classification_type status=v->get_classification_type(); + switch(status){ + case SINGULAR: + switch(edge_status){ + case INTERIOR: + status=INTERIOR; + break; + case EXTERIOR: + status=EXTERIOR; + break; + case REGULAR: + case SINGULAR: + status=REGULAR; + } + break; + case INTERIOR: + switch(edge_status){ + case INTERIOR: + break; + case EXTERIOR: + case REGULAR: + case SINGULAR: + status=REGULAR; + } + break; + case EXTERIOR: + switch(edge_status){ + case EXTERIOR: + break; + case INTERIOR: + case REGULAR: + case SINGULAR: + status=REGULAR; + } + break; + case REGULAR: + break; + } + v->set_classification_type(status); +} + +template +void +Fixed_alpha_shape_3
::finalize_status_of_vertex(Vertex_handle v) +{ + Classification_type status=v->get_classification_type(); + if (v->is_on_chull() && status==INTERIOR){ + v->set_classification_type(REGULAR); + return; + } + if (status==INTERIOR || status==REGULAR) + return; + + //when dimension is 3 any vertex has at least one incident edge, + // thus can't be SINGULAR again (because of update_vertex_status behavior) + CGAL_assertion(v->get_classification_type()==EXTERIOR); + + if ( is_vertex_Gabriel(v,Weighted_tag()) && is_gabriel_simplex_in_alpha_complex(v) ) + v->set_classification_type(SINGULAR); +} + +template +void +Fixed_alpha_shape_3
::initialize_status_of_vertices() +{ + #if 1 //approach avoiding extensive use of the map on 3hfli we move from 0.110983 to 0.082987 + for( Finite_vertices_iterator vit = finite_vertices_begin(); vit != finite_vertices_end(); ++vit) + vit->set_classification_type(SINGULAR); + for (typename Edge_status_map::const_iterator eit=edge_status_map.begin();eit!=edge_status_map.end();++eit){ + Classification_type edge_status=eit->second; + Vertex_handle_pair vhp=eit->first; + update_vertex_status(vhp.first,edge_status); + update_vertex_status(vhp.second,edge_status); + } + for( Finite_vertices_iterator vit = finite_vertices_begin(); vit != finite_vertices_end(); ++vit) + finalize_status_of_vertex(vit); + #else + //This method is slower because it always makes queries in the edge classification map + for( Finite_vertices_iterator vit = finite_vertices_begin(); + vit != finite_vertices_end(); ++vit) + set_vertex_status(vit); + #endif +} + +//--------------------------------------------------------------------- + +template +std::ostream& operator<<(std::ostream& os, const Fixed_alpha_shape_3
& A) + // Inserts the alpha shape into the stream `os' as an indexed face set. + // Precondition: The insert operator must be defined for `Point' +{ + typedef Fixed_alpha_shape_3
AS; + typedef typename AS::Vertex_handle Vertex_handle; + typedef typename AS::Cell_handle Cell_handle; + typedef typename AS::Alpha_shape_vertices_iterator + Alpha_shape_vertices_iterator; + typedef typename AS::Alpha_shape_facets_iterator + Alpha_shape_facets_iterator; + + Unique_hash_map< Vertex_handle, int > V; + int number_of_vertices = 0; + + Alpha_shape_vertices_iterator vit; + for( vit = A.alpha_shape_vertices_begin(); + vit != A.alpha_shape_vertices_end(); + ++vit) { + V[*vit] = number_of_vertices++; + os << (*vit)->point() << std::endl; + } + + Cell_handle c; + int i; + Alpha_shape_facets_iterator fit; + for( fit = A.alpha_shape_facets_begin(); + fit != A.alpha_shape_facets_end(); + ++fit) { + c = fit->first; + i = fit->second; + // the following ensures that regular facets are output + // in ccw order + if (A.classify(*fit) == AS::REGULAR && (A.classify(c) == AS::INTERIOR)){ + c = c->neighbor(i); + i = c->index(fit->first); + } + int i0 = Triangulation_utils_3::vertex_triple_index(i,0); + int i1 = Triangulation_utils_3::vertex_triple_index(i,1); + int i2 = Triangulation_utils_3::vertex_triple_index(i,2); + os << V[c->vertex(i0)] << ' ' + << V[c->vertex(i1)] << ' ' + << V[c->vertex(i2)] << std::endl; + } + return os; +} + +} //namespace CGAL + +#ifdef CGAL_USE_GEOMVIEW +#include +#endif + +#endif //CGAL_FIXED_ALPHA_SHAPE_3_H diff --git a/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_cell_base_3.h b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_cell_base_3.h new file mode 100644 index 00000000000..ad93c065aaf --- /dev/null +++ b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_cell_base_3.h @@ -0,0 +1,76 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_FIXED_ALPHA_SHAPE_CELL_BASE_3_H +#define CGAL_FIXED_ALPHA_SHAPE_CELL_BASE_3_H + +#include +#include +#include +#include + +namespace CGAL { + +template < class Gt, class Cb = Triangulation_cell_base_3 > +class Fixed_alpha_shape_cell_base_3 + : public Cb +{ +public: + typedef typename Cb::Vertex_handle Vertex_handle; + typedef typename Cb::Cell_handle Cell_handle; + + template < typename TDS2 > + struct Rebind_TDS { + typedef typename Cb::template Rebind_TDS::Other Cb2; + typedef Fixed_alpha_shape_cell_base_3 Other; + }; + + +private: + typedef internal::Classification_type Classification_type; + + Classification_type facet_status[4]; + Classification_type status_; + +public: + + Fixed_alpha_shape_cell_base_3() + : Cb() {} + + Fixed_alpha_shape_cell_base_3(Vertex_handle v0, Vertex_handle v1, + Vertex_handle v2, Vertex_handle v3) + : Cb(v0, v1, v2, v3) {} + + Fixed_alpha_shape_cell_base_3(Vertex_handle v0, Vertex_handle v1, + Vertex_handle v2, Vertex_handle v3, + Cell_handle n0, Cell_handle n1, + Cell_handle n2, Cell_handle n3) + : Cb(v0, v1, v2, v3, n0, n1, n2, n3) {} + + + Classification_type get_facet_classification_type(int i) const {return facet_status[i];} + void set_facet_classification_type(int i, Classification_type status) { facet_status[i]=status; } + Classification_type get_classification_type() { return status_;} + void set_classification_type(Classification_type status) {status_=status;} +}; + +} //namespace CGAL + +#endif // CGAL_FIXED_ALPHA_SHAPE_CELL_BASE_3_H diff --git a/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_vertex_base_3.h b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_vertex_base_3.h new file mode 100644 index 00000000000..1d90fbd1a65 --- /dev/null +++ b/Alpha_shapes_3/include/CGAL/Fixed_alpha_shape_vertex_base_3.h @@ -0,0 +1,75 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL$ +// $Id$ +// +// +// Author(s) : Sebastien Loriot +// + +#ifndef CGAL_FIXED_ALPHA_SHAPE_VERTEX_BASE_3_H +#define CGAL_FIXED_ALPHA_SHAPE_VERTEX_BASE_3_H + +#include +#include +#include +#include + +namespace CGAL { + +template > +class Fixed_alpha_shape_vertex_base_3 + : public Vb +{ +public: + + typedef typename Vb::Cell_handle Cell_handle; + + template < typename TDS2 > + struct Rebind_TDS { + typedef typename Vb::template Rebind_TDS::Other Vb2; + typedef Fixed_alpha_shape_vertex_base_3 Other; + }; + + typedef typename Gt::Point_3 Point; + + +private: + typedef internal::Classification_type Classification_type; + Classification_type status_; + + bool is_on_chull_; + +public: + + Fixed_alpha_shape_vertex_base_3() + : Vb(),is_on_chull_(false) {} + + Fixed_alpha_shape_vertex_base_3(const Point& p) + : Vb(p),is_on_chull_(false) {} + + Fixed_alpha_shape_vertex_base_3(const Point& p, Cell_handle c) + : Vb(p, c),is_on_chull_(false) {} + + Classification_type get_classification_type() { return status_;} + void set_classification_type(Classification_type status) {status_=status;} + + void is_on_chull(bool b){is_on_chull_=b;}; + bool is_on_chull(){return is_on_chull_;} + +}; + +} //namespace CGAL + +#endif // CGAL_FIXED_ALPHA_SHAPE_VERTEX_BASE_3_H diff --git a/Alpha_shapes_3/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h b/Alpha_shapes_3/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h index 1afa7bd771e..fb3bfbb3fd2 100644 --- a/Alpha_shapes_3/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h +++ b/Alpha_shapes_3/include/CGAL/Weighted_alpha_shape_euclidean_traits_3.h @@ -28,14 +28,15 @@ namespace CGAL { //------------------ Traits class ------------------------------------- -#ifndef CGAL_NO_DEPRECATED_CODE +#ifdef CGAL_NO_DEPRECATED_CODE +#error The class Weighted_alpha_shape_euclidean_traits_3 is deprecated in favor of Regular_triangulation_euclidean_traits_3. +#endif template class Weighted_alpha_shape_euclidean_traits_3 : public Regular_triangulation_euclidean_traits_3 {}; - -#endif //CGAL_NO_DEPRECATED_CODE + } //namespace CGAL diff --git a/Alpha_shapes_3/include/CGAL/internal/Classification_type.h b/Alpha_shapes_3/include/CGAL/internal/Classification_type.h new file mode 100644 index 00000000000..32a8e6a33d2 --- /dev/null +++ b/Alpha_shapes_3/include/CGAL/internal/Classification_type.h @@ -0,0 +1,9 @@ +#ifndef CGAL_INTERNAL_CLASSIFICATION_TYPE_H +#define CGAL_INTERNAL_CLASSIFICATION_TYPE_H + +namespace CGAL{ + namespace internal{ + enum Classification_type {EXTERIOR,SINGULAR,REGULAR,INTERIOR}; + } +} +#endif //CGAL_INTERNAL_CLASSIFICATION_TYPE_H diff --git a/Alpha_shapes_3/test/Alpha_shapes_3/Filtered_weighted_alpha_shape_euclidean_traits_3.h b/Alpha_shapes_3/test/Alpha_shapes_3/Filtered_weighted_alpha_shape_euclidean_traits_3.h new file mode 100644 index 00000000000..5369beeca1f --- /dev/null +++ b/Alpha_shapes_3/test/Alpha_shapes_3/Filtered_weighted_alpha_shape_euclidean_traits_3.h @@ -0,0 +1,302 @@ +// Copyright (c) 2009 INRIA Sophia-Antipolis (France). +// All rights reserved. +// +// This file is part of CGAL (www.cgal.org); you may redistribute it under +// the terms of the Q Public License version 1.0. +// See the file LICENSE.QPL distributed with CGAL. +// +// Licensees holding a valid commercial license may use this file in +// accordance with the commercial license agreement provided with the software. +// +// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE +// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. +// +// $URL: svn+ssh:// $ +// $Id: $ +// +// +// Author(s) : Sébastien Loriot + +#ifndef CGAL_FILTERED_WEIGHTED_ALPHA_SHAPE_EUCLIDEAN_TRAITS_3_H +#define CGAL_FILTERED_WEIGHTED_ALPHA_SHAPE_EUCLIDEAN_TRAITS_3_H + +#include +#include + +namespace CGAL { + +namespace internal{ + +template