PCA: simplified interface in 3D

This commit is contained in:
Pierre Alliez 2008-01-16 16:41:58 +00:00
parent d8620dc23e
commit e02cb6172a
11 changed files with 420 additions and 297 deletions

View File

@ -1,23 +1,21 @@
Microsoft Visual Studio Solution File, Format Version 8.00
Microsoft Visual Studio Solution File, Format Version 9.00
# Visual Studio 2005
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Mesh", "Mesh.vcproj", "{83571301-4A1D-4C64-B89E-656467112D87}"
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7A88F6B5-90BD-491B-869E-360370AD28EB}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
Release = Release
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Release|Win32 = Release|Win32
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{83571301-4A1D-4C64-B89E-656467112D87}.Debug.ActiveCfg = Debug|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Debug.Build.0 = Debug|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Release.ActiveCfg = Release|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Release.Build.0 = Release|Win32
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{83571301-4A1D-4C64-B89E-656467112D87}.Debug|Win32.ActiveCfg = Debug|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Debug|Win32.Build.0 = Debug|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Release|Win32.ActiveCfg = Release|Win32
{83571301-4A1D-4C64-B89E-656467112D87}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionItems) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -1,137 +1,198 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.10"
Version="8,00"
Name="Mesh"
ProjectGUID="{83571301-4A1D-4C64-B89E-656467112D87}"
Keyword="MFCProj">
Keyword="MFCProj"
>
<Platforms>
<Platform
Name="Win32"/>
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="Debug"
IntermediateDirectory="Debug"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="1"
CharacterSet="2">
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="false"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/GR /Zm900"
Optimization="0"
AdditionalIncludeDirectories="$(CGALROOT)\include\CGAL\config\msvc7;$(CGALROOT)\include;$(PCA)"
PreprocessorDefinitions="WIN32;_WINDOWS;_DEBUG;NOMINMAX;CGAL_USE_POLYHEDRON_DESIGN_TWO"
MinimalRebuild="TRUE"
AdditionalIncludeDirectories="..\..\..\..\include;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(BOOSTROOT)&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
RuntimeLibrary="1"
TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="3"/>
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="$(CGALROOT)/lib/msvc7/cgal_mt_debug.lib"
AdditionalDependencies="opengl32.lib glu32.lib"
LinkIncremental="2"
GenerateDebugInformation="TRUE"
SubSystem="2"
TargetMachine="1"/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="_DEBUG"
MkTypLibCompatible="FALSE"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"/>
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"/>
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib"
LinkIncremental="2"
AdditionalLibraryDirectories="&quot;$(CGALROOT)\lib&quot;"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCWebDeploymentTool"/>
Name="VCALinkTool"
/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
Name="VCManifestTool"
/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="Release"
IntermediateDirectory="Release"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="1"
CharacterSet="2">
CharacterSet="2"
>
<Tool
Name="VCCLCompilerTool"
Optimization="3"
GlobalOptimizations="TRUE"
EnableIntrinsicFunctions="TRUE"
FavorSizeOrSpeed="1"
OptimizeForProcessor="3"
OptimizeForWindowsApplication="TRUE"
AdditionalIncludeDirectories="$(CGALROOT)\include\CGAL\config\msvc7;$(CGALROOT)\include;$(PCA)"
PreprocessorDefinitions="WIN32;_WINDOWS;NDEBUG;NOMINMAX;CGAL_USE_POLYHEDRON_DESIGN_TWO"
MinimalRebuild="FALSE"
BasicRuntimeChecks="0"
SmallerTypeCheck="FALSE"
RuntimeLibrary="2"
TreatWChar_tAsBuiltInType="TRUE"
RuntimeTypeInfo="TRUE"
UsePrecompiledHeader="3"
WarningLevel="3"
Detect64BitPortabilityProblems="FALSE"
DebugInformationFormat="0"/>
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"/>
Name="VCCustomBuildTool"
/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="$(CGALROOT)/lib/msvc7/cgal_mt_release.lib"
AdditionalDependencies="opengl32.lib glu32.lib"
LinkIncremental="1"
GenerateDebugInformation="FALSE"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"/>
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
PreprocessorDefinitions="NDEBUG"
MkTypLibCompatible="FALSE"/>
MkTypLibCompatible="false"
/>
<Tool
Name="VCPostBuildEventTool"/>
Name="VCCLCompilerTool"
Optimization="3"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
AdditionalIncludeDirectories="..\..\..\..\include;&quot;$(CGALROOT)\include\CGAL\config\msvc&quot;;&quot;$(CGALROOT)\include&quot;;&quot;$(BOOSTROOT)&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_SCL_SECURE_NO_DEPRECATE;_CRT_SECURE_NO_DEPRECATE"
MinimalRebuild="false"
BasicRuntimeChecks="0"
SmallerTypeCheck="false"
RuntimeLibrary="0"
TreatWChar_tAsBuiltInType="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="2"
WarningLevel="3"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="0"
/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="$(IntDir)"/>
AdditionalIncludeDirectories="$(IntDir)"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"/>
Name="VCLinkerTool"
AdditionalDependencies="opengl32.lib glu32.lib"
LinkIncremental="1"
AdditionalLibraryDirectories="&quot;$(CGALROOT)\lib&quot;"
GenerateDebugInformation="false"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCWebDeploymentTool"/>
Name="VCALinkTool"
/>
<Tool
Name="VCManagedWrapperGeneratorTool"/>
Name="VCManifestTool"
/>
<Tool
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
@ -140,197 +201,272 @@
<Filter
Name="App Source Files"
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\ChildFrm.cpp">
RelativePath=".\ChildFrm.cpp"
>
</File>
<File
RelativePath=".\DialogOptions.cpp">
RelativePath=".\DialogOptions.cpp"
>
</File>
<File
RelativePath=".\MainFrm.cpp">
RelativePath=".\MainFrm.cpp"
>
</File>
<File
RelativePath=".\Mesh.cpp">
RelativePath=".\Mesh.cpp"
>
</File>
<File
RelativePath=".\MeshDoc.cpp">
RelativePath=".\MeshDoc.cpp"
>
</File>
<File
RelativePath=".\MeshView.cpp">
RelativePath=".\MeshView.cpp"
>
</File>
<File
RelativePath=".\stdafx.cpp">
RelativePath=".\stdafx.cpp"
>
<FileConfiguration
Name="Debug|Win32">
Name="Debug|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
UsePrecompiledHeader="1"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"
UsePrecompiledHeader="1"/>
UsePrecompiledHeader="1"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\TextualStatusBar.cpp">
RelativePath=".\TextualStatusBar.cpp"
>
</File>
</Filter>
<Filter
Name="App Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\ChildFrm.h">
RelativePath=".\ChildFrm.h"
>
</File>
<File
RelativePath=".\DialogOptions.h">
RelativePath=".\DialogOptions.h"
>
</File>
<File
RelativePath=".\lib\dt3.h">
RelativePath=".\lib\dt3.h"
>
</File>
<File
RelativePath="$(CGALROOT)\$(CGALROOT)\include\Cgal\eigen.h">
RelativePath="$(CGALROOT)\$(CGALROOT)\include\Cgal\eigen.h"
>
</File>
<File
RelativePath=".\MainFrm.h">
RelativePath=".\MainFrm.h"
>
</File>
<File
RelativePath=".\Mesh.h">
RelativePath=".\Mesh.h"
>
</File>
<File
RelativePath=".\MeshDoc.h">
RelativePath=".\MeshDoc.h"
>
</File>
<File
RelativePath=".\MeshView.h">
RelativePath=".\MeshView.h"
>
</File>
<File
RelativePath=".\Resource.h">
RelativePath=".\Resource.h"
>
</File>
<File
RelativePath=".\stdafx.h">
RelativePath=".\stdafx.h"
>
</File>
<File
RelativePath=".\TextualStatusBar.h">
RelativePath=".\TextualStatusBar.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\res\idb0.bmp">
RelativePath=".\res\idb0.bmp"
>
</File>
<File
RelativePath=".\res\idb1.bmp">
RelativePath=".\res\idb1.bmp"
>
</File>
<File
RelativePath=".\res\idb2.bmp">
RelativePath=".\res\idb2.bmp"
>
</File>
<File
RelativePath=".\res\idb3.bmp">
RelativePath=".\res\idb3.bmp"
>
</File>
<File
RelativePath=".\res\idb4.bmp">
RelativePath=".\res\idb4.bmp"
>
</File>
<File
RelativePath=".\res\idb5.bmp">
RelativePath=".\res\idb5.bmp"
>
</File>
<File
RelativePath=".\res\idb6.bmp">
RelativePath=".\res\idb6.bmp"
>
</File>
<File
RelativePath=".\res\idb7.bmp">
RelativePath=".\res\idb7.bmp"
>
</File>
<File
RelativePath=".\res\idb8.bmp">
RelativePath=".\res\idb8.bmp"
>
</File>
<File
RelativePath=".\res\Mesh.ico">
RelativePath=".\res\Mesh.ico"
>
</File>
<File
RelativePath=".\Mesh.rc">
RelativePath=".\Mesh.rc"
>
</File>
<File
RelativePath=".\res\Mesh.rc2">
RelativePath=".\res\Mesh.rc2"
>
</File>
<File
RelativePath=".\res\MeshDoc.ico">
RelativePath=".\res\MeshDoc.ico"
>
</File>
<File
RelativePath=".\res\Toolbar.bmp">
RelativePath=".\res\Toolbar.bmp"
>
</File>
</Filter>
<Filter
Name="CGAL"
Filter="">
>
<File
RelativePath=".\lib\enriched_polyhedron.h">
RelativePath=".\lib\enriched_polyhedron.h"
>
</File>
</Filter>
<Filter
Name="Arcball"
Filter="">
>
<File
RelativePath=".\lib\arcball\Arcball.cpp">
RelativePath=".\lib\arcball\Arcball.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Arcball.h">
RelativePath=".\lib\arcball\Arcball.h"
>
</File>
<File
RelativePath=".\lib\arcball\Camera.cpp">
RelativePath=".\lib\arcball\Camera.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Camera.h">
RelativePath=".\lib\arcball\Camera.h"
>
</File>
<File
RelativePath=".\lib\arcball\Matrix44.cpp">
RelativePath=".\lib\arcball\Matrix44.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Matrix44.h">
RelativePath=".\lib\arcball\Matrix44.h"
>
</File>
<File
RelativePath=".\lib\arcball\Quaternion.cpp">
RelativePath=".\lib\arcball\Quaternion.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Quaternion.h">
RelativePath=".\lib\arcball\Quaternion.h"
>
</File>
<File
RelativePath=".\lib\arcball\Vector3d.cpp">
RelativePath=".\lib\arcball\Vector3d.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Vector3d.h">
RelativePath=".\lib\arcball\Vector3d.h"
>
</File>
<File
RelativePath=".\lib\arcball\Viewport.cpp">
RelativePath=".\lib\arcball\Viewport.cpp"
>
</File>
<File
RelativePath=".\lib\arcball\Viewport.h">
RelativePath=".\lib\arcball\Viewport.h"
>
</File>
</Filter>
<File
RelativePath=".\DialogMOde.htm"
DeploymentContent="TRUE">
DeploymentContent="true"
>
</File>
<File
RelativePath=".\DialogOptions.htm"
DeploymentContent="TRUE">
DeploymentContent="true"
>
</File>
<File
RelativePath=".\res\Mesh.manifest">
RelativePath=".\res\Mesh.manifest"
>
<FileConfiguration
Name="Debug|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
ExcludedFromBuild="true"
>
<Tool
Name="VCCustomBuildTool"
/>
</FileConfiguration>
</File>
<File
RelativePath=".\Mesh.reg">
RelativePath=".\Mesh.reg"
>
</File>
<File
RelativePath=".\ReadMe.txt">
RelativePath=".\ReadMe.txt"
>
</File>
</Files>
<Globals>
<Global
Name="RESOURCE_FILE"
Value="Mesh.rc"/>
Value="Mesh.rc"
/>
</Globals>
</VisualStudioProject>

View File

@ -245,19 +245,23 @@ void CMeshDoc::OnFitFitpointset()
{
linear_least_squares_fitting_3(m_points.begin(),
m_points.end(),
m_fitting_line);
m_fitting_line,
CGAL::PCA_dimension_0_tag());
linear_least_squares_fitting_3(m_points.begin(),
m_points.end(),
m_fitting_line,
m_centroid);
m_centroid,
CGAL::PCA_dimension_0_tag());
linear_least_squares_fitting_3(m_points.begin(),
m_points.end(),
m_fitting_plane);
m_fitting_plane,
CGAL::PCA_dimension_0_tag());
linear_least_squares_fitting_3(m_points.begin(),
m_points.end(),
m_fitting_plane,
m_centroid);
m_centroid,
CGAL::PCA_dimension_0_tag());
UpdateAllViews(NULL);
}
@ -265,18 +269,22 @@ void CMeshDoc::OnFitTriangleset32899()
{
linear_least_squares_fitting_3(m_triangles.begin(),
m_triangles.end(),
m_fitting_line);
m_fitting_line,
CGAL::PCA_dimension_2_tag());
linear_least_squares_fitting_3(m_triangles.begin(),
m_triangles.end(),
m_fitting_line,
m_centroid);
m_centroid,
CGAL::PCA_dimension_2_tag());
linear_least_squares_fitting_3(m_triangles.begin(),
m_triangles.end(),
m_fitting_plane);
m_fitting_plane,
CGAL::PCA_dimension_2_tag());
linear_least_squares_fitting_3(m_triangles.begin(),
m_triangles.end(),
m_fitting_plane,
m_centroid);
m_centroid,
CGAL::PCA_dimension_2_tag());
UpdateAllViews(NULL);
}

View File

@ -25,7 +25,6 @@ BEGIN_MESSAGE_MAP(CTextualStatusBar, CStatusBar)
//{{AFX_MSG_MAP(CTextualStatusBar)
ON_WM_CREATE()
ON_WM_DESTROY()
ON_WM_NCHITTEST()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
@ -57,27 +56,3 @@ BOOL CTextualStatusBar::PreTranslateMessage(MSG* pMsg)
return CStatusBar::PreTranslateMessage(pMsg);
}
UINT CTextualStatusBar::OnNcHitTest(CPoint point)
{
CStatusBarCtrl& statusBar = GetStatusBarCtrl();
int i = -1;
CRect rectPane;
CPoint ptTmp(point);
ScreenToClient(&ptTmp);
int nCount = GetCount();
while (i++ < nCount)
{
statusBar.GetRect(i, rectPane);
if (rectPane.PtInRect(ptTmp) )
{
CString strTip;
m_wndToolTip.GetText(strTip, this);
LPCTSTR lpPaneText = GetPaneText(i);
if (strTip != lpPaneText)
m_wndToolTip.UpdateTipText(lpPaneText, this);
break;
}
}
return CStatusBar::OnNcHitTest(point);
}

View File

@ -91,7 +91,7 @@ assemble_covariance_matrix_3(InputIterator first,
InputIterator beyond,
typename K::FT covariance[6], // covariance matrix
const typename K::Point_3& c, // centroid
const K& , // kernel
const K& k, // kernel
const typename K::Triangle_3*,// used for indirection
const CGAL::PCA_dimension_2_tag& tag)
{
@ -114,7 +114,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {1.0/12.0, 1.0/24.0, 1.0/24.0,
1.0/24.0, 1.0/12.0, 1.0/24.0,
1.0/24.0, 1.0/24.0, 1.0/12.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -129,7 +129,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {t[0].x(), t[1].x(), t[2].x(),
t[0].y(), t[1].y(), t[2].y(),
t[0].z(), t[1].z(), t[2].z()};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT area = std::sqrt(t.squared_area());
CGAL_assertion(area != 0.0);
@ -191,7 +191,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {1.0/3.0, 1.0/4.0, 1.0/4.0,
1.0/4.0, 1.0/3.0, 1.0/4.0,
1.0/4.0, 1.0/4.0, 1.0/3.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -209,7 +209,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {t[1].x()-x0, t[3].x()-x0, t[5].x()-x0,
t[1].y()-y0, t[3].y()-y0, t[5].y()-y0,
t[1].z()-z0, t[3].z()-z0, t[5].z()-z0};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT volume = t.volume();
CGAL_assertion(volume != 0.0);
@ -276,7 +276,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {7.0/3.0, 1.5, 1.5,
1.5, 7.0/3.0, 1.5,
1.5, 1.5, 7.0/3.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -294,7 +294,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {t[1].x()-x0, t[3].x()-x0, t[5].x()-x0,
t[1].y()-y0, t[3].y()-y0, t[5].y()-y0,
t[1].z()-z0, t[3].z()-z0, t[5].z()-z0};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT area = pow(delta[0]*delta[0] + delta[3]*delta[3] +
delta[6]*delta[6],1/3.0)*pow(delta[1]*delta[1] +
delta[4]*delta[4] + delta[7]*delta[7],1/3.0)*2 +
@ -369,7 +369,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {4.0/15.0, 0.0, 0.0,
0.0, 4.0/15.0, 0.0,
0.0, 0.0, 4.0/15.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -385,7 +385,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {radius, 0.0, 0.0,
0.0, radius, 0.0,
0.0, 0.0, radius};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT volume = 4/3.0 * radius*t.squared_radius();
CGAL_assertion(volume != 0.0);
@ -451,7 +451,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {4.0/3.0, 0.0, 0.0,
0.0, 4.0/3.0, 0.0,
0.0, 0.0, 4.0/3.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -467,7 +467,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {radius, 0.0, 0.0,
0.0, radius, 0.0,
0.0, 0.0, radius};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT area = 4 * t.squared_radius();
CGAL_assertion(area != 0.0);
@ -534,7 +534,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {1.0/60.0, 1.0/120.0, 1.0/120.0,
1.0/120.0, 1.0/60.0, 1.0/120.0,
1.0/120.0, 1.0/120.0, 1.0/60.0};
Matrix moment = init_Matrix<K>(3,temp);
Matrix moment = init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -553,7 +553,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {t[1].x()-x0, t[2].x()-x0, t[3].x()-x0,
t[1].y()-y0, t[2].y()-y0, t[3].y()-y0,
t[1].z()-z0, t[2].z()-z0, t[3].z()-z0};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT volume = t.volume();
CGAL_assertion(volume != 0.0);
@ -620,7 +620,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT temp[9] = {1.0, 0.5, 0.0,
0.5, 1.0, 0.0,
0.0, 0.0, 0.0};
Matrix moment = 1.0/3.0 * init_Matrix<K>(3,temp);
Matrix moment = 1.0/3.0 * init_matrix<K>(3,temp);
for(InputIterator it = first;
it != beyond;
@ -635,7 +635,7 @@ assemble_covariance_matrix_3(InputIterator first,
FT delta[9] = {t[0].x(), t[1].x(), 0.0,
t[0].y(), t[1].y(), 0.0,
t[0].z(), t[1].z(), 1.0};
Matrix transformation = init_Matrix<K>(3,delta);
Matrix transformation = init_matrix<K>(3,delta);
FT length = std::sqrt(t.squared_length());
CGAL_assertion(length != 0.0);

View File

@ -40,77 +40,42 @@ CGAL_BEGIN_NAMESPACE
// complete set of parameters
template < typename InputIterator,
typename Object,
typename K,
typename Kernel,
typename Tag >
inline
typename K::FT
typename Kernel::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename Object& object, // plane or line
typename K::Point_3& centroid,
const K& kernel,
const Tag& tag)
typename Object& object, // plane or line (result)
typename Kernel::Point_3& centroid,
const Tag& tag,
const Kernel& kernel)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
return CGALi::linear_least_squares_fitting_3(first, beyond, object,
centroid, (Value_type*) NULL, kernel, tag);
}
// default tag (dimension of fitted objects, ie 1 for segments, 2 for triangles, 3 for tets, etc.)
template < typename InputIterator,
typename Object,
typename K >
inline
typename K::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename Object& object, // plane or line
typename K::Point_3& centroid,
const K& kernel)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
return CGALi::linear_least_squares_fitting_3(first, beyond, object,
centroid, (Value_type*) NULL, kernel);
}
// omits centroid
template < typename InputIterator,
typename Object,
typename K,
typename Tag >
inline
typename K::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
Object& object,
const K& kernel,
const Tag& tag)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
typename K::Point_3 centroid; // unused by caller
return CGALi::linear_least_squares_fitting_3(first, beyond, object,
centroid, (Value_type*) NULL, kernel, tag);
}
// deduces kernel from value type of input iterator
template < typename InputIterator,
typename Object,
typename Point,
typename Tag>
inline
typename Kernel_traits<Object>::Kernel::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
Object& object,
typename Kernel_traits<Object>::Kernel::Point_3& centroid,
Point& centroid,
const Tag& tag)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
typedef typename Kernel_traits<Value_type>::Kernel K;
return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,(Value_type*) NULL,K(),tag);
typedef typename Kernel_traits<Value_type>::Kernel Kernel;
return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag,Kernel());
}
// does not return the centroid and deduces kernel
// does not writes centroid and deduces kernel
template < typename InputIterator,
typename Object,
typename Tag>
@ -122,9 +87,9 @@ linear_least_squares_fitting_3(InputIterator first,
const Tag& tag)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
typedef typename Kernel_traits<Value_type>::Kernel K;
typename K::Point_3 centroid; // unused by caller
return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,K(),tag);
typedef typename Kernel_traits<Value_type>::Kernel Kernel;
typename Kernel::Point_3 centroid; // unused by caller
return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,tag);
}
// does not return the centroid, deduces kernel, and default tag
@ -139,8 +104,8 @@ linear_least_squares_fitting_3(InputIterator first,
Object& object)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
typedef typename Kernel_traits<Value_type>::Kernel K;
typename K::Point_3 centroid; // unused by caller
typedef typename Kernel_traits<Value_type>::Kernel Kernel;
typename Kernel::Point_3 centroid; // unused by caller
return CGAL::linear_least_squares_fitting_3(first,beyond,object,centroid,(Value_type *)NULL,K());
}*/
@ -176,7 +141,48 @@ linear_least_squares_fitting_3(InputIterator first,
}
// BOOST_STATIC_ASSERT((boost::is_same<typename CGAL::Algebraic_structure_traits<Value_type>::Algebraic_category,CGAL::Field_with_sqrt_tag>::value));
*/
// default tag (dimension of fitted objects, ie 1 for segments, 2 for triangles, 3 for tets, etc.)
template < typename InputIterator,
typename Object,
typename Kernel >
inline
typename Kernel::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename Object& object, // plane or line
typename Kernel::Point_3& centroid,
const Kernel& kernel)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
return CGALi::linear_least_squares_fitting_3(first, beyond, object,
centroid, (Value_type*) NULL, kernel);
}
// omits centroid
template < typename InputIterator,
typename Object,
typename Kernel,
typename Tag >
inline
typename Kernel::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
Object& object,
const Kernel& kernel,
const Tag& tag)
{
typedef typename std::iterator_traits<InputIterator>::value_type Value_type;
typename Kernel::Point_3 centroid; // unused by caller
return CGALi::linear_least_squares_fitting_3(first, beyond, object,
centroid, (Value_type*) NULL, kernel, tag);
}
*/
CGAL_END_NAMESPACE

View File

@ -41,8 +41,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Point_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag = CGAL::PCA_dimension_0_tag())
{
typedef typename K::FT FT;
@ -75,8 +75,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Point_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag = CGAL::PCA_dimension_0_tag)
{
typedef typename K::FT FT;

View File

@ -39,9 +39,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Segment_3*, // used for indirection
const CGAL::PCA_dimension_1_tag& tag = CGAL::PCA_dimension_1_tag())
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Segment_3 Segment;
@ -69,8 +69,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const typename K::Segment_3*, // used for indirection
const K& k, // kernel
const typename K::Segment_3*, // used for indirection
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;
@ -101,11 +101,11 @@ template < typename InputIterator,
typename K::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const typename K::Segment_3*, // used for indirection
const CGAL::PCA_dimension_1_tag& tag = CGAL::PCA_dimension_1_tag())
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Segment_3 Segment;
@ -131,10 +131,10 @@ template < typename InputIterator,
typename K::FT
linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const typename K::Segment_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;

View File

@ -39,9 +39,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Sphere_3*, // used for indirection
const CGAL::PCA_dimension_3_tag& tag = CGAL::PCA_dimension_3_tag())
const K& k, // kernel
const CGAL::PCA_dimension_3_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Sphere_3 Sphere;
@ -69,8 +69,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Sphere_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;
@ -100,9 +100,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Sphere_3*, // used for indirection
const CGAL::PCA_dimension_3_tag& tag = CGAL::PCA_dimension_3_tag())
const K& k, // kernel
const CGAL::PCA_dimension_3_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Sphere_3 Sphere;
@ -131,8 +131,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Sphere_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;

View File

@ -39,9 +39,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_3_tag& tag = CGAL::PCA_dimension_3_tag())
const K& k, // kernel
const CGAL::PCA_dimension_3_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -70,8 +70,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;
@ -106,9 +106,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_1_tag& tag)
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -144,9 +144,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_0_tag& tag)
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -180,9 +180,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_3_tag& tag = CGAL::PCA_dimension_3_tag())
const K& k, // kernel
const CGAL::PCA_dimension_3_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -210,9 +210,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_2_tag& tag)
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -246,9 +246,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_1_tag& tag)
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;
@ -284,9 +284,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Tetrahedron_3*, // used for indirection
const CGAL::PCA_dimension_0_tag& tag)
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Tetrahedron_3 Tetrahedron;

View File

@ -39,9 +39,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const CGAL::PCA_dimension_2_tag& tag = CGAL::PCA_dimension_2_tag())
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Triangle_3 Triangle;
@ -69,8 +69,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
@ -104,8 +104,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Plane_3& plane, // best fit plane
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;
@ -139,9 +139,9 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const CGAL::PCA_dimension_2_tag& tag = CGAL::PCA_dimension_2_tag())
const K& k, // kernel
const CGAL::PCA_dimension_2_tag& tag)
{
typedef typename K::FT FT;
typedef typename K::Triangle_3 Triangle;
@ -169,8 +169,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_1_tag& tag)
{
typedef typename K::FT FT;
@ -204,8 +204,8 @@ linear_least_squares_fitting_3(InputIterator first,
InputIterator beyond,
typename K::Line_3& line, // best fit line
typename K::Point_3& c, // centroid
const K& k, // kernel
const typename K::Triangle_3*, // used for indirection
const K& k, // kernel
const CGAL::PCA_dimension_0_tag& tag)
{
typedef typename K::FT FT;