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
055ea38a
There was an error fetching the commit references. Please try again later.
Commit
055ea38a
authored
4 years ago
by
Radek Ošlejšek
Browse files
Options
Downloads
Patches
Plain Diff
The weird usage MeshPoints replaced with using Vector3d
parent
aa63e251
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/Plane.java
+29
-24
29 additions, 24 deletions
...son/src/main/java/cz/fidentis/analyst/symmetry/Plane.java
with
29 additions
and
24 deletions
Comparison/src/main/java/cz/fidentis/analyst/symmetry/Plane.java
+
29
−
24
View file @
055ea38a
...
...
@@ -4,12 +4,15 @@ import cz.fidentis.analyst.mesh.core.MeshFacet;
import
cz.fidentis.analyst.mesh.core.MeshFacetImpl
;
import
cz.fidentis.analyst.mesh.core.MeshPoint
;
import
cz.fidentis.analyst.mesh.core.MeshPointImpl
;
import
cz.fidentis.analyst.mesh.core.MeshTriangle
;
import
java.util.List
;
import
javax.vecmath.Vector3d
;
/**
*
* @author Natália Bebjaková
*
* Representation of the plane
* Representation of the
symmetry
plane
*/
public
class
Plane
{
public
double
a
;
...
...
@@ -54,36 +57,38 @@ public class Plane {
* @param scale distance of points given by bounding box
* @return plane represented as mesh
*/
public
static
SymmetryEstimator
createPlaneMesh
(
MeshPoint
centroid
,
MeshPoint
a
,
MeshPoint
b
,
double
scale
)
{
facet
=
new
MeshFacetImpl
();
SymmetryEstimator
planeMesh
=
new
SymmetryEstimator
(
facet
,
Config
.
getDefault
());
MeshPoint
[]
points
=
new
MeshPoint
[
4
];
public
static
SymmetryEstimator
createPlaneMesh
(
Vector3d
centroid
,
Vector3d
a
,
Vector3d
b
,
double
scale
)
{
Vector3d
[]
points
=
new
Vector3d
[
4
];
points
[
0
]
=
centroid
.
subtractPosition
(
a
.
multiplyPosition
(
scale
)).
subtractPosition
(
b
.
multiplyPosition
(
scale
)
);
points
[
1
]
=
centroid
.
subtractPosition
(
a
.
multiplyPosition
(
scale
)).
addPosition
(
b
.
multiplyPosition
(
scale
)
);
points
[
2
]
=
centroid
.
addPosition
(
a
.
multiplyPosition
(
scale
)).
addPosition
(
b
.
multiplyPosition
(
scale
)
)
;
points
[
3
]
=
centroid
.
addPosition
(
a
.
multiplyPosition
(
scale
)).
subtractPosition
(
b
.
multiplyPosition
(
scale
)
)
;
Vector3d
aScaled
=
new
Vector3d
(
a
);
Vector3d
bScaled
=
new
Vector3d
(
b
);
aScaled
.
scale
(
scale
);
bScaled
.
scale
(
scale
);
for
(
MeshPoint
point
:
points
)
{
facet
.
addVertex
(
point
);
}
Triangle
[]
triangles
=
new
Triangle
[
4
];
points
[
0
]
=
new
Vector3d
(
centroid
);
points
[
0
].
sub
(
aScaled
);
points
[
0
].
sub
(
bScaled
);
triangles
[
0
]
=
new
Triangle
(
0
,
1
,
2
);
triangles
[
1
]
=
new
Triangle
(
0
,
2
,
3
);
triangles
[
2
]
=
new
Triangle
(
0
,
2
,
1
);
triangles
[
3
]
=
new
Triangle
(
0
,
3
,
2
);
planeMesh
.
setTriangles
(
triangles
);
points
[
1
]
=
new
Vector3d
(
centroid
);
points
[
1
].
sub
(
aScaled
);
points
[
1
].
add
(
bScaled
);
MeshPoint
[]
normals
=
planeMesh
.
calculateNormals
();
points
[
2
]
=
new
Vector3d
(
centroid
);
points
[
2
].
add
(
aScaled
);
points
[
2
].
add
(
bScaled
);
facet
.
getVertices
().
clear
();
points
[
3
]
=
new
Vector3d
(
centroid
);
points
[
3
].
add
(
aScaled
);
points
[
3
].
sub
(
bScaled
);
for
(
int
i
=
0
;
i
<
points
.
length
;
i
++)
{
facet
.
addVertex
(
new
MeshPointImpl
(
points
[
i
].
getPosition
(),
normals
[
i
].
getPosition
(),
null
));
facet
=
new
MeshFacetImpl
();
for
(
Vector3d
point
:
points
)
{
facet
.
addVertex
(
new
MeshPointImpl
(
point
,
null
,
null
));
}
facet
.
calculateVertexNormals
();
SymmetryEstimator
planeMesh
=
new
SymmetryEstimator
(
facet
,
Config
.
getDefault
());
return
planeMesh
;
}
...
...
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