Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
vadere
vadere
Commits
1da47a91
Commit
1da47a91
authored
Apr 06, 2019
by
Benedikt Zoennchen
Browse files
before changing Rupperts algorithm.
parent
b8da33b0
Changes
83
Hide whitespace changes
Inline
Side-by-side
VadereGui/resources/icons/camera_poly.png
0 → 100644
View file @
1da47a91
43.6 KB
VadereGui/resources/messages.properties
View file @
1da47a91
...
@@ -238,6 +238,7 @@ ProjectView.btnSnapshot.tooltip=Snapshot
...
@@ -238,6 +238,7 @@ ProjectView.btnSnapshot.tooltip=Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG Snapshot
ProjectView.btnSVGSnapshot.tooltip
=
SVG Snapshot
ProjectView.btnSVGSnapshot.tooltip
=
SVG Snapshot
ProjectView.btnTikZSnapshot.tooltip
=
TikZ Snapshot
ProjectView.btnTikZSnapshot.tooltip
=
TikZ Snapshot
ProjectView.btnPolySnapshot.tooltip
=
Poly Snapshot
PostVis.menuFile.title
=
File
PostVis.menuFile.title
=
File
PostVis.menuSettings.title
=
Setting
PostVis.menuSettings.title
=
Setting
PostVis.menuRecentFiles.title
=
Recent Files
PostVis.menuRecentFiles.title
=
Recent Files
...
...
VadereGui/resources/messages_de_DE.properties
View file @
1da47a91
...
@@ -234,6 +234,7 @@ ProjectView.btnSnapshot.tooltip=Snapshot
...
@@ -234,6 +234,7 @@ ProjectView.btnSnapshot.tooltip=Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG-Snapshot
ProjectView.btnPNGSnapshot.tooltip
=
PNG-Snapshot
ProjectView.btnSVGSnapshot.tooltip
=
SVG-Snapshot
ProjectView.btnSVGSnapshot.tooltip
=
SVG-Snapshot
ProjectView.btnTikZSnapshot.tooltip
=
TikZ-Snapshot
ProjectView.btnTikZSnapshot.tooltip
=
TikZ-Snapshot
ProjectView.btnPolySnapshot.tooltip
=
Poly-Snapshot
PostVis.menuFile.title
=
Datei
PostVis.menuFile.title
=
Datei
PostVis.menuSettings.title
=
Einstellungen
PostVis.menuSettings.title
=
Einstellungen
PostVis.menuRecentFiles.title
=
K
\u
00FCrzlich verwendete Dateien
PostVis.menuRecentFiles.title
=
K
\u
00FCrzlich verwendete Dateien
...
...
VadereGui/src/org/vadere/gui/components/control/simulation/ActionGeneratePoly.java
0 → 100644
View file @
1da47a91
package
org.vadere.gui.components.control.simulation
;
import
org.vadere.gui.components.model.DefaultSimulationConfig
;
import
org.vadere.gui.components.model.SimulationModel
;
import
org.vadere.gui.components.utils.Messages
;
import
org.vadere.gui.components.utils.Resources
;
import
org.vadere.gui.components.view.SimulationRenderer
;
import
org.vadere.gui.postvisualization.PostVisualisation
;
import
org.vadere.meshing.utils.io.poly.PolyGenerator
;
import
org.vadere.state.scenario.Obstacle
;
import
org.vadere.util.geometry.shapes.VPolygon
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
org.vadere.util.logging.Logger
;
import
java.awt.event.ActionEvent
;
import
java.awt.geom.Rectangle2D
;
import
java.io.File
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStreamWriter
;
import
java.io.Writer
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.prefs.Preferences
;
import
java.util.stream.Collectors
;
import
javax.swing.*
;
public
class
ActionGeneratePoly
extends
AbstractAction
{
private
static
Logger
logger
=
Logger
.
getLogger
(
ActionGeneratePNG
.
class
);
private
static
Resources
resources
=
Resources
.
getInstance
(
"global"
);
private
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
;
public
ActionGeneratePoly
(
final
String
name
,
Icon
icon
,
final
SimulationRenderer
renderer
,
final
SimulationModel
<?
extends
DefaultSimulationConfig
>
model
)
{
super
(
name
,
icon
);
this
.
model
=
model
;
}
@Override
public
void
actionPerformed
(
final
ActionEvent
e
)
{
JFileChooser
fileChooser
=
new
JFileChooser
(
Preferences
.
userNodeForPackage
(
PostVisualisation
.
class
).
get
(
"SettingsDialog.snapshotDirectory.path"
,
"."
));
Date
todaysDate
=
new
java
.
util
.
Date
();
SimpleDateFormat
formatter
=
new
SimpleDateFormat
(
resources
.
getProperty
(
"SettingsDialog.dataFormat"
));
String
formattedDate
=
formatter
.
format
(
todaysDate
);
File
outputFile
=
new
File
(
Messages
.
getString
(
"FileDialog.filenamePrefix"
)
+
formattedDate
+
".poly"
);
fileChooser
.
setSelectedFile
(
outputFile
);
int
returnVal
=
fileChooser
.
showDialog
(
null
,
"Save"
);
if
(
returnVal
==
JFileChooser
.
APPROVE_OPTION
)
{
outputFile
=
fileChooser
.
getSelectedFile
().
toString
().
endsWith
(
".poly"
)
?
fileChooser
.
getSelectedFile
()
:
new
File
(
fileChooser
.
getSelectedFile
().
toString
()
+
".poly"
);
List
<
Obstacle
>
boundingObstacles
=
model
.
getTopography
().
getBoundaryObstacles
();
Rectangle2D
.
Double
boundWithBorder
=
model
.
getTopography
().
getBounds
();
double
boundWidth
=
model
.
getTopography
().
getBoundingBoxWidth
();
VRectangle
bound
=
new
VRectangle
(
boundWithBorder
.
x
+
boundWidth
,
boundWithBorder
.
y
+
boundWidth
,
boundWithBorder
.
width
-
2
*
boundWidth
,
boundWithBorder
.
height
-
2
*
boundWidth
);
List
<
Obstacle
>
obstacles
=
new
ArrayList
<>(
model
.
getTopography
().
getObstacles
());
obstacles
.
removeAll
(
model
.
getTopography
().
getBoundaryObstacles
());
String
polyString
=
PolyGenerator
.
toPSLG
(
new
VPolygon
(
bound
),
obstacles
.
stream
()
.
map
(
obs
->
obs
.
getShape
())
.
map
(
shape
->
new
VPolygon
(
shape
))
.
collect
(
Collectors
.
toList
()));
try
{
outputFile
.
createNewFile
();
Writer
out
=
new
OutputStreamWriter
(
new
FileOutputStream
(
outputFile
),
"UTF-8"
);
out
.
write
(
polyString
);
out
.
flush
();
logger
.
info
(
"generate new Poly.file: "
+
outputFile
.
getAbsolutePath
());
}
catch
(
IOException
e1
)
{
logger
.
error
(
e1
.
getMessage
());
e1
.
printStackTrace
();
}
}
}
}
VadereGui/src/org/vadere/gui/onlinevisualization/view/OnlineVisualisationWindow.java
View file @
1da47a91
...
@@ -7,6 +7,7 @@ import org.vadere.gui.components.control.IViewportChangeListener;
...
@@ -7,6 +7,7 @@ import org.vadere.gui.components.control.IViewportChangeListener;
import
org.vadere.gui.components.control.JViewportChangeListener
;
import
org.vadere.gui.components.control.JViewportChangeListener
;
import
org.vadere.gui.components.control.PanelResizeListener
;
import
org.vadere.gui.components.control.PanelResizeListener
;
import
org.vadere.gui.components.control.ViewportChangeListener
;
import
org.vadere.gui.components.control.ViewportChangeListener
;
import
org.vadere.gui.components.control.simulation.ActionGeneratePoly
;
import
org.vadere.gui.components.utils.Messages
;
import
org.vadere.gui.components.utils.Messages
;
import
org.vadere.gui.components.utils.Resources
;
import
org.vadere.gui.components.utils.Resources
;
import
org.vadere.gui.components.utils.SwingUtils
;
import
org.vadere.gui.components.utils.SwingUtils
;
...
@@ -174,7 +175,6 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
...
@@ -174,7 +175,6 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
renderer
,
renderer
,
model
);
model
);
ActionGenerateSVG
generateSVG
=
new
ActionGenerateSVG
(
ActionGenerateSVG
generateSVG
=
new
ActionGenerateSVG
(
Messages
.
getString
(
"ProjectView.btnSVGSnapshot.tooltip"
),
Messages
.
getString
(
"ProjectView.btnSVGSnapshot.tooltip"
),
resources
.
getIcon
(
"camera_svg.png"
,
iconWidth
,
iconHeight
),
resources
.
getIcon
(
"camera_svg.png"
,
iconWidth
,
iconHeight
),
...
@@ -187,6 +187,12 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
...
@@ -187,6 +187,12 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
renderer
,
renderer
,
model
);
model
);
ActionGeneratePoly
generatePoly
=
new
ActionGeneratePoly
(
Messages
.
getString
(
"ProjectView.btnPolySnapshot.tooltip"
),
resources
.
getIcon
(
"camera_poly.png"
,
iconWidth
,
iconHeight
),
renderer
,
model
);
ActionShowPotentialField
showPotentialField
=
new
ActionShowPotentialField
(
ActionShowPotentialField
showPotentialField
=
new
ActionShowPotentialField
(
"showPotentialField"
,
"showPotentialField"
,
resources
.
getIcon
(
"potentialField.png"
,
iconWidth
,
iconHeight
),
resources
.
getIcon
(
"potentialField.png"
,
iconWidth
,
iconHeight
),
...
@@ -222,6 +228,7 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
...
@@ -222,6 +228,7 @@ public class OnlineVisualisationWindow extends JPanel implements Observer {
imgOptions
.
add
(
generatePNG
);
imgOptions
.
add
(
generatePNG
);
imgOptions
.
add
(
generateSVG
);
imgOptions
.
add
(
generateSVG
);
imgOptions
.
add
(
generateTikz
);
imgOptions
.
add
(
generateTikz
);
imgOptions
.
add
(
generatePoly
);
ActionOnlineVisMenu
imgDialog
=
new
ActionOnlineVisMenu
(
ActionOnlineVisMenu
imgDialog
=
new
ActionOnlineVisMenu
(
"camera_menu"
,
"camera_menu"
,
...
...
VadereGui/src/org/vadere/gui/postvisualization/view/PostvisualizationWindow.java
View file @
1da47a91
...
@@ -8,6 +8,7 @@ import org.vadere.gui.components.control.JViewportChangeListener;
...
@@ -8,6 +8,7 @@ import org.vadere.gui.components.control.JViewportChangeListener;
import
org.vadere.gui.components.control.PanelResizeListener
;
import
org.vadere.gui.components.control.PanelResizeListener
;
import
org.vadere.gui.components.control.ViewportChangeListener
;
import
org.vadere.gui.components.control.ViewportChangeListener
;
import
org.vadere.gui.components.control.simulation.ActionGeneratePNG
;
import
org.vadere.gui.components.control.simulation.ActionGeneratePNG
;
import
org.vadere.gui.components.control.simulation.ActionGeneratePoly
;
import
org.vadere.gui.components.control.simulation.ActionGenerateSVG
;
import
org.vadere.gui.components.control.simulation.ActionGenerateSVG
;
import
org.vadere.gui.components.control.simulation.ActionGenerateTikz
;
import
org.vadere.gui.components.control.simulation.ActionGenerateTikz
;
import
org.vadere.gui.components.control.simulation.ActionSwapSelectionMode
;
import
org.vadere.gui.components.control.simulation.ActionSwapSelectionMode
;
...
@@ -242,11 +243,16 @@ public class PostvisualizationWindow extends JPanel implements Observer {
...
@@ -242,11 +243,16 @@ public class PostvisualizationWindow extends JPanel implements Observer {
renderer
,
model
);
renderer
,
model
);
AbstractAction
tikzImg
=
new
ActionGenerateTikz
(
Messages
.
getString
(
"ProjectView.btnTikZSnapshot.tooltip"
),
resources
.
getIcon
(
"camera_tikz.png"
,
iconWidth
,
iconHeight
),
AbstractAction
tikzImg
=
new
ActionGenerateTikz
(
Messages
.
getString
(
"ProjectView.btnTikZSnapshot.tooltip"
),
resources
.
getIcon
(
"camera_tikz.png"
,
iconWidth
,
iconHeight
),
renderer
,
model
);
renderer
,
model
);
AbstractAction
polyImg
=
new
ActionGeneratePoly
(
Messages
.
getString
(
"ProjectView.btnPolySnapshot.tooltip"
),
resources
.
getIcon
(
"camera_poly.png"
,
iconWidth
,
iconHeight
),
renderer
,
model
);
// add new ImageGenerator Action ...
// add new ImageGenerator Action ...
imgOptions
.
add
(
pngImg
);
imgOptions
.
add
(
pngImg
);
imgOptions
.
add
(
svgImg
);
imgOptions
.
add
(
svgImg
);
imgOptions
.
add
(
tikzImg
);
imgOptions
.
add
(
tikzImg
);
imgOptions
.
add
(
polyImg
);
// add Action to List ....
// add Action to List ....
ActionVisualizationMenu
imgDialog
=
new
ActionVisualizationMenu
(
ActionVisualizationMenu
imgDialog
=
new
ActionVisualizationMenu
(
...
...
VadereMeshing/resources/poly/a.poly
0 → 100644
View file @
1da47a91
# a.poly
#
# The capital letter A
#
# Declare 29 vertices, 2 dimensions, 1 attribute, no boundary markers.
#
29 2 1 0
#
# List the vertices.
#
1 0.200000 -0.776400 -0.57
2 0.220000 -0.773200 -0.55
3 0.245600 -0.756400 -0.51
4 0.277600 -0.702000 -0.53
5 0.488800 -0.207600 0.28
6 0.504800 -0.207600 0.30
7 0.740800 -0.739600 0
8 0.756000 -0.761200 -0.01
9 0.774400 -0.772400 0
10 0.800000 -0.776400 0.02
11 0.800000 -0.792400 0.01
12 0.579200 -0.792400 -0.21
13 0.579200 -0.776400 -0.2
14 0.621600 -0.771600 -0.15
15 0.633600 -0.762800 -0.13
16 0.639200 -0.744400 -0.1
17 0.620800 -0.684400 -0.06
18 0.587200 -0.604400 -0.01
19 0.360800 -0.604400 -0.24
20 0.319200 -0.706800 -0.39
21 0.312000 -0.739600 -0.43
22 0.318400 -0.761200 -0.44
23 0.334400 -0.771600 -0.44
24 0.371200 -0.776400 -0.41
25 0.371200 -0.792400 -0.42
26 0.374400 -0.570000 -0.2
27 0.574400 -0.570000 0
28 0.473600 -0.330800 0.14
29 0.200000 -0.792400 -0.59
#
# Declare the number of segments.
#
29 0
#
# List the segments.
#
1 29 1
2 1 2
3 2 3
4 3 4
5 4 5
6 5 6
7 6 7
8 7 8
9 8 9
10 9 10
11 10 11
12 11 12
13 12 13
14 13 14
15 14 15
16 15 16
17 16 17
18 17 18
19 18 19
20 19 20
21 20 21
22 21 22
23 22 23
24 23 24
25 24 25
26 25 29
27 26 27
28 27 28
29 28 26
#
# Declare the number of holes.
#
1
#
# Define the hole.
#
1 0.47 -0.5
\ No newline at end of file
VadereMeshing/src/org/vadere/meshing/examples/EikMeshExamples.java
View file @
1da47a91
...
@@ -5,6 +5,8 @@ import org.vadere.meshing.mesh.inter.IPointConstructor;
...
@@ -5,6 +5,8 @@ import org.vadere.meshing.mesh.inter.IPointConstructor;
import
org.vadere.meshing.mesh.triangulation.IEdgeLengthFunction
;
import
org.vadere.meshing.mesh.triangulation.IEdgeLengthFunction
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.GenEikMesh
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.GenEikMesh
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.PEikMeshGen
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.PEikMeshGen
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PDelaunayTriangulator
;
import
org.vadere.meshing.utils.io.poly.PolyGenerator
;
import
org.vadere.util.geometry.GeometryUtils
;
import
org.vadere.util.geometry.GeometryUtils
;
import
org.vadere.meshing.mesh.gen.PFace
;
import
org.vadere.meshing.mesh.gen.PFace
;
import
org.vadere.meshing.mesh.gen.PHalfEdge
;
import
org.vadere.meshing.mesh.gen.PHalfEdge
;
...
@@ -21,6 +23,7 @@ import org.vadere.util.math.IDistanceFunction;
...
@@ -21,6 +23,7 @@ import org.vadere.util.math.IDistanceFunction;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Random
;
/**
/**
* Shows a very basic example how {@link GenEikMesh} can be used
* Shows a very basic example how {@link GenEikMesh} can be used
...
@@ -28,14 +31,54 @@ import java.util.List;
...
@@ -28,14 +31,54 @@ import java.util.List;
*/
*/
public
class
EikMeshExamples
{
public
class
EikMeshExamples
{
public
static
void
main
(
String
...
args
)
{
public
static
void
main
(
String
...
args
)
throws
InterruptedException
{
uniformMeshShapes
();
//delaunayTriangulation();
//uniformMeshShapes();
uniformMeshDiscFunction
();
uniformMeshDiscFunction
();
uniformMeshRingFunction
();
//
uniformMeshRingFunction();
combineDistanceFunctions
();
/*
combineDistanceFunctions();
edgeLengthFunction();
edgeLengthFunction();
edgeLengthAndDistanceFunction();
edgeLengthAndDistanceFunction();
userDefinedPoints
();
userDefinedPoints();*/
}
public
static
void
delaunayTriangulation
()
throws
InterruptedException
{
Random
random
=
new
Random
(
0
);
int
width
=
10
;
int
height
=
10
;
int
numberOfPoints
=
200
;
double
linePoints
=
(
int
)
Math
.
sqrt
(
numberOfPoints
)+
5
;
List
<
EikMeshPoint
>
points
=
new
ArrayList
<>();
for
(
double
i
=
0
;
i
<
linePoints
;
i
++)
{
points
.
add
(
new
EikMeshPoint
(
0.1
,
0.1
+
i
/
linePoints
*
(
height
-
0.2
),
true
));
points
.
add
(
new
EikMeshPoint
(
0.1
+
i
/
linePoints
*
(
width
-
0.2
),
0.1
,
true
));
points
.
add
(
new
EikMeshPoint
(
width
-
0.2
,
0.1
+
i
/
linePoints
*
(
height
-
0.2
),
true
));
points
.
add
(
new
EikMeshPoint
(
0.1
+
i
/
linePoints
*
(
width
-
0.2
),
height
-
0.2
,
true
));
}
for
(
int
i
=
0
;
i
<
numberOfPoints
-
15
;
i
++)
{
points
.
add
(
new
EikMeshPoint
(
1.5
+
random
.
nextDouble
()
*
(
width
-
3
),
1.5
+
random
.
nextDouble
()
*
(
height
-
3
)));
}
var
delaunayTriangulator
=
new
PDelaunayTriangulator
<>(
points
,
(
x
,
y
)
->
new
EikMeshPoint
(
x
,
y
,
false
));
var
triangulation
=
delaunayTriangulator
.
generate
();
var
improver
=
new
PEikMeshGen
<>(
p
->
1.0
,
triangulation
);
var
panel
=
new
PMeshPanel
<>(
triangulation
.
getMesh
(),
500
,
500
);
panel
.
display
(
"A square mesh"
);
panel
.
repaint
();
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
Thread
.
sleep
(
5000
);
improver
.
improve
();
panel
.
repaint
();
}
}
}
/**
/**
...
@@ -109,36 +152,48 @@ public class EikMeshExamples {
...
@@ -109,36 +152,48 @@ public class EikMeshExamples {
* The edgeLength is a measure for the approximate edge lengths of all edges since it is a uniform triangulation,
* The edgeLength is a measure for the approximate edge lengths of all edges since it is a uniform triangulation,
* i.e. the desired edge length function is a constant.
* i.e. the desired edge length function is a constant.
*/
*/
public
static
void
uniformMeshDiscFunction
()
{
public
static
void
uniformMeshDiscFunction
()
throws
InterruptedException
{
// define a bounding box
// define a bounding box
VRectangle
bound
=
new
VRectangle
(-
0.1
,
-
0.1
,
2.2
,
2.2
);
VRectangle
bound
=
new
VRectangle
(-
0.1
,
-
0.1
,
2.2
,
2.2
);
// distance function that defines a disc with radius 1 at (1,1).
// distance function that defines a disc with radius 1 at (1,1).
IDistanceFunction
d
=
p
->
Math
.
sqrt
((
p
.
getX
()
-
1
)
*
(
p
.
getX
()
-
1
)
+
(
p
.
getY
()
-
1
)
*
(
p
.
getY
()
-
1
))
-
1.0
;
VPoint
center
=
new
VPoint
(
1
,
1
)
;
//
IDistanceFunction.createDisc(
1, 1
, 1.0);
IDistanceFunction
d
=
IDistanceFunction
.
createDisc
(
center
.
x
,
center
.
y
,
1.0
);
IEdgeLengthFunction
h
=
p
->
1.0
+
5.0
*
Math
.
abs
(
d
.
apply
(
p
));
IEdgeLengthFunction
h
=
p
->
1.0
+
5.0
*
Math
.
abs
(
d
.
apply
(
p
));
// define the EikMesh-Improver
// define the EikMesh-Improver
double
h0
=
0.1
;
double
h0
=
0.1
;
PEikMeshGen
<
EikMeshPoint
,
Double
,
Double
>
meshImprover
=
new
PEikMeshGen
<>(
PEikMeshGen
<
EikMeshPoint
,
Double
,
Double
>
meshImprover
=
new
PEikMeshGen
<>(
d
,
d
,
h
,
p
->
1.0
,
Arrays
.
asList
(
center
),
h0
,
h0
,
bound
,
bound
,
(
x
,
y
)
->
new
EikMeshPoint
(
x
,
y
,
false
));
(
x
,
y
)
->
new
EikMeshPoint
(
x
,
y
,
false
));
meshImprover
.
generate
();
//
meshImprover.generate();
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
//System.out.println(TexGraphGenerator.toTikz(meshImprover.getMesh()));
// (optional) define the gui to display the mesh
// (optional) define the gui to display the mesh
//
PMeshPanel<EikMeshPoint, Double, Double> meshPanel = new PMeshPanel<>(meshImprover.getMesh(), 1000, 800);
PMeshPanel
<
EikMeshPoint
,
Double
,
Double
>
meshPanel
=
new
PMeshPanel
<>(
meshImprover
.
getMesh
(),
1000
,
800
);
// generate the mesh
// generate the mesh
// display the mesh
// display the mesh
//meshPanel.display("Geometry defined by a distance function (disc)");
meshPanel
.
display
(
"Geometry defined by a distance function (disc)"
);
while
(
true
)
{
synchronized
(
meshImprover
.
getMesh
())
{
meshImprover
.
improve
();
}
Thread
.
sleep
(
100
);
meshPanel
.
repaint
();
}
//System.out.println(PolyGenerator.to2DPoly(meshImprover.getMesh()));
}
}
/**
/**
...
@@ -170,6 +225,8 @@ public class EikMeshExamples {
...
@@ -170,6 +225,8 @@ public class EikMeshExamples {
// generate the mesh
// generate the mesh
meshImprover
.
generate
();
meshImprover
.
generate
();
System
.
out
.
println
(
PolyGenerator
.
to2DPoly
(
meshImprover
.
getMesh
()));
// display the mesh
// display the mesh
meshPanel
.
display
(
"Geometry defined by a distance function (ring)"
);
meshPanel
.
display
(
"Geometry defined by a distance function (ring)"
);
}
}
...
...
VadereMeshing/src/org/vadere/meshing/examples/MeshExamples.java
View file @
1da47a91
...
@@ -12,10 +12,11 @@ import org.vadere.meshing.mesh.triangulation.improver.eikmesh.EikMeshPoint;
...
@@ -12,10 +12,11 @@ import org.vadere.meshing.mesh.triangulation.improver.eikmesh.EikMeshPoint;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.GenEikMesh
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.GenEikMesh
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.PEikMeshGen
;
import
org.vadere.meshing.mesh.triangulation.improver.eikmesh.gen.PEikMeshGen
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PContrainedDelaunayTriangulator
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PContrainedDelaunayTriangulator
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.P
DelaunayRefinement
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.P
VoronoiVertexInsertion
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PDelaunayTriangulat
ion
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PDelaunayTriangulat
or
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PDirichletRefinement
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PDirichletRefinement
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PRuppertsTriangulator
;
import
org.vadere.meshing.mesh.triangulation.triangulator.impl.PRuppertsTriangulator
;
import
org.vadere.meshing.utils.io.poly.PolyGenerator
;
import
org.vadere.meshing.utils.io.tex.TexGraphGenerator
;
import
org.vadere.meshing.utils.io.tex.TexGraphGenerator
;
import
org.vadere.util.data.cellgrid.IPotentialPoint
;
import
org.vadere.util.data.cellgrid.IPotentialPoint
;
import
org.vadere.util.data.cellgrid.PathFindingTag
;
import
org.vadere.util.data.cellgrid.PathFindingTag
;
...
@@ -26,26 +27,32 @@ import org.vadere.util.geometry.shapes.VPoint;
...
@@ -26,26 +27,32 @@ import org.vadere.util.geometry.shapes.VPoint;
import
org.vadere.util.geometry.shapes.VPolygon
;
import
org.vadere.util.geometry.shapes.VPolygon
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
org.vadere.util.geometry.shapes.VRectangle
;
import
org.vadere.util.geometry.shapes.VTriangle
;
import
org.vadere.util.geometry.shapes.VTriangle
;
import
org.vadere.util.math.DistanceFunction
;
import
org.vadere.util.math.IDistanceFunction
;
import
org.vadere.util.math.IDistanceFunction
;
import
org.vadere.util.math.InterpolationUtil
;
import
org.vadere.util.math.InterpolationUtil
;
import
java.awt.*
;
import
java.awt.*
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.Collection
;
import
java.util.LinkedList
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Random
;
import
java.util.Random
;
import
java.util.Set
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.function.Function
;
import
java.util.function.Supplier
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
public
class
MeshExamples
{
public
class
MeshExamples
{
public
static
void
main
(
String
...
args
)
throws
InterruptedException
{
public
static
void
main
(
String
...
args
)
throws
InterruptedException
,
IOException
{
dirichletRefinment
();
ruppertsTriangulationPoly
();
delaunayRefinment
();
//delaunayTriangulation();
//dirichletRefinment();
//delaunayRefinment();
//constrainedDelaunayTriangulation();
}
}
public
static
void
faceTest
()
throws
InterruptedException
{
public
static
void
faceTest
()
throws
InterruptedException
{
...
@@ -70,7 +77,7 @@ public class MeshExamples {
...
@@ -70,7 +77,7 @@ public class MeshExamples {
points
.
add
(
newPoint
);
points
.
add
(
newPoint
);
PDelaunayTriangulat
ion
<
VPoint
,
Double
,
Double
>
delaunayTriangulation
=
new
PDelaunayTriangulat
ion
<>(
points
,
(
x
,
y
)
->
new
VPoint
(
x
,
y
));
PDelaunayTriangulat
or
<
VPoint
,
Double
,
Double
>
delaunayTriangulation
=
new
PDelaunayTriangulat
or
<>(
points
,
(
x
,
y
)
->
new
VPoint
(
x
,
y
));
delaunayTriangulation
.
generate
();
delaunayTriangulation
.
generate
();
System
.
out
.
println
(
TexGraphGenerator
.
toTikz
(
delaunayTriangulation
.
getMesh
()));
System
.
out
.
println
(
TexGraphGenerator
.
toTikz
(
delaunayTriangulation
.
getMesh
()));
...
@@ -89,7 +96,7 @@ public class MeshExamples {
...
@@ -89,7 +96,7 @@ public class MeshExamples {
}
}
public
static
void
square
()
{
public
static
void
square
()
{
PMesh
<
VPoint
,
Integer
,
Integer
>
mesh
=
new
PMesh
<>((
x
,
y
)
->
new
VPoint
(
x
,
y
));
var
mesh
=
new
PMesh
<>((
x
,
y
)
->
new
VPoint
(
x
,
y
));
assert
mesh
.
getNumberOfFaces
()
==
0
;
assert
mesh
.
getNumberOfFaces
()
==
0
;
...
@@ -101,7 +108,7 @@ public class MeshExamples {
...
@@ -101,7 +108,7 @@ public class MeshExamples {