Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Romin Tomasetti
gmsh
Commits
ac2693ed
Commit
ac2693ed
authored
6 years ago
by
Jean-François Remacle
Browse files
Options
Downloads
Patches
Plain Diff
A
parent
83a308af
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
Geo/discreteFace.cpp
+42
-14
42 additions, 14 deletions
Geo/discreteFace.cpp
with
42 additions
and
14 deletions
Geo/discreteFace.cpp
+
42
−
14
View file @
ac2693ed
...
@@ -104,6 +104,16 @@ GPoint discreteFace::point(double par1, double par2) const
...
@@ -104,6 +104,16 @@ GPoint discreteFace::point(double par1, double par2) const
double
X
=
0
,
Y
=
0
,
Z
=
0
;
double
X
=
0
,
Y
=
0
,
Z
=
0
;
double
eval
[
3
]
=
{
1.
-
uv
[
0
]
-
uv
[
1
],
uv
[
0
],
uv
[
1
]};
double
eval
[
3
]
=
{
1.
-
uv
[
0
]
-
uv
[
1
],
uv
[
0
],
uv
[
1
]};
/* if (position == 1332){
printf("%g %g %g\n",t3d.getVertex(0)->x() ,t3d.getVertex(0)->y() ,t3d.getVertex(0)->z());
printf("%g %g %g\n",t3d.getVertex(1)->x() ,t3d.getVertex(1)->y() ,t3d.getVertex(1)->z());
printf("%g %g %g\n",t3d.getVertex(2)->x() ,t3d.getVertex(2)->y() ,t3d.getVertex(2)->z());
printf("%22.15e %22.15e\n",e->getVertex(0)->x() ,e->getVertex(0)->y());
printf("%22.15e %22.15e\n",e->getVertex(1)->x() ,e->getVertex(1)->y());
printf("%22.15e %22.15e\n",e->getVertex(2)->x() ,e->getVertex(2)->y());
printf("%d %g %g %g %g\n",position, uv[0],uv[1],par1,par2);
}*/
for
(
int
io
=
0
;
io
<
3
;
io
++
)
{
for
(
int
io
=
0
;
io
<
3
;
io
++
)
{
X
+=
t3d
.
getVertex
(
io
)
->
x
()
*
eval
[
io
];
X
+=
t3d
.
getVertex
(
io
)
->
x
()
*
eval
[
io
];
Y
+=
t3d
.
getVertex
(
io
)
->
y
()
*
eval
[
io
];
Y
+=
t3d
.
getVertex
(
io
)
->
y
()
*
eval
[
io
];
...
@@ -174,8 +184,9 @@ GPoint discreteFace::closestPoint(const SPoint3 &queryPoint, double maxDistance,
...
@@ -174,8 +184,9 @@ GPoint discreteFace::closestPoint(const SPoint3 &queryPoint, double maxDistance,
SVector3
*
normal
)
const
SVector3
*
normal
)
const
{
{
#if defined(HAVE_HXT)
#if defined(HAVE_HXT)
int
currentParametrization
=
_parametrizations
.
size
()
==
1
?
0
:
_currentParametrization
;
if
(
_parametrizations
.
empty
())
return
GPoint
();
if
(
_parametrizations
.
empty
())
return
GPoint
();
if
(
_
currentParametrization
==
-
1
)
return
GPoint
();
if
(
currentParametrization
==
-
1
)
return
GPoint
();
dfWrapper
wrapper
(
queryPoint
);
dfWrapper
wrapper
(
queryPoint
);
do
{
do
{
...
@@ -184,7 +195,7 @@ GPoint discreteFace::closestPoint(const SPoint3 &queryPoint, double maxDistance,
...
@@ -184,7 +195,7 @@ GPoint discreteFace::closestPoint(const SPoint3 &queryPoint, double maxDistance,
queryPoint
.
z
()
-
maxDistance
};
queryPoint
.
z
()
-
maxDistance
};
double
MAX
[
3
]
=
{
queryPoint
.
x
()
+
maxDistance
,
queryPoint
.
y
()
+
maxDistance
,
double
MAX
[
3
]
=
{
queryPoint
.
x
()
+
maxDistance
,
queryPoint
.
y
()
+
maxDistance
,
queryPoint
.
z
()
+
maxDistance
};
queryPoint
.
z
()
+
maxDistance
};
_parametrizations
[
_
currentParametrization
].
rtree3d
.
Search
(
_parametrizations
[
currentParametrization
].
rtree3d
.
Search
(
MIN
,
MAX
,
discreteFace_rtree_callback
,
&
wrapper
);
MIN
,
MAX
,
discreteFace_rtree_callback
,
&
wrapper
);
maxDistance
*=
2.0
;
maxDistance
*=
2.0
;
}
while
(
!
wrapper
.
_t3d
);
}
while
(
!
wrapper
.
_t3d
);
...
@@ -271,9 +282,12 @@ double discreteFace::curvatureMax(const SPoint2 ¶m) const
...
@@ -271,9 +282,12 @@ double discreteFace::curvatureMax(const SPoint2 ¶m) const
#if defined(HAVE_HXT)
#if defined(HAVE_HXT)
SVector3
dirMax
,
dirMin
;
SVector3
dirMax
,
dirMin
;
double
c
,
C
;
double
c
,
C
;
if
(
_currentParametrization
==
-
1
)
return
0.0
;
size_t
a
=
_currentParametrization
;
if
(
_parametrizations
[
_currentParametrization
].
CURV
.
empty
())
return
0.0
;
if
(
_parametrizations
.
size
()
==
1
)
a
=
0
;
if
(
a
==
-
1
)
return
0.0
;
if
(
_parametrizations
[
a
].
CURV
.
empty
())
return
0.0
;
curvatures
(
param
,
dirMax
,
dirMin
,
C
,
c
);
curvatures
(
param
,
dirMax
,
dirMin
,
C
,
c
);
// printf("%g %g = %12.5E %12.5E\n",param.x(),param.y(), C, c);
return
std
::
max
(
c
,
C
);
return
std
::
max
(
c
,
C
);
#else
#else
Msg
::
Error
(
"Cannot evaluate curvature on discrete surface without HXT"
);
Msg
::
Error
(
"Cannot evaluate curvature on discrete surface without HXT"
);
...
@@ -287,10 +301,11 @@ double discreteFace::curvatures(const SPoint2 ¶m, SVector3 &dirMax,
...
@@ -287,10 +301,11 @@ double discreteFace::curvatures(const SPoint2 ¶m, SVector3 &dirMax,
{
{
#if defined(HAVE_HXT)
#if defined(HAVE_HXT)
if
(
_parametrizations
.
empty
())
return
0.0
;
if
(
_parametrizations
.
empty
())
return
0.0
;
if
(
_currentParametrization
==
-
1
)
return
0.0
;
int
currentParametrization
=
_parametrizations
.
size
()
==
1
?
0
:
_currentParametrization
;
if
(
_parametrizations
[
_currentParametrization
].
CURV
.
empty
())
return
0.0
;
if
(
currentParametrization
==
-
1
)
return
0.0
;
if
(
_parametrizations
[
currentParametrization
].
CURV
.
empty
())
return
0.0
;
MElement
*
e
=
_parametrizations
[
_
currentParametrization
].
oct
->
find
(
MElement
*
e
=
_parametrizations
[
currentParametrization
].
oct
->
find
(
param
.
x
(),
param
.
y
(),
0.0
);
param
.
x
(),
param
.
y
(),
0.0
);
if
(
!
e
)
{
if
(
!
e
)
{
Msg
::
Warning
(
"Triangle not found for curvatures at uv=(%g,%g) on "
Msg
::
Warning
(
"Triangle not found for curvatures at uv=(%g,%g) on "
...
@@ -300,20 +315,20 @@ double discreteFace::curvatures(const SPoint2 ¶m, SVector3 &dirMax,
...
@@ -300,20 +315,20 @@ double discreteFace::curvatures(const SPoint2 ¶m, SVector3 &dirMax,
}
}
int
position
=
int
position
=
(
int
)((
MTriangle
*
)
e
-
&
_parametrizations
[
_
currentParametrization
].
t2d
[
0
]);
(
int
)((
MTriangle
*
)
e
-
&
_parametrizations
[
currentParametrization
].
t2d
[
0
]);
SVector3
c0max
=
SVector3
c0max
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
0
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
0
];
SVector3
c1max
=
SVector3
c1max
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
1
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
1
];
SVector3
c2max
=
SVector3
c2max
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
2
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
2
];
SVector3
c0min
=
SVector3
c0min
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
3
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
3
];
SVector3
c1min
=
SVector3
c1min
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
4
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
4
];
SVector3
c2min
=
SVector3
c2min
=
_parametrizations
[
_
currentParametrization
].
CURV
[
6
*
position
+
5
];
_parametrizations
[
currentParametrization
].
CURV
[
6
*
position
+
5
];
curvMax
=
c0max
.
norm
();
curvMax
=
c0max
.
norm
();
curvMin
=
c0min
.
norm
();
curvMin
=
c0min
.
norm
();
...
@@ -411,12 +426,21 @@ void discreteFace::createGeometryFromSTL()
...
@@ -411,12 +426,21 @@ void discreteFace::createGeometryFromSTL()
_parametrizations
[
0
].
v2d
.
push_back
(
MVertex
(
stl_vertices_uv
[
i
].
x
(),
stl_vertices_uv
[
i
].
y
(),
0.0
));
_parametrizations
[
0
].
v2d
.
push_back
(
MVertex
(
stl_vertices_uv
[
i
].
x
(),
stl_vertices_uv
[
i
].
y
(),
0.0
));
_parametrizations
[
0
].
v3d
.
push_back
(
MVertex
(
stl_vertices_xyz
[
i
].
x
(),
stl_vertices_xyz
[
i
].
y
(),
stl_vertices_xyz
[
i
].
z
()));
_parametrizations
[
0
].
v3d
.
push_back
(
MVertex
(
stl_vertices_xyz
[
i
].
x
(),
stl_vertices_xyz
[
i
].
y
(),
stl_vertices_xyz
[
i
].
z
()));
}
}
for
(
size_t
i
=
0
;
i
<
stl_triangles
.
size
()
/
3
;
i
++
){
for
(
size_t
i
=
0
;
i
<
stl_triangles
.
size
()
/
3
;
i
++
){
int
a
=
stl_triangles
[
3
*
i
];
int
a
=
stl_triangles
[
3
*
i
];
int
b
=
stl_triangles
[
3
*
i
+
1
];
int
b
=
stl_triangles
[
3
*
i
+
1
];
int
c
=
stl_triangles
[
3
*
i
+
2
];
int
c
=
stl_triangles
[
3
*
i
+
2
];
_parametrizations
[
0
].
t2d
.
push_back
(
MTriangle
(
&
_parametrizations
[
0
].
v2d
[
a
],
&
_parametrizations
[
0
].
v2d
[
b
],
&
_parametrizations
[
0
].
v2d
[
c
]));
_parametrizations
[
0
].
t2d
.
push_back
(
MTriangle
(
&
_parametrizations
[
0
].
v2d
[
a
],
&
_parametrizations
[
0
].
v2d
[
b
],
&
_parametrizations
[
0
].
v2d
[
c
]));
_parametrizations
[
0
].
t3d
.
push_back
(
MTriangle
(
&
_parametrizations
[
0
].
v3d
[
a
],
&
_parametrizations
[
0
].
v3d
[
b
],
&
_parametrizations
[
0
].
v3d
[
c
]));
_parametrizations
[
0
].
t3d
.
push_back
(
MTriangle
(
&
_parametrizations
[
0
].
v3d
[
a
],
&
_parametrizations
[
0
].
v3d
[
b
],
&
_parametrizations
[
0
].
v3d
[
c
]));
if
(
!
stl_curvatures
.
empty
()){
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
a
]);
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
a
+
1
]);
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
b
]);
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
b
+
1
]);
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
c
]);
_parametrizations
[
0
].
CURV
.
push_back
(
stl_curvatures
[
2
*
c
+
1
]);
}
// _parametrizations[0].t3d.push_back(MTriangle(v0,v1,v2));
// _parametrizations[0].t3d.push_back(MTriangle(v0,v1,v2));
// _parametrizations[0].t2d.push_back(MTriangle(vv0,vv1,vv2));
// _parametrizations[0].t2d.push_back(MTriangle(vv0,vv1,vv2));
}
}
...
@@ -1177,6 +1201,10 @@ HXTStatus discreteFace::computsSplitEdgesForPartitionIntoGenusOneSurfaces(
...
@@ -1177,6 +1201,10 @@ HXTStatus discreteFace::computsSplitEdgesForPartitionIntoGenusOneSurfaces(
bool
hxt_reparam_surf
::
checkPlanar
()
bool
hxt_reparam_surf
::
checkPlanar
()
{
{
#ifndef HAVE_LAPACK
return
false
;
#endif
SBoundingBox3d
bb
;
SBoundingBox3d
bb
;
mean_plane
mp
;
mean_plane
mp
;
std
::
vector
<
SPoint3
>
v
,
vp
;
std
::
vector
<
SPoint3
>
v
,
vp
;
...
...
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