Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CityDoctor
CityDoctor2
Commits
67343044
Commit
67343044
authored
Nov 17, 2021
by
Matthias Betz
Browse files
replace copy mechanism
logo now in jar, extracted when needed to temp dir change version to 3.10
parent
3d26f0e9
Pipeline
#5579
failed with stage
in 39 seconds
Changes
62
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorCheckResult/pom.xml
View file @
67343044
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
<version>
3.10.0
-SNAPSHOT
</version>
<version>
3.10.0
</version>
</parent>
<artifactId>
CityDoctorCheckResult
</artifactId>
...
...
CityDoctorParent/CityDoctorEdge/pom.xml
View file @
67343044
...
...
@@ -5,7 +5,7 @@
<parent>
<groupId>
de.hft.stuttgart
</groupId>
<artifactId>
CityDoctorParent
</artifactId>
<version>
3.10.0
-SNAPSHOT
</version>
<version>
3.10.0
</version>
</parent>
<artifactId>
CityDoctorEdge
</artifactId>
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/CDPolygonNs.java
View file @
67343044
...
...
@@ -24,13 +24,15 @@ import java.util.Map;
import
de.hft.stuttgart.citydoctor2.datastructure.LinearRing
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.math.MovedPolygon
;
import
de.hft.stuttgart.citydoctor2.math.MovedRing
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
public
class
CDPolygonNs
extends
PolygonNs
{
private
List
<
List
<
HalfEdge
>>
innerHalfEdges
=
new
ArrayList
<>();
public
static
CDPolygonNs
of
(
Polygon
p
,
Map
<
Ve
rtex
,
Coordinate3d
>
pointMap
)
{
public
static
CDPolygonNs
of
(
Polygon
p
,
Map
<
Ve
ctor3d
,
Coordinate3d
>
pointMap
)
{
List
<
List
<
Coordinate3d
>>
loopCoordinates
=
new
ArrayList
<>();
List
<
Coordinate3d
>
edgeExtRing
=
createCoordinatesFromRing
(
pointMap
,
p
.
getExteriorRing
().
getVertices
());
loopCoordinates
.
add
(
edgeExtRing
);
...
...
@@ -49,6 +51,25 @@ public class CDPolygonNs extends PolygonNs {
return
new
CDPolygonNs
(
halfEdges
,
p
);
}
public
static
CDPolygonNs
of
(
MovedPolygon
mp
,
Map
<
Vector3d
,
Coordinate3d
>
pointMap
)
{
List
<
List
<
Coordinate3d
>>
loopCoordinates
=
new
ArrayList
<>();
List
<
Coordinate3d
>
edgeExtRing
=
createCoordinatesFromRing
(
pointMap
,
mp
.
getExteriorRing
().
getVertices
());
loopCoordinates
.
add
(
edgeExtRing
);
for
(
MovedRing
innerRing
:
mp
.
getInnerRings
())
{
List
<
Coordinate3d
>
edgeInnerRing
=
createCoordinatesFromRing
(
pointMap
,
innerRing
.
getVertices
());
loopCoordinates
.
add
(
edgeInnerRing
);
}
List
<
List
<
HalfEdge
>>
halfEdges
=
new
ArrayList
<>();
for
(
List
<
Coordinate3d
>
ringCoordinates
:
loopCoordinates
)
{
List
<
HalfEdge
>
currHeList
=
createHalfEdgesFromCoordinates
(
ringCoordinates
);
halfEdges
.
add
(
currHeList
);
}
return
new
CDPolygonNs
(
halfEdges
,
mp
.
getOriginal
());
}
private
static
List
<
HalfEdge
>
createHalfEdgesFromCoordinates
(
List
<
Coordinate3d
>
ringCoordinates
)
{
List
<
HalfEdge
>
currHeList
=
new
ArrayList
<>();
HalfEdge
prevHalfEdge
=
null
;
...
...
@@ -75,11 +96,11 @@ public class CDPolygonNs extends PolygonNs {
return
currHeList
;
}
private
static
List
<
Coordinate3d
>
createCoordinatesFromRing
(
Map
<
Ve
rtex
,
Coordinate3d
>
pointMap
,
List
<
Vertex
>
vertices
)
{
private
static
List
<
Coordinate3d
>
createCoordinatesFromRing
(
Map
<
Ve
ctor3d
,
Coordinate3d
>
pointMap
,
List
<
?
extends
Vector3d
>
vertices
)
{
List
<
Coordinate3d
>
edgeRing
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
vertices
.
size
()
-
1
;
i
++)
{
Ve
rtex
v
=
vertices
.
get
(
i
);
Ve
ctor3d
v
=
vertices
.
get
(
i
);
Coordinate3d
c
=
pointMap
.
computeIfAbsent
(
v
,
key
->
new
Coordinate3d
(
key
.
getX
(),
key
.
getY
(),
key
.
getZ
()));
edgeRing
.
add
(
c
);
}
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/DebugUtils.java
View file @
67343044
...
...
@@ -107,6 +107,22 @@ public class DebugUtils {
}
}
}
public
static
void
printGeoknechtPolygon
(
EdgePolygon
...
polys
)
{
Locale
.
setDefault
(
Locale
.
US
);
NumberFormat
nf
=
NumberFormat
.
getNumberInstance
();
nf
.
setMaximumFractionDigits
(
30
);
for
(
EdgePolygon
poly
:
polys
)
{
List
<
Coordinate3d
>
coordinates
=
poly
.
getCoordinates
();
System
.
out
.
print
(
"polygon("
);
for
(
Coordinate3d
coord
:
coordinates
)
{
Point3d
point
=
coord
.
getPoint
();
writeGeoknechtPoint
(
nf
,
point
);
}
writeGeoknechtPoint
(
nf
,
coordinates
.
get
(
0
).
getPoint
());
System
.
out
.
println
(
")"
);
}
}
private
static
void
writeGeoknechtPoint
(
NumberFormat
nf
,
Point3d
point
)
{
System
.
out
.
print
(
nf
.
format
(
point
.
getX
()));
...
...
@@ -167,4 +183,26 @@ public class DebugUtils {
return
coordVarName
;
}
public
static
void
printPolygon3d
(
EdgePolygon
polygon1
,
EdgePolygon
polygon2
)
{
Locale
.
setDefault
(
Locale
.
US
);
Map
<
Point3d
,
String
>
pointMap
=
new
IdentityHashMap
<>();
int
startCounter
=
1
;
startCounter
=
printPolygon3d
(
polygon1
,
pointMap
,
startCounter
);
printPolygon3d
(
polygon2
,
pointMap
,
startCounter
);
}
private
static
int
printPolygon3d
(
EdgePolygon
p
,
Map
<
Point3d
,
String
>
pointMap
,
int
startCounter
)
{
NumberFormat
nf
=
NumberFormat
.
getNumberInstance
();
nf
.
setMaximumFractionDigits
(
30
);
int
counter
=
polygon3dCounter
.
getAndIncrement
();
int
listCounter
=
coordListCounter
.
getAndIncrement
();
int
firstListCounter
=
listCounter
;
HalfEdge
firstHalfEdge
=
p
.
getFirstHalfEdge
();
int
[]
counterArr
=
new
int
[]
{
startCounter
};
System
.
out
.
println
(
"Coordinate3dList coords"
+
firstListCounter
+
";"
);
writeRing
(
pointMap
,
nf
,
listCounter
,
firstHalfEdge
,
counterArr
);
System
.
out
.
println
(
"CDPolygonNs* p"
+
counter
+
" = new CDPolygonNs(coords"
+
firstListCounter
+
");"
);
return
counterArr
[
0
];
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/EdgePolygon.java
View file @
67343044
...
...
@@ -20,7 +20,6 @@ package de.hft.stuttgart.citydoctor2.edge;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Objects
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
...
...
@@ -78,12 +77,15 @@ public class EdgePolygon extends BaseEntity {
public
List
<
Coordinate3d
>
getCoordinates
()
{
List
<
Coordinate3d
>
coords
=
new
ArrayList
<>();
HalfEdge
firstHE
=
Objects
.
requireNonNull
(
getFirstHalfEdge
());
HalfEdge
currHE
=
firstHE
;
do
{
coords
.
add
(
currHE
.
getStart
());
currHE
=
currHE
.
getNext
();
}
while
(
currHE
!=
firstHE
);
for
(
HalfEdge
he
:
halfEdges
)
{
coords
.
add
(
he
.
getStart
());
}
// HalfEdge firstHE = Objects.requireNonNull(getFirstHalfEdge());
// HalfEdge currHE = firstHE;
// do {
// coords.add(currHE.getStart());
// currHE = currHE.getNext();
// } while (currHE != firstHE);
return
coords
;
}
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Global.java
View file @
67343044
...
...
@@ -26,7 +26,7 @@ public class Global {
private
static
double
mZeroAngleCosinus
=
1.0
e
-
9
;
private
static
double
mTolVectorsParallel
=
1
e
-
9
;
private
static
double
mHighAccuracyTol
=
DBL_EPSILON
*
100
;
private
static
double
mHighAccuracyTol
=
DBL_EPSILON
*
5
;
private
static
double
mTolPointsEqual
=
1
e
-
3
;
private
Global
()
{
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/GmPlane.java
View file @
67343044
...
...
@@ -146,5 +146,9 @@ public class GmPlane {
return
new
Polygon2d
(
halfedges
);
}
public
Point3d
getPoint
()
{
return
x0
;
}
}
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/GmStraight2d.java
View file @
67343044
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
GmStraight2d
{
private
Point2d
origin
;
private
UnitVector2d
direction
;
public
GmStraight2d
(
Point2d
org
,
UnitVector2d
dir
)
{
this
.
direction
=
dir
;
this
.
origin
=
org
;
}
public
GmStraight2d
(
Point2d
org
,
Vector2d
dir
)
{
this
.
origin
=
org
;
this
.
direction
=
dir
.
normalize
();
}
public
GmStraight2d
(
Point2d
from
,
Point2d
to
)
{
origin
=
from
;
direction
=
to
.
minus
(
from
).
normalize
();
}
/**
* Just intersects two GmStraights2d.
*
* <br>
* <br>
* If the two straights are parallel the method will return false, so the user
* has to determine, if the straight are just parallel or identical
*
* @param other First Straight
*
* @return intersection result
*/
public
GmStraight2dIntersectionResult
intersect
(
GmStraight2d
other
)
{
Point2d
p1
=
origin
;
UnitVector2d
r1
=
direction
;
Point2d
p2
=
other
.
getOrigin
();
UnitVector2d
r2
=
other
.
getDirection
();
Vector2d
q
=
p2
.
minus
(
p1
);
Vector2d
r2Perpendicular
=
r2
.
getPerpendicularVector
();
double
diff
=
r1
.
dot
(
r2Perpendicular
);
if
(
Math
.
abs
(
diff
)
<
Global
.
getZeroAngleCosinus
())
{
return
GmStraight2dIntersectionResult
.
parallel
(
this
,
other
);
}
else
{
double
invR1DotPerpR2
=
1.0
/
diff
;
double
qDotPerpR1
=
q
.
dot
(
r1
.
getPerpendicularVector
());
double
qDotPerpR2
=
q
.
dot
(
r2Perpendicular
);
double
rParam1
=
qDotPerpR2
*
invR1DotPerpR2
;
double
rParam2
=
qDotPerpR1
*
invR1DotPerpR2
;
return
GmStraight2dIntersectionResult
.
intersecting
(
rParam1
,
rParam2
,
this
,
other
);
}
}
public
UnitVector2d
getDirection
()
{
return
direction
;
}
public
Point2d
getOrigin
()
{
return
origin
;
}
public
Point2d
evaluate
(
double
param
)
{
return
origin
.
plus
(
direction
.
mult
(
param
));
}
@Override
public
String
toString
()
{
return
"GmStraight2d [origin="
+
origin
+
", direction="
+
direction
+
"]"
;
}
}
/*-
* Copyright 2020 Beuth Hochschule für Technik Berlin, Hochschule für Technik Stuttgart
*
* This file is part of CityDoctor2.
*
* CityDoctor2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CityDoctor2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with CityDoctor2. If not, see <https://www.gnu.org/licenses/>.
*/
package
de.hft.stuttgart.citydoctor2.edge
;
public
class
GmStraight2d
{
private
Point2d
origin
;
private
UnitVector2d
direction
;
public
GmStraight2d
(
Point2d
org
,
UnitVector2d
dir
)
{
this
.
direction
=
dir
;
this
.
origin
=
org
;
}
public
GmStraight2d
(
Point2d
org
,
Vector2d
dir
)
{
this
.
origin
=
org
;
this
.
direction
=
dir
.
normalize
();
}
public
GmStraight2d
(
Point2d
from
,
Point2d
to
)
{
origin
=
from
;
direction
=
to
.
minus
(
from
).
normalize
();
}
/**
* Just intersects two GmStraights2d.
*
* <br>
* <br>
* If the two straights are parallel the method will return false, so the user
* has to determine, if the straight are just parallel or identical
*
* @param other First Straight
*
* @return intersection result
*/
public
GmStraight2dIntersectionResult
intersect
(
GmStraight2d
other
)
{
Point2d
p1
=
origin
;
UnitVector2d
r1
=
direction
;
Point2d
p2
=
other
.
getOrigin
();
UnitVector2d
r2
=
other
.
getDirection
();
Vector2d
q
=
p2
.
minus
(
p1
);
Vector2d
r2Perpendicular
=
r2
.
getPerpendicularVector
();
double
diff
=
r1
.
dot
(
r2Perpendicular
);
if
(
Math
.
abs
(
diff
)
<
Global
.
getZeroAngleCosinus
())
{
return
GmStraight2dIntersectionResult
.
parallel
(
this
,
other
);
}
else
{
double
invR1DotPerpR2
=
1.0
/
diff
;
double
qDotPerpR1
=
q
.
dot
(
r1
.
getPerpendicularVector
());
double
qDotPerpR2
=
q
.
dot
(
r2Perpendicular
);
double
rParam1
=
qDotPerpR2
*
invR1DotPerpR2
;
double
rParam2
=
qDotPerpR1
*
invR1DotPerpR2
;
return
GmStraight2dIntersectionResult
.
intersecting
(
rParam1
,
rParam2
,
this
,
other
);
}
}
public
UnitVector2d
getDirection
()
{
return
direction
;
}
public
Point2d
getOrigin
()
{
return
origin
;
}
public
Point2d
evaluate
(
double
param
)
{
return
origin
.
plus
(
direction
.
mult
(
param
));
}
@Override
public
String
toString
()
{
return
"GmStraight2d [origin="
+
origin
+
", direction="
+
direction
+
"]"
;
}
}
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/GmStraight2dIntersectionResult.java
View file @
67343044
...
...
@@ -32,9 +32,9 @@ public class GmStraight2dIntersectionResult {
return
new
GmStraight2dIntersectionResult
(
0
,
0
,
s1
,
s2
,
true
);
}
public
static
GmStraight2dIntersectionResult
intersecting
(
double
rP
aram
1
,
double
rP
aram
2
,
GmStraight2d
s
1
,
GmStraight2d
s
2
)
{
return
new
GmStraight2dIntersectionResult
(
rP
aram
1
,
rParam2
,
s1
,
s2
,
false
);
public
static
GmStraight2dIntersectionResult
intersecting
(
double
p
aram
HE
,
double
p
aram
Int
,
GmStraight2d
s
traightHE
,
GmStraight2d
s
traightInt
)
{
return
new
GmStraight2dIntersectionResult
(
p
aram
HE
,
paramInt
,
straightHE
,
straightInt
,
false
);
}
private
GmStraight2dIntersectionResult
(
double
paramHE
,
double
paramInt
,
GmStraight2d
straightHE
,
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/IntersectPlanarPolygons.java
View file @
67343044
...
...
@@ -118,6 +118,7 @@ public class IntersectPlanarPolygons {
for
(
HalfEdge
he
:
polyHEs
)
{
// only check half edges with partners. NOTE: we are just looking
// for half edges, shared by both polygons!
if
(
he
.
getPartner
()
!=
null
)
{
Point3d
start
=
he
.
getStart
().
getPoint
();
Point3d
end
=
he
.
getEnd
().
getPoint
();
...
...
@@ -154,8 +155,8 @@ public class IntersectPlanarPolygons {
/**
*
* This method checks if the point is a border point of one of the polygons,
* which should be intersected. If this check is successful
l
, the method tries
*
to
find the same point in the other polygon.
* which should be intersected. If this check is successful, the method tries
to
* find the same point in the other polygon.
*
* <br>
* Equality in this case means, both polygons sharing the same instance of
...
...
@@ -193,6 +194,25 @@ public class IntersectPlanarPolygons {
return
bothPolygonsSharingThisPoint
;
}
/**
*
* This method does pretty the same stuff like calculateIntersectionIntervals(),
* with the exception, that the straight and the half edges of the polygon will
* be projected on the plane of the polygon, so the calculation of the
* intersection will be reduced to a 2d problem.
*
* The intersection intervals contains pairs of parameters from the intersection
* straight. If an intersection between the straight and the polygon contains
* only a point, the according interval will contain the same parameter twice
*
* @param p A polygon
*
* @param intersectingStraight The straight, that should be intersected with the
* given polygon
*
* @return rIntersectionIntervals A list parameter intervals, where the straight
* is intersecting the polygon
*/
private
static
List
<
Interval
>
calculateIntersectionIntervals2d
(
EdgePolygon
p
,
EdgePolygon
cpPolygon1
,
EdgePolygon
cpPolygon2
,
GmStraight
intersectingStraight
,
double
epsilon
,
double
angleEpsilon
)
{
List
<
Interval
>
intersectionIntervals
=
new
ArrayList
<>();
...
...
@@ -241,11 +261,11 @@ public class IntersectPlanarPolygons {
}
// The current HalfEdge shares a point with the other polygon and is not
// collinear with the intersection straight. Hence, there is no
w
way, that
// collinear with the intersection straight. Hence, there is no way, that
// this HalfEdge can intersect the other one, because both are planar.
//
if (currHESharesAPntWithTheOtherPolygon) {
//
continue;
//
}
if
(
currHESharesAPntWithTheOtherPolygon
)
{
continue
;
}
// project straight on plane
GmBoundedStraight2d
heStraight2d
=
polyPlane
.
projectOn2dStraight
(
heStraight
);
...
...
@@ -386,8 +406,8 @@ public class IntersectPlanarPolygons {
}
/**
* Util method. Checks if the given parameter has
e been
al
l
ready inserted as
* intersction parameter. If this is true, the parameter will be added as
* Util method. Checks if the given parameter has already
been
inserted as
* inters
e
ction parameter. If this is true, the parameter will be added as
* intersected polygon corner point. Otherwise it's just a normal intersection
* parameter till now.
*
...
...
@@ -401,7 +421,7 @@ public class IntersectPlanarPolygons {
private
static
void
assignParameterToCorrectList
(
double
param
,
TreeSet
<
Double
>
intersectionValues
,
TreeSet
<
Double
>
intersectedPolygonPoints
)
{
if
(!
intersectionValues
.
add
(
param
))
{
// value is al
l
ready present ==> this must be a point of the polygon
// value is already present ==> this must be a point of the polygon
// note, it's assumed, that the polygon do not intersect itself
intersectedPolygonPoints
.
add
(
param
);
}
...
...
@@ -556,7 +576,15 @@ public class IntersectPlanarPolygons {
Polygon2d
poly2d1
=
new
Polygon2dNs
(
poly2dCoords1
,
true
);
Polygon2d
poly2d2
=
new
Polygon2dNs
(
poly2dCoords2
,
true
);
List
<
HalfEdge2d
>
halfEdges
=
poly2d1
.
getHalfEdges
();
for
(
HalfEdge2d
he
:
halfEdges
)
{
if
(
he
.
getPartner
()
==
null
)
{
}
}
halfEdges
=
poly2d2
.
getHalfEdges
();
List
<
PolygonPolygonIntersection
>
result
=
new
ArrayList
<>();
List
<
Polygon2dPolygon2dInt
>
ppi2ds
=
IntersectPolygon2d
.
getIntersections
(
poly2d1
,
poly2d2
,
epsilon
);
for
(
Polygon2dPolygon2dInt
ppi2d
:
ppi2ds
)
{
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/IntersectPolygon2d.java
View file @
67343044
...
...
@@ -233,7 +233,8 @@ public class IntersectPolygon2d {
}
private
static
void
checkForDoubleUsedPoints
(
List
<
PolyLine2d
>
orIntPolyLines
)
{
for
(
PolyLine2d
currPolyLine
:
orIntPolyLines
)
{
for
(
int
i
=
0
;
i
<
orIntPolyLines
.
size
();
i
++)
{
PolyLine2d
currPolyLine
=
orIntPolyLines
.
get
(
i
);
List
<
PolyLineSegment2d
>
segs
=
currPolyLine
.
getSegments
();
if
(
2
==
segs
.
size
())
{
PolyLine2d
newPolyLine
=
new
PolyLine2d
(
segs
.
get
(
0
).
getStart
(),
segs
.
get
(
0
).
getEnd
());
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/MeshSurface.java
View file @
67343044
...
...
@@ -19,13 +19,14 @@
package
de.hft.stuttgart.citydoctor2.edge
;
import
java.util.ArrayList
;
import
java.util.
Identity
HashMap
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
de.hft.stuttgart.citydoctor2.datastructure.Geometry
;
import
de.hft.stuttgart.citydoctor2.datastructure.Polygon
;
import
de.hft.stuttgart.citydoctor2.datastructure.Vertex
;
import
de.hft.stuttgart.citydoctor2.math.MovedPolygon
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
public
class
MeshSurface
{
...
...
@@ -34,19 +35,12 @@ public class MeshSurface {
public
static
MeshSurface
of
(
Geometry
geom
)
{
List
<
CDPolygonNs
>
polygonList
=
new
ArrayList
<>();
Map
<
Vertex
,
Coordinate3d
>
pointMap
=
new
IdentityHashMap
<>();
Map
<
Vector3d
,
Coordinate3d
>
pointMap
=
new
HashMap
<>();
Vector3d
moveBy
=
geom
.
calculateBoundingBox
().
getBox
()[
0
];
for
(
Polygon
p
:
geom
.
getPolygons
())
{
CDPolygonNs
poly
=
CDPolygonNs
.
of
(
p
,
pointMap
);
MovedPolygon
mp
=
MovedPolygon
.
ofPolygon
(
p
,
moveBy
);
CDPolygonNs
poly
=
CDPolygonNs
.
of
(
mp
,
pointMap
);
polygonList
.
add
(
poly
);
// HalfEdge firstHalfEdge = poly.getFirstHalfEdge();
// System.out.println();
// System.out.println(firstHalfEdge.getStart());
// System.out.println(firstHalfEdge.getEnd());
// HalfEdge next = firstHalfEdge.getNext();
// while (next != firstHalfEdge) {
// System.out.println(next.getEnd());
// next = next.getNext();
// }
}
return
new
MeshSurface
(
polygonList
);
}
...
...
CityDoctorParent/CityDoctorEdge/src/main/java/de/hft/stuttgart/citydoctor2/edge/Point3d.java
View file @
67343044
...
...
@@ -81,4 +81,36 @@ public class Point3d {
return
"Point3d [x="
+
x
+
", y="
+
y
+
", z="
+
z
+
"]"
;
}
@Override
public
int
hashCode
()
{
final
int
prime
=
31
;
int
result
=
1
;
long
temp
;
temp
=
Double
.
doubleToLongBits
(
x
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
y
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
temp
=
Double
.
doubleToLongBits
(
z
);
result
=
prime
*
result
+
(
int
)
(
temp
^
(
temp
>>>
32
));
return
result
;
}
@Override
public
boolean
equals
(
Object
obj
)
{
if
(
this
==
obj
)