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
9137500d
There was an error fetching the commit references. Please try again later.
Commit
9137500d
authored
3 years ago
by
Daniel Schramm
Browse files
Options
Downloads
Patches
Plain Diff
Constructor adapted to accept set of feature point types
parent
cb4bb77b
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/visitors/face/HausdorffDistancePrioritized.java
+45
-30
45 additions, 30 deletions
...s/analyst/visitors/face/HausdorffDistancePrioritized.java
with
45 additions
and
30 deletions
Comparison/src/main/java/cz/fidentis/analyst/visitors/face/HausdorffDistancePrioritized.java
+
45
−
30
View file @
9137500d
...
@@ -41,7 +41,7 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -41,7 +41,7 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
private
final
HausdorffDistance
distanceVisitor
;
private
final
HausdorffDistance
distanceVisitor
;
private
final
FeaturePointType
featurePointType
;
private
final
Set
<
FeaturePointType
>
featurePointType
s
;
private
final
Map
<
MeshFacet
,
List
<
Double
>>
priorities
=
new
HashMap
<>();
private
final
Map
<
MeshFacet
,
List
<
Double
>>
priorities
=
new
HashMap
<>();
...
@@ -50,7 +50,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -50,7 +50,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
*
*
* @param mainFacets Facets to which distance from the visited human face's facets is to be computed.
* @param mainFacets Facets to which distance from the visited human face's facets is to be computed.
* Must not be {@code null}.
* Must not be {@code null}.
* @param featurePoint Feature point according to which the Hausdorff distances will be prioritized
* @param featurePoints Feature points according to which the Hausdorff distances will be prioritized.
* Must not be {@code null}.
* @param strategy Strategy of the computation of distance
* @param strategy Strategy of the computation of distance
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* to the normal vectors of source facets (normal vectors have to present),
* to the normal vectors of source facets (normal vectors have to present),
...
@@ -58,16 +59,20 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -58,16 +59,20 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @throws IllegalArgumentException if some parameter is wrong
* @throws IllegalArgumentException if some parameter is wrong
*/
*/
public
HausdorffDistancePrioritized
(
Set
<
MeshFacet
>
mainFacets
,
FeaturePointType
featurePoint
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
public
HausdorffDistancePrioritized
(
Set
<
MeshFacet
>
mainFacets
,
Set
<
FeaturePointType
>
featurePoint
s
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
distanceVisitor
=
new
HausdorffDistance
(
mainFacets
,
strategy
,
relativeDistance
,
parallel
);
distanceVisitor
=
new
HausdorffDistance
(
mainFacets
,
strategy
,
relativeDistance
,
parallel
);
featurePointType
=
featurePoint
;
if
(
featurePoints
==
null
)
{
throw
new
IllegalArgumentException
(
"featurePoints"
);
}
featurePointTypes
=
featurePoints
;
}
}
/**
/**
* Constructor.
* Constructor.
*
*
* @param mainFacet Primary facet to which distance from the visited human face's facets is to be computed. Must not be {@code null}.
* @param mainFacet Primary facet to which distance from the visited human face's facets is to be computed. Must not be {@code null}.
* @param featurePoint Feature point according to which the Hausdorff distances will be prioritized
* @param featurePoints Feature points according to which the Hausdorff distances will be prioritized.
* Must not be {@code null}.
* @param strategy Strategy of the computation of distance
* @param strategy Strategy of the computation of distance
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* to the normal vectors of source facets (normal vectors have to present),
* to the normal vectors of source facets (normal vectors have to present),
...
@@ -75,8 +80,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -75,8 +80,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @throws IllegalArgumentException if some parameter is wrong
* @throws IllegalArgumentException if some parameter is wrong
*/
*/
public
HausdorffDistancePrioritized
(
MeshFacet
mainFacet
,
FeaturePointType
featurePoint
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
public
HausdorffDistancePrioritized
(
MeshFacet
mainFacet
,
Set
<
FeaturePointType
>
featurePoint
s
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
this
(
new
HashSet
<>(
Collections
.
singleton
(
mainFacet
)),
featurePoint
,
strategy
,
relativeDistance
,
parallel
);
this
(
new
HashSet
<>(
Collections
.
singleton
(
mainFacet
)),
featurePoint
s
,
strategy
,
relativeDistance
,
parallel
);
}
}
/**
/**
...
@@ -84,7 +89,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -84,7 +89,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
*
*
* @param mainModel The mesh model with primary facets to which distance from the visited human face's facets is to be computed.
* @param mainModel The mesh model with primary facets to which distance from the visited human face's facets is to be computed.
* Must not be {@code null} or empty.
* Must not be {@code null} or empty.
* @param featurePoint Feature point according to which the Hausdorff distances will be prioritized
* @param featurePoints Feature points according to which the Hausdorff distances will be prioritized.
* Must not be {@code null}.
* @param strategy Strategy of the computation of distance
* @param strategy Strategy of the computation of distance
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* to the normal vectors of source facets (normal vectors have to present),
* to the normal vectors of source facets (normal vectors have to present),
...
@@ -92,15 +98,16 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -92,15 +98,16 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @throws IllegalArgumentException if some parameter is wrong
* @throws IllegalArgumentException if some parameter is wrong
*/
*/
public
HausdorffDistancePrioritized
(
MeshModel
mainModel
,
FeaturePointType
featurePoint
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
public
HausdorffDistancePrioritized
(
MeshModel
mainModel
,
Set
<
FeaturePointType
>
featurePoint
s
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
this
(
new
HashSet
<>(
mainModel
.
getFacets
()),
featurePoint
,
strategy
,
relativeDistance
,
parallel
);
this
(
new
HashSet
<>(
mainModel
.
getFacets
()),
featurePoint
s
,
strategy
,
relativeDistance
,
parallel
);
}
}
/**
/**
* Constructor.
* Constructor.
*
*
* @param face Human face to which distance from other human faces is to be computed. Must not be {@code null}.
* @param face Human face to which distance from other human faces is to be computed. Must not be {@code null}.
* @param featurePoint Feature point according to which the Hausdorff distances will be prioritized
* @param featurePoints Feature points according to which the Hausdorff distances will be prioritized.
* Must not be {@code null}.
* @param strategy Strategy of the computation of distance
* @param strategy Strategy of the computation of distance
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* to the normal vectors of source facets (normal vectors have to present),
* to the normal vectors of source facets (normal vectors have to present),
...
@@ -108,8 +115,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -108,8 +115,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @throws IllegalArgumentException if some parameter is wrong
* @throws IllegalArgumentException if some parameter is wrong
*/
*/
public
HausdorffDistancePrioritized
(
HumanFace
face
,
FeaturePointType
featurePoint
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
public
HausdorffDistancePrioritized
(
HumanFace
face
,
Set
<
FeaturePointType
>
featurePoint
s
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
this
(
face
.
getMeshModel
(),
featurePoint
,
strategy
,
relativeDistance
,
parallel
);
this
(
face
.
getMeshModel
(),
featurePoint
s
,
strategy
,
relativeDistance
,
parallel
);
}
}
/**
/**
...
@@ -117,7 +124,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -117,7 +124,8 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
*
*
* @param mainKdTree The KD tree to which distance from the visited human face's facets is to be computed.
* @param mainKdTree The KD tree to which distance from the visited human face's facets is to be computed.
* Must not be {@code null}.
* Must not be {@code null}.
* @param featurePoint Feature point according to which the Hausdorff distances will be prioritized
* @param featurePoints Feature points according to which the Hausdorff distances will be prioritized.
* Must not be {@code null}.
* @param strategy Strategy of the computation of distance
* @param strategy Strategy of the computation of distance
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* @param relativeDistance If {@code true}, then the visitor calculates the relative distances with respect
* to the normal vectors of source facets (normal vectors have to present),
* to the normal vectors of source facets (normal vectors have to present),
...
@@ -125,13 +133,16 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -125,13 +133,16 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @param parallel If {@code true}, then the algorithm runs concurrently utilizing all CPU cores
* @throws IllegalArgumentException if some parameter is wrong
* @throws IllegalArgumentException if some parameter is wrong
*/
*/
public
HausdorffDistancePrioritized
(
KdTree
mainKdTree
,
FeaturePointType
featurePoint
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
public
HausdorffDistancePrioritized
(
KdTree
mainKdTree
,
Set
<
FeaturePointType
>
featurePoint
s
,
Strategy
strategy
,
boolean
relativeDistance
,
boolean
parallel
)
{
distanceVisitor
=
new
HausdorffDistance
(
mainKdTree
,
strategy
,
relativeDistance
,
parallel
);
distanceVisitor
=
new
HausdorffDistance
(
mainKdTree
,
strategy
,
relativeDistance
,
parallel
);
featurePointType
=
featurePoint
;
if
(
featurePoints
==
null
)
{
throw
new
IllegalArgumentException
(
"featurePoints"
);
}
featurePointTypes
=
featurePoints
;
}
}
public
FeaturePointType
getFeaturePointType
()
{
public
Set
<
FeaturePointType
>
getFeaturePointType
s
()
{
return
featurePointType
;
return
Collections
.
unmodifiableSet
(
featurePointType
s
)
;
}
}
/**
/**
...
@@ -220,23 +231,27 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
...
@@ -220,23 +231,27 @@ public class HausdorffDistancePrioritized extends HumanFaceVisitor {
@Override
@Override
public
void
visitHumanFace
(
HumanFace
humanFace
)
{
public
void
visitHumanFace
(
HumanFace
humanFace
)
{
humanFace
.
getMeshModel
().
compute
(
distanceVisitor
,
inParallel
());
throw
new
UnsupportedOperationException
();
// TODO TEMPORARY BEGIN
final
FeaturePoint
featurePoint
=
humanFace
.
getFeaturePoints
().
get
(
featurePointType
.
getType
());
// Needs to be updated for multiple feature points
final
PrioritySphere
priorityVisitor
=
new
PrioritySphere
(
featurePoint
.
getPosition
(),
computeSphereRadius
(
humanFace
));
// humanFace.getMeshModel().compute(distanceVisitor, inParallel());
humanFace
.
getMeshModel
().
compute
(
priorityVisitor
,
inParallel
());
//
// final FeaturePoint featurePoint = humanFace.getFeaturePoints().get(featurePointTypes.getType());
synchronized
(
this
)
{
// final PrioritySphere priorityVisitor = new PrioritySphere(featurePoint.getPosition(), computeSphereRadius(humanFace));
// Retrieve results from the visitor's internal structure
// humanFace.getMeshModel().compute(priorityVisitor, inParallel());
priorities
.
putAll
(
priorityVisitor
.
getPriorities
());
//
}
// synchronized(this) {
// // Retrieve results from the visitor's internal structure
// priorities.putAll(priorityVisitor.getPriorities());
// }
// TODO TEMPORARY END
}
}
private
double
computeSphereRadius
(
HumanFace
humanFace
)
{
private
double
computeSphereRadius
(
HumanFace
humanFace
)
{
// TODO TEMPORARY
// TODO TEMPORARY
BEGIN
// Sphere radius needs to be computed dynamically.
// Sphere radius needs to be computed dynamically.
// The best way to compute the right radius should be thought out in more depth.
// The best way to compute the right radius should be thought out in more depth.
return
1
;
return
1
;
// TODO TEMPORARY
// TODO TEMPORARY
END
}
}
}
}
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