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
ed288d46
There was an error fetching the commit references. Please try again later.
Commit
ed288d46
authored
3 years ago
by
Radek Ošlejšek
Browse files
Options
Downloads
Patches
Plain Diff
Minor refactoring
parent
c093fc2c
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
+22
-17
22 additions, 17 deletions
.../java/cz/fidentis/analyst/symmetry/SymmetryEstimator.java
with
22 additions
and
17 deletions
Comparison/src/main/java/cz/fidentis/analyst/symmetry/SymmetryEstimator.java
+
22
−
17
View file @
ed288d46
...
@@ -113,34 +113,38 @@ public class SymmetryEstimator extends MeshVisitor {
...
@@ -113,34 +113,38 @@ public class SymmetryEstimator extends MeshVisitor {
Vector3d
normal
=
symmetryPlane
.
getNormal
();
Vector3d
normal
=
symmetryPlane
.
getNormal
();
Point3d
midPoint
=
bbox
.
getMidPoint
();
Point3d
midPoint
=
bbox
.
getMidPoint
();
double
alpha
=
-((
normal
.
x
*
midPoint
.
x
)
+
double
alpha
=
(
normal
.
y
*
midPoint
.
y
)
+
(
normal
.
z
*
midPoint
.
z
)
+
-((
normal
.
x
*
midPoint
.
x
)
+
symmetryPlane
.
getDistance
())
/
(
normal
.
dot
(
normal
));
(
normal
.
y
*
midPoint
.
y
)
+
(
normal
.
z
*
midPoint
.
z
)
+
symmetryPlane
.
getDistance
())
/
(
normal
.
dot
(
normal
));
Point3d
midPointOnPlane
=
new
Point3d
(
midPoint
);
Point3d
midPointOnPlane
=
new
Point3d
(
midPoint
);
Vector3d
nn
=
new
Vector3d
(
normal
);
Vector3d
nn
=
new
Vector3d
(
normal
);
nn
.
scale
(
alpha
);
nn
.
scale
(
alpha
);
midPointOnPlane
.
add
(
nn
);
midPointOnPlane
.
add
(
nn
);
double
val
=
normal
.
x
*
midPointOnPlane
.
x
+
normal
.
y
*
double
val
=
midPointOnPlane
.
y
+
normal
.
z
*
normal
.
x
*
midPointOnPlane
.
x
+
midPointOnPlane
.
z
+
symmetryPlane
.
getDistance
();
normal
.
y
*
midPointOnPlane
.
y
+
normal
.
z
*
midPointOnPlane
.
z
+
symmetryPlane
.
getDistance
();
Vector3d
a
=
new
Vector3d
();
Vector3d
frontDir
=
new
Vector3d
();
if
(
Math
.
abs
(
normal
.
dot
(
new
Vector3d
(
0.0
,
1.0
,
0.0
)))
>
Math
.
abs
(
normal
.
dot
(
new
Vector3d
(
1.0
,
0.0
,
0.0
))))
{
if
(
Math
.
abs
(
normal
.
dot
(
new
Vector3d
(
0.0
,
1.0
,
0.0
)))
>
Math
.
abs
(
normal
.
dot
(
new
Vector3d
(
1.0
,
0.0
,
0.0
))))
{
a
.
cross
(
normal
,
new
Vector3d
(
1.0
,
0.0
,
0.0
));
frontDir
.
cross
(
normal
,
new
Vector3d
(
1.0
,
0.0
,
0.0
));
}
else
{
}
else
{
a
.
cross
(
normal
,
new
Vector3d
(
0.0
,
1.0
,
0.0
));
frontDir
.
cross
(
normal
,
new
Vector3d
(
0.0
,
1.0
,
0.0
));
}
}
a
.
normalize
();
frontDir
.
normalize
();
Vector3d
b
=
new
Vector3d
();
Vector3d
upDir
=
new
Vector3d
();
b
.
cross
(
normal
,
a
);
upDir
.
cross
(
normal
,
frontDir
);
b
.
normalize
();
upDir
.
normalize
();
double
scale
=
bbox
.
getMaxPoint
().
x
-
bbox
.
getMinPoint
().
x
;
double
scale
=
bbox
.
getMaxPoint
().
x
-
bbox
.
getMinPoint
().
x
;
return
createMeshFacet
(
midPointOnPlane
,
a
,
b
,
symmetryPlane
.
getNormal
(),
scale
);
return
createMeshFacet
(
midPointOnPlane
,
frontDir
,
upDir
,
symmetryPlane
.
getNormal
(),
scale
);
}
}
/**
/**
...
@@ -229,11 +233,12 @@ public class SymmetryEstimator extends MeshVisitor {
...
@@ -229,11 +233,12 @@ public class SymmetryEstimator extends MeshVisitor {
setSymmetryPlane
(
planes
);
setSymmetryPlane
(
planes
);
}
}
protected
static
MeshFacet
createMeshFacet
(
Point3d
centroid
,
Vector3d
a
,
Vector3d
b
,
Vector3d
normal
,
double
scale
)
{
protected
static
MeshFacet
createMeshFacet
(
Point3d
centroid
,
Vector3d
frontDir
,
Vector3d
upDir
,
Vector3d
normal
,
double
scale
)
{
Point3d
[]
points
=
new
Point3d
[
4
];
Point3d
[]
points
=
new
Point3d
[
4
];
Point3d
aScaled
=
new
Point3d
(
a
);
Point3d
aScaled
=
new
Point3d
(
frontDir
);
Point3d
bScaled
=
new
Point3d
(
b
);
Point3d
bScaled
=
new
Point3d
(
upDir
);
aScaled
.
scale
(
scale
);
aScaled
.
scale
(
scale
);
bScaled
.
scale
(
scale
);
bScaled
.
scale
(
scale
);
...
...
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