The function oriented_bounding_box() computes an approximation of the optimal bounding box, which is defined as the rectangular box with smallest volume of all ...
cgal.org
Top
GettingStarted
Tutorials
PackageOverview
AcknowledgingCGAL
CGAL5.4.1-OptimalBoundingBox
Thefunctionoriented_bounding_box()computesanapproximationoftheoptimalboundingbox,whichisdefinedastherectangularboxwithsmallestvolumeofalltherectangularboxescontainingtheinputpoints.
Internally,thealgorithmusesanoptimizationprocesstocomputeatransformation(rotation)\({\mathcalR}_b\)suchthattheaxis-alignedboxoftherotatedinputpointsethasavolumethatisassmallaspossiblegivenafixedmaximalnumberofoptimizationiterations.
Input
Theinputcanbeeitherarangeof3Dpoints,orapolygonmesh.
Output
Theresultofthealgorithmcanberetrievedaseither:
thebestaffinetransformation\({\mathcalR}_b\)thatthealgorithmhasfound;
anarrayofeightpoints,representingthebestorientedboundingbox(\({\mathcalB}_b\))thatthealgorithmhasconstructed,whichisrelatedto\({\mathcalR}_b\)asitistheinversetransformationoftheaxis-alignedboundingboxofthetransformedpointset.TheorderofthepointsinthearrayisthesameasinthefunctionCGAL::make_hexahedron(),whichcanbeusedtoconstructameshfromthesepoints.
amodelofMutableFaceGraph
Notethatwhenreturninganarrayofpoints,thesepointsareconstructedfromtheaxis-alignedboundingboxandsomeprecisionlossshouldthereforebeexpectedifakernelnotprovidingexactconstructionsisused.
ThealgorithmisbasedonapaperbyChang,Gorissen,andMelchior[1].
Functions
template
void CGAL::oriented_bounding_box(constPointRange&points,Output&out,constNamedParameters&np)
Thefunctionoriented_bounding_box()computesanapproximationoftheoptimalboundingbox,whichisdefinedastherectangularboxwithsmallestvolumeofalltherectangularboxescontainingtheinputpoints.More...
template
void CGAL::oriented_bounding_box(constPolygonMesh&pmesh,Output&out,constNamedParameters&np)
Extractstheverticesofthemeshasapointrangeandcallstheoverloadusingpointsasinput.More...
FunctionDocumentation
◆ oriented_bounding_box()[1/2]
template
voidCGAL::oriented_bounding_box
(
constPointRange&
points,
Output&
out,
constNamedParameters&
np
)
#include
Thefunctionoriented_bounding_box()computesanapproximationoftheoptimalboundingbox,whichisdefinedastherectangularboxwithsmallestvolumeofalltherectangularboxescontainingtheinputpoints.
SeeOrientedBoundingBoxFunctionsformoreinformation.
TemplateParameters
PointRangeamodelofRange.ThevaluetypemaynotbeequaltothetypePoint_3ofthetraitsclassifapointmapisprovidedvianamedparameters(seebelow)toaccesspoints.
OutputeitherthetypeAff_transformation_3ofthetraitsclass,orstd::arraywithPointbeingequivalenttothetypePoint_3ofthetraitsclass,oramodelofMutableFaceGraph
NamedParametersasequenceofNamedParameters
Parameters
pointstheinputrange
outtheresultingarrayofpointsoraffinetransformation
npanoptionalsequenceofNamedParametersamongtheoneslistedbelow
OptionalNamedParameters
point_map
apropertymapassociatingpointstotheelementsofthepointrange
Type:amodelofReadablePropertyMapwithvaluetypegeom_traits::Point_3
Default:CGAL::Identity_property_map<:point_3>
geom_traits
aninstanceofageometrictraitsclass
Type:amodelofOrientedBoundingBoxTraits_3
Default:adefault-constructedobjectoftypeCGAL::Oriented_bounding_box_traits_3,whereKisakerneltypededucedfromthepointtype.
use_convex_hull
Parameterusedintheconstructionoforientedboundingboxtoindicatewhetherthealgorithmshouldfirstextracttheextremepoints(pointsthatareonthe3Dconvexhull)oftheinputdatarangetoacceleratethecomputationoftheboundingbox.
Type:Boolean
Default:true
Examples:Optimal_bounding_box/obb_example.cpp,Optimal_bounding_box/obb_with_point_maps_example.cpp,andOptimal_bounding_box/rotated_aabb_tree_example.cpp.
◆ oriented_bounding_box()[2/2]
template
voidCGAL::oriented_bounding_box
(
constPolygonMesh&
pmesh,
Output&
out,
constNamedParameters&
np
)
#include
Extractstheverticesofthemeshasapointrangeandcallstheoverloadusingpointsasinput.
TemplateParameters
PolygonMeshamodelofVertexListGraph
OutputeitherthetypeAff_transformation_3ofthetraitsclass,orstd::arraywithPointbeingequivalenttothetypePoint_3ofthetraitsclass,oramodelofMutableFaceGraph
NamedParametersasequenceofNamedParameters
Parameters
pmeshtheinputmesh
outtheresultingarrayofpointsoraffinetransformation
npanoptionalsequenceofNamedParametersamongtheoneslistedbelow
OptionalNamedParameters
vertex_point_map
apropertymapassociatingpointstotheverticesofpmesh
Type:aclassmodelofReadablePropertyMapwithboost::graph_traits::vertex_descriptoraskeytypeandPoint_3asvaluetype
Default:boost::get(CGAL::vertex_point,pmesh)
Extra:Ifthisparameterisomitted,aninternalpropertymapforCGAL::vertex_point_tshouldbeavailablefortheverticesofpmesh.
geom_traits
aninstanceofageometrictraitsclass
Type:amodelofOrientedBoundingBoxTraits_3
Default:adefault-constructedobjectoftypeCGAL::Oriented_bounding_box_traits_3,whereKisakerneltypededucedfromthepointtype.
use_convex_hull
Parameterusedintheconstructionoforientedboundingboxtoindicatewhetherthealgorithmshouldfirstextracttheextremepoints(pointsthatareonthe3Dconvexhull)oftheinputdatarangetoacceleratethecomputationoftheboundingbox.
Type:Boolean
Default:true