Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Christian Butz
VTK
Commits
8d5e8e83
Commit
8d5e8e83
authored
Apr 09, 2004
by
Rusty Blue
Browse files
ERR: Negative eigenvalues were not being handled...
parent
dc9b9aec
Changes
1
Show whitespace changes
Inline
Side-by-side
Graphics/vtkQuadricClustering.cxx
View file @
8d5e8e83
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
#include "vtkTimerLog.h"
#include "vtkTimerLog.h"
#include "vtkTriangle.h"
#include "vtkTriangle.h"
vtkCxxRevisionMacro
(
vtkQuadricClustering
,
"1.6
7
"
);
vtkCxxRevisionMacro
(
vtkQuadricClustering
,
"1.6
8
"
);
vtkStandardNewMacro
(
vtkQuadricClustering
);
vtkStandardNewMacro
(
vtkQuadricClustering
);
//----------------------------------------------------------------------------
//----------------------------------------------------------------------------
...
@@ -896,15 +896,15 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
...
@@ -896,15 +896,15 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
// Compute diagonal matrix W
// Compute diagonal matrix W
//
//
#define VTK_SVTHRESHOLD 1.0E-3
#define VTK_SVTHRESHOLD 1.0E-3
double
maxW
=
0.0
;
double
maxW
=
0.0
,
temp
;
vtkMath
::
SingularValueDecomposition3x3
(
A
,
U
,
w
,
VT
);
vtkMath
::
SingularValueDecomposition3x3
(
A
,
U
,
w
,
VT
);
// Find maximum eigenvalue from SVD
// Find maximum
(magnitude)
eigenvalue from SVD
for
(
i
=
0
;
i
<
3
;
i
++
)
for
(
i
=
0
;
i
<
3
;
i
++
)
{
{
if
(
w
[
i
]
>
maxW
)
if
((
temp
=
fabs
(
w
[
i
]
))
>
maxW
)
{
{
maxW
=
w
[
i
]
;
maxW
=
temp
;
}
}
}
}
// Initialize matrix
// Initialize matrix
...
@@ -914,7 +914,7 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
...
@@ -914,7 +914,7 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
{
{
if
(
i
==
j
)
if
(
i
==
j
)
{
{
if
(
(
w
[
i
]
/
maxW
)
>
VTK_SVTHRESHOLD
)
if
(
fabs
(
w
[
i
]
/
maxW
)
>
VTK_SVTHRESHOLD
)
{
{
// If this is true, then w[i] != 0, so this division is ok.
// If this is true, then w[i] != 0, so this division is ok.
W
[
i
][
j
]
=
1.0
/
w
[
i
];
W
[
i
][
j
]
=
1.0
/
w
[
i
];
...
@@ -947,6 +947,7 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
...
@@ -947,6 +947,7 @@ void vtkQuadricClustering::ComputeRepresentativePoint(double quadric[9],
// not, then clamp the point to the center of the bin. Currently "vicinity"
// not, then clamp the point to the center of the bin. Currently "vicinity"
// is defined as BinSize around the center of the bin. It may be desirable
// is defined as BinSize around the center of the bin. It may be desirable
// to increase this to a larger multiple of the bin size.
// to increase this to a larger multiple of the bin size.
point
[
0
]
=
cellCenter
[
0
]
+
tempVector
[
0
];
point
[
0
]
=
cellCenter
[
0
]
+
tempVector
[
0
];
point
[
1
]
=
cellCenter
[
1
]
+
tempVector
[
1
];
point
[
1
]
=
cellCenter
[
1
]
+
tempVector
[
1
];
point
[
2
]
=
cellCenter
[
2
]
+
tempVector
[
2
];
point
[
2
]
=
cellCenter
[
2
]
+
tempVector
[
2
];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment