Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Analyst WebApp
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
fidentis
Analyst WebApp
Commits
6e73b843
There was an error fetching the commit references. Please try again later.
Commit
6e73b843
authored
4 years ago
by
Radek Ošlejšek
Browse files
Options
Downloads
Patches
Plain Diff
Minor refactoring
parent
0097802f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Comparison/src/main/java/cz/fidentis/analyst/symmetry/SymmetryEstimator.java
+40
-29
40 additions, 29 deletions
.../java/cz/fidentis/analyst/symmetry/SymmetryEstimator.java
with
40 additions
and
29 deletions
Comparison/src/main/java/cz/fidentis/analyst/symmetry/SymmetryEstimator.java
+
40
−
29
View file @
6e73b843
...
@@ -107,23 +107,15 @@ public class SymmetryEstimator {
...
@@ -107,23 +107,15 @@ public class SymmetryEstimator {
*/
*/
public
Plane
getApproxSymmetryPlane
(
JPanel
panel
)
{
public
Plane
getApproxSymmetryPlane
(
JPanel
panel
)
{
Array
List
<
ApproxSymmetryPlane
>
planes
=
new
ArrayList
<>();
List
<
ApproxSymmetryPlane
>
planes
=
new
ArrayList
<>();
//List<Vector3d> normals = calculateNormals();
//List<Vector3d> normals = calculateNormals();
if
(!
facet
.
hasVertexNormals
())
{
if
(!
facet
.
hasVertexNormals
())
{
facet
.
calculateVertexNormals
();
facet
.
calculateVertexNormals
();
}
}
double
[]
curvatures
=
new
double
[
facet
.
getNumberOfVertices
()];
for
(
int
i
=
0
;
i
<
facet
.
getNumberOfVertices
();
i
++)
{
double
[]
curvatures
=
initCurvatures
();
if
(
facet
.
getNumberOfVertices
()
==
2500
)
{
List
<
Double
>
sortedCurvatures
=
new
ArrayList
<>();
curvatures
[
i
]
=
this
.
getMaxCurvature
(
i
);
}
else
{
curvatures
[
i
]
=
this
.
getGaussianCurvature
(
i
);
}
if
(
Double
.
isNaN
(
curvatures
[
i
])){
curvatures
[
i
]
=
Double
.
MIN_VALUE
;
}
}
ArrayList
<
Double
>
sortedCurvatures
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
curvatures
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
curvatures
.
length
;
i
++)
{
sortedCurvatures
.
add
(
curvatures
[
i
]);
sortedCurvatures
.
add
(
curvatures
[
i
]);
}
}
...
@@ -134,8 +126,8 @@ public class SymmetryEstimator {
...
@@ -134,8 +126,8 @@ public class SymmetryEstimator {
}
}
double
bottomCurvature
=
sortedCurvatures
.
get
(
sortedCurvatures
.
size
()
-
1
-
config
.
getSignificantPointCount
());
double
bottomCurvature
=
sortedCurvatures
.
get
(
sortedCurvatures
.
size
()
-
1
-
config
.
getSignificantPointCount
());
Array
List
<
Integer
>
significantPoints
=
new
ArrayList
<>();
List
<
Integer
>
significantPoints
=
new
ArrayList
<>();
Array
List
<
Double
>
significantCurvatures
=
new
ArrayList
<>();
List
<
Double
>
significantCurvatures
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
facet
.
getNumberOfVertices
();
i
++)
{
for
(
int
i
=
0
;
i
<
facet
.
getNumberOfVertices
();
i
++)
{
if
(
curvatures
[
i
]
>=
bottomCurvature
)
{
if
(
curvatures
[
i
]
>=
bottomCurvature
)
{
...
@@ -160,8 +152,8 @@ public class SymmetryEstimator {
...
@@ -160,8 +152,8 @@ public class SymmetryEstimator {
if
(
i
!=
j
)
{
if
(
i
!=
j
)
{
double
minRatio
=
config
.
getMinCurvRatio
();
double
minRatio
=
config
.
getMinCurvRatio
();
double
maxRatio
=
1.0
/
minRatio
;
double
maxRatio
=
1.0
/
minRatio
;
if
(
significantCurvatures
.
get
(
i
)
/
significantCurvatures
.
get
(
j
)
>=
minRatio
&&
significantCurvatures
.
get
(
i
)
/
if
(
significantCurvatures
.
get
(
i
)
/
significantCurvatures
.
get
(
j
)
>=
minRatio
&&
significantCurvatures
.
get
(
j
)
<=
maxRatio
)
{
significantCurvatures
.
get
(
i
)
/
significantCurvatures
.
get
(
j
)
<=
maxRatio
)
{
Vector3d
p1
=
new
Vector3d
(
facet
.
getVertex
(
significantPoints
.
get
(
i
)).
getPosition
());
Vector3d
p1
=
new
Vector3d
(
facet
.
getVertex
(
significantPoints
.
get
(
i
)).
getPosition
());
Vector3d
p2
=
new
Vector3d
(
facet
.
getVertex
(
significantPoints
.
get
(
j
)).
getPosition
());
Vector3d
p2
=
new
Vector3d
(
facet
.
getVertex
(
significantPoints
.
get
(
j
)).
getPosition
());
...
@@ -220,6 +212,34 @@ public class SymmetryEstimator {
...
@@ -220,6 +212,34 @@ public class SymmetryEstimator {
finalPlanes
.
add
(
planes
.
get
(
i
));
finalPlanes
.
add
(
planes
.
get
(
i
));
}
}
}
}
Plane
finalPlane
=
computeNewPlane
(
finalPlanes
);
if
(
config
.
isAveraging
()){
plane
=
finalPlane
;
}
if
(
panel
!=
null
)
{
JOptionPane
.
showMessageDialog
(
panel
,
"Symmetry estimate done."
,
"Done"
,
0
,
new
ImageIcon
(
getClass
().
getResource
(
"/cz/fidentis/analyst/gui/resources/exportedModel.png"
)));
progressMonitor
.
close
();
}
return
plane
;
}
private
double
[]
initCurvatures
()
{
double
[]
curvatures
=
new
double
[
facet
.
getNumberOfVertices
()];
for
(
int
i
=
0
;
i
<
facet
.
getNumberOfVertices
();
i
++)
{
if
(
facet
.
getNumberOfVertices
()
==
2500
)
{
curvatures
[
i
]
=
this
.
getMaxCurvature
(
i
);
}
else
{
curvatures
[
i
]
=
this
.
getGaussianCurvature
(
i
);
}
if
(
Double
.
isNaN
(
curvatures
[
i
])){
curvatures
[
i
]
=
Double
.
MIN_VALUE
;
}
}
return
curvatures
;
}
private
Plane
computeNewPlane
(
List
<
ApproxSymmetryPlane
>
finalPlanes
)
{
double
newA
=
0
,
newB
=
0
,
newC
=
0
,
newD
=
0
;
double
newA
=
0
,
newB
=
0
,
newC
=
0
,
newD
=
0
;
Vector3d
refDir
=
finalPlanes
.
get
(
0
).
getNormal
();
Vector3d
refDir
=
finalPlanes
.
get
(
0
).
getNormal
();
for
(
int
i
=
0
;
i
<
finalPlanes
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
finalPlanes
.
size
();
i
++)
{
...
@@ -238,16 +258,7 @@ public class SymmetryEstimator {
...
@@ -238,16 +258,7 @@ public class SymmetryEstimator {
}
}
Plane
finalPlane
=
new
Plane
(
newA
,
newB
,
newC
,
newD
);
Plane
finalPlane
=
new
Plane
(
newA
,
newB
,
newC
,
newD
);
finalPlane
.
normalize
();
finalPlane
.
normalize
();
if
(
config
.
isAveraging
()){
return
finalPlane
;
plane
=
finalPlane
;
}
if
(
panel
!=
null
)
{
JOptionPane
.
showMessageDialog
(
panel
,
"Symmetry estimate done."
,
"Done"
,
0
,
new
ImageIcon
(
getClass
().
getResource
(
"/cz/fidentis/analyst/gui/resources/exportedModel.png"
)));
progressMonitor
.
close
();
}
return
plane
;
}
}
/**
/**
...
@@ -658,8 +669,8 @@ public class SymmetryEstimator {
...
@@ -658,8 +669,8 @@ public class SymmetryEstimator {
* @return total votes given to plane while computing the symmetry
* @return total votes given to plane while computing the symmetry
*/
*/
private
int
getVotes
(
Plane
plane
,
private
int
getVotes
(
Plane
plane
,
Array
List
<
Double
>
curvatures
,
List
<
Double
>
curvatures
,
Array
List
<
Integer
>
points
,
List
<
Integer
>
points
,
double
minCurvRatio
,
double
minCurvRatio
,
double
minAngleCos
,
double
minAngleCos
,
double
minNormAngleCos
,
double
minNormAngleCos
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment