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
1745865f
Commit
1745865f
authored
Aug 08, 2024
by
Riegel
Browse files
Code cleaning Ref
#69
parent
5a6f4b46
Changes
163
Hide whitespace changes
Inline
Side-by-side
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Lod.java
View file @
1745865f
...
@@ -28,7 +28,7 @@ public enum Lod {
...
@@ -28,7 +28,7 @@ public enum Lod {
LOD0
(
0
),
LOD1
(
1
),
LOD2
(
2
),
LOD3
(
3
),
LOD4
(
4
);
LOD0
(
0
),
LOD1
(
1
),
LOD2
(
2
),
LOD3
(
3
),
LOD4
(
4
);
private
int
rank
;
private
final
int
rank
;
private
Lod
(
int
rank
)
{
private
Lod
(
int
rank
)
{
this
.
rank
=
rank
;
this
.
rank
=
rank
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Opening.java
View file @
1745865f
...
@@ -30,6 +30,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
...
@@ -30,6 +30,8 @@ import de.hft.stuttgart.citydoctor2.utils.CityGmlUtils;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.CopyHandler
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
de.hft.stuttgart.citydoctor2.utils.Copyable
;
import
java.io.Serial
;
/**
/**
* Represents an Opening suchs a window or Door in a surface of a feature.
* Represents an Opening suchs a window or Door in a surface of a feature.
* Contains a reference to the boundary surface where this opening is embedded
* Contains a reference to the boundary surface where this opening is embedded
...
@@ -40,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
...
@@ -40,6 +42,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
*/
public
class
Opening
extends
CityObject
{
public
class
Opening
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
6409303152284607944L
;
private
static
final
long
serialVersionUID
=
6409303152284607944L
;
private
BoundarySurface
partOf
;
private
BoundarySurface
partOf
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Polygon.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.List
;
import
java.util.List
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
import
de.hft.stuttgart.citydoctor2.math.Vector3d
;
...
@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.tesselation.TesselatedPolygon;
...
@@ -31,6 +32,7 @@ import de.hft.stuttgart.citydoctor2.tesselation.TesselatedPolygon;
*/
*/
public
abstract
class
Polygon
extends
GmlElement
{
public
abstract
class
Polygon
extends
GmlElement
{
@Serial
private
static
final
long
serialVersionUID
=
-
613942946364706513L
;
private
static
final
long
serialVersionUID
=
-
613942946364706513L
;
public
abstract
Vector3d
calculateNormalNormalized
();
public
abstract
Vector3d
calculateNormalNormalized
();
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/ReliefObject.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -33,11 +34,12 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
...
@@ -33,11 +34,12 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
public
class
ReliefObject
extends
CityObject
{
public
class
ReliefObject
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
-
9162169874426519903L
;
private
static
final
long
serialVersionUID
=
-
9162169874426519903L
;
private
ReliefFeature
feature
;
private
final
ReliefFeature
feature
;
private
List
<
TinObject
>
components
=
new
ArrayList
<>();
private
final
List
<
TinObject
>
components
=
new
ArrayList
<>();
public
ReliefObject
(
ReliefFeature
feature
)
{
public
ReliefObject
(
ReliefFeature
feature
)
{
this
.
feature
=
feature
;
this
.
feature
=
feature
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/SurfaceFeatureType.java
View file @
1745865f
...
@@ -26,6 +26,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
...
@@ -26,6 +26,6 @@ package de.hft.stuttgart.citydoctor2.datastructure;
*/
*/
public
enum
SurfaceFeatureType
{
public
enum
SurfaceFeatureType
{
BUILDING
,
BRIDGE
,
TUNNEL
;
BUILDING
,
BRIDGE
,
TUNNEL
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/TransportationObject.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -46,6 +47,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
...
@@ -46,6 +47,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
*/
public
class
TransportationObject
extends
CityObject
{
public
class
TransportationObject
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
-
2698907271726700390L
;
private
static
final
long
serialVersionUID
=
-
2698907271726700390L
;
public
enum
TransportationType
{
public
enum
TransportationType
{
...
@@ -53,8 +55,8 @@ public class TransportationObject extends CityObject {
...
@@ -53,8 +55,8 @@ public class TransportationObject extends CityObject {
}
}
private
AbstractCityObject
ato
;
private
AbstractCityObject
ato
;
private
List
<
TransportationObject
>
composesOf
=
new
ArrayList
<>(
1
);
private
final
List
<
TransportationObject
>
composesOf
=
new
ArrayList
<>(
1
);
private
TransportationType
type
;
private
final
TransportationType
type
;
public
TransportationObject
(
TransportationType
type
)
{
public
TransportationObject
(
TransportationType
type
)
{
this
.
type
=
type
;
this
.
type
=
type
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vegetation.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.Collections
;
import
java.util.Collections
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
import
org.citygml4j.core.model.core.AbstractCityObject
;
...
@@ -45,6 +46,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
...
@@ -45,6 +46,7 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
*/
public
class
Vegetation
extends
CityObject
{
public
class
Vegetation
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
-
5136358065541704146L
;
private
static
final
long
serialVersionUID
=
-
5136358065541704146L
;
public
enum
VegetationType
{
public
enum
VegetationType
{
...
@@ -52,7 +54,7 @@ public class Vegetation extends CityObject {
...
@@ -52,7 +54,7 @@ public class Vegetation extends CityObject {
}
}
private
AbstractVegetationObject
citygmlVegetation
;
private
AbstractVegetationObject
citygmlVegetation
;
private
VegetationType
type
;
private
final
VegetationType
type
;
public
Vegetation
(
VegetationType
type
)
{
public
Vegetation
(
VegetationType
type
)
{
this
.
type
=
type
;
this
.
type
=
type
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/Vertex.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.List
;
...
@@ -36,6 +37,7 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
...
@@ -36,6 +37,7 @@ import de.hft.stuttgart.citydoctor2.utils.SerializablePair;
*/
*/
public
class
Vertex
extends
Vector3d
implements
Copyable
{
public
class
Vertex
extends
Vector3d
implements
Copyable
{
@Serial
private
static
final
long
serialVersionUID
=
-
5525361920397934892L
;
private
static
final
long
serialVersionUID
=
-
5525361920397934892L
;
private
List
<
SerializablePair
<
Geometry
,
HashSet
<
LinearRing
>>>
adjacentRings
=
new
ArrayList
<>(
2
);
private
List
<
SerializablePair
<
Geometry
,
HashSet
<
LinearRing
>>>
adjacentRings
=
new
ArrayList
<>(
2
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/datastructure/WaterObject.java
View file @
1745865f
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.datastructure
;
package
de.hft.stuttgart.citydoctor2.datastructure
;
import
java.io.Serial
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -41,10 +42,11 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
...
@@ -41,10 +42,11 @@ import de.hft.stuttgart.citydoctor2.utils.Copyable;
*/
*/
public
class
WaterObject
extends
CityObject
{
public
class
WaterObject
extends
CityObject
{
@Serial
private
static
final
long
serialVersionUID
=
-
3821060595086337424L
;
private
static
final
long
serialVersionUID
=
-
3821060595086337424L
;
private
WaterBody
gmlWater
;
private
WaterBody
gmlWater
;
private
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
private
final
List
<
BoundarySurface
>
boundarySurfaceList
=
new
ArrayList
<>();
@Override
@Override
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
public
void
reCreateGeometries
(
GeometryFactory
factory
,
ParserConfiguration
config
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/exceptions/CityDoctorWriteException.java
View file @
1745865f
...
@@ -18,8 +18,11 @@
...
@@ -18,8 +18,11 @@
*/
*/
package
de.hft.stuttgart.citydoctor2.exceptions
;
package
de.hft.stuttgart.citydoctor2.exceptions
;
import
java.io.Serial
;
public
class
CityDoctorWriteException
extends
Exception
{
public
class
CityDoctorWriteException
extends
Exception
{
@Serial
private
static
final
long
serialVersionUID
=
2902212162405599516L
;
private
static
final
long
serialVersionUID
=
2902212162405599516L
;
public
CityDoctorWriteException
()
{
public
CityDoctorWriteException
()
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3FeatureMapper.java
View file @
1745865f
...
@@ -114,14 +114,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
...
@@ -114,14 +114,14 @@ public class Citygml3FeatureMapper extends ObjectWalker {
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Citygml3FeatureMapper
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Citygml3FeatureMapper
.
class
);
private
CityDoctorModel
model
;
private
final
CityDoctorModel
model
;
private
Map
<
String
,
ConcretePolygon
>
polygonMap
=
new
HashMap
<>();
private
Map
<
String
,
ConcretePolygon
>
polygonMap
=
new
HashMap
<>();
private
List
<
ResolvableReference
>
references
=
new
ArrayList
<>();
private
List
<
ResolvableReference
>
references
=
new
ArrayList
<>();
private
Map
<
Vertex
,
Vertex
>
vertexMap
=
new
HashMap
<>();
private
Map
<
Vertex
,
Vertex
>
vertexMap
=
new
HashMap
<>();
private
ParserConfiguration
config
;
private
final
ParserConfiguration
config
;
private
double
neighborDistance
;
private
final
double
neighborDistance
;
public
Citygml3FeatureMapper
(
ParserConfiguration
config
,
Path
path
)
{
public
Citygml3FeatureMapper
(
ParserConfiguration
config
,
Path
path
)
{
this
.
config
=
config
;
this
.
config
=
config
;
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/Citygml3GeometryMapper.java
View file @
1745865f
...
@@ -46,12 +46,12 @@ public class Citygml3GeometryMapper extends GeometryWalker {
...
@@ -46,12 +46,12 @@ public class Citygml3GeometryMapper extends GeometryWalker {
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Citygml3GeometryMapper
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
Citygml3GeometryMapper
.
class
);
private
List
<
ConcretePolygon
>
polygons
=
new
ArrayList
<>();
private
final
List
<
ConcretePolygon
>
polygons
=
new
ArrayList
<>();
private
LinearRing
currentRing
=
null
;
private
LinearRing
currentRing
=
null
;
private
ParserConfiguration
config
;
private
final
ParserConfiguration
config
;
private
ProjCoordinate
p1
=
new
ProjCoordinate
();
private
final
ProjCoordinate
p1
=
new
ProjCoordinate
();
private
ProjCoordinate
p2
=
new
ProjCoordinate
();
private
final
ProjCoordinate
p2
=
new
ProjCoordinate
();
private
Map
<
Vertex
,
Vertex
>
vertexMap
;
private
final
Map
<
Vertex
,
Vertex
>
vertexMap
;
public
Citygml3GeometryMapper
(
ParserConfiguration
config
,
Map
<
Vertex
,
Vertex
>
vertices
)
{
public
Citygml3GeometryMapper
(
ParserConfiguration
config
,
Map
<
Vertex
,
Vertex
>
vertices
)
{
this
.
config
=
config
;
this
.
config
=
config
;
...
@@ -62,7 +62,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
...
@@ -62,7 +62,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
public
void
visit
(
Polygon
polygon
)
{
public
void
visit
(
Polygon
polygon
)
{
parsePolygon
(
polygon
.
getId
(),
polygon
.
getExterior
(),
polygon
.
getInterior
());
parsePolygon
(
polygon
.
getId
(),
polygon
.
getExterior
(),
polygon
.
getInterior
());
if
(
polygon
.
getExterior
()
==
null
)
{
if
(
polygon
.
getExterior
()
==
null
)
{
System
.
out
.
println
(
"No exterior:
"
+
polygon
.
getId
());
logger
.
warn
(
String
.
format
(
"No exterior:
%s"
,
polygon
.
getId
())
)
;
}
}
}
}
...
@@ -132,7 +132,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
...
@@ -132,7 +132,7 @@ public class Citygml3GeometryMapper extends GeometryWalker {
logger
.
warn
(
"The number of coordinates for linear ring {} do not result in fully 3D points"
,
id
);
logger
.
warn
(
"The number of coordinates for linear ring {} do not result in fully 3D points"
,
id
);
}
}
for
(
int
i
=
0
;
i
<
coordinates
.
size
();
i
=
i
+
3
)
{
for
(
int
i
=
0
;
i
<
coordinates
.
size
();
i
=
i
+
3
)
{
double
x
=
coordinates
.
get
(
i
+
0
);
double
x
=
coordinates
.
get
(
i
);
double
y
=
coordinates
.
get
(
i
+
1
);
double
y
=
coordinates
.
get
(
i
+
1
);
double
z
=
coordinates
.
get
(
i
+
2
);
double
z
=
coordinates
.
get
(
i
+
2
);
createVertex
(
x
,
y
,
z
);
createVertex
(
x
,
y
,
z
);
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/GMLValidationHandler.java
View file @
1745865f
...
@@ -29,7 +29,7 @@ import org.xml.sax.SAXParseException;
...
@@ -29,7 +29,7 @@ import org.xml.sax.SAXParseException;
public
class
GMLValidationHandler
implements
ErrorHandler
{
public
class
GMLValidationHandler
implements
ErrorHandler
{
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
GMLValidationHandler
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
GMLValidationHandler
.
class
);
private
List
<
String
>
messages
=
new
ArrayList
<>();
private
final
List
<
String
>
messages
=
new
ArrayList
<>();
@Override
@Override
public
void
error
(
SAXParseException
exception
)
{
public
void
error
(
SAXParseException
exception
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/mapper/citygml3/SurfaceMapper.java
View file @
1745865f
...
@@ -58,11 +58,11 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
...
@@ -58,11 +58,11 @@ import de.hft.stuttgart.citydoctor2.parser.ParserConfiguration;
public
class
SurfaceMapper
extends
ObjectWalker
{
public
class
SurfaceMapper
extends
ObjectWalker
{
private
List
<
BoundarySurface
>
surfaces
=
new
ArrayList
<>();
private
final
List
<
BoundarySurface
>
surfaces
=
new
ArrayList
<>();
private
Map
<
String
,
ConcretePolygon
>
polygonMap
;
private
final
Map
<
String
,
ConcretePolygon
>
polygonMap
;
private
List
<
ResolvableReference
>
references
;
private
final
List
<
ResolvableReference
>
references
;
private
Map
<
Vertex
,
Vertex
>
vertexMap
;
private
final
Map
<
Vertex
,
Vertex
>
vertexMap
;
private
ParserConfiguration
config
;
private
final
ParserConfiguration
config
;
public
SurfaceMapper
(
Map
<
String
,
ConcretePolygon
>
polygonMap
,
List
<
ResolvableReference
>
references
,
public
SurfaceMapper
(
Map
<
String
,
ConcretePolygon
>
polygonMap
,
List
<
ResolvableReference
>
references
,
Map
<
Vertex
,
Vertex
>
vertexMap
,
ParserConfiguration
config
)
{
Map
<
Vertex
,
Vertex
>
vertexMap
,
ParserConfiguration
config
)
{
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/DistanceResult.java
View file @
1745865f
...
@@ -26,9 +26,9 @@ package de.hft.stuttgart.citydoctor2.math;
...
@@ -26,9 +26,9 @@ package de.hft.stuttgart.citydoctor2.math;
*/
*/
public
class
DistanceResult
{
public
class
DistanceResult
{
private
Vector3d
point1
;
private
final
Vector3d
point1
;
private
Vector3d
point2
;
private
final
Vector3d
point2
;
private
double
distance
;
private
final
double
distance
;
public
DistanceResult
(
Vector3d
point1
,
Vector3d
point2
,
double
distance
)
{
public
DistanceResult
(
Vector3d
point1
,
Vector3d
point2
,
double
distance
)
{
super
();
super
();
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/Edge2d.java
View file @
1745865f
...
@@ -29,8 +29,8 @@ public class Edge2d {
...
@@ -29,8 +29,8 @@ public class Edge2d {
private
static
final
double
EPSILON
=
0.0000001
;
private
static
final
double
EPSILON
=
0.0000001
;
private
static
final
double
ONE_MINUS_EPSILON
=
1
-
EPSILON
;
private
static
final
double
ONE_MINUS_EPSILON
=
1
-
EPSILON
;
private
ProjectedVector2d
a
;
private
final
ProjectedVector2d
a
;
private
ProjectedVector2d
b
;
private
final
ProjectedVector2d
b
;
public
Edge2d
(
ProjectedVector2d
a
,
ProjectedVector2d
b
)
{
public
Edge2d
(
ProjectedVector2d
a
,
ProjectedVector2d
b
)
{
this
.
a
=
a
;
this
.
a
=
a
;
...
@@ -150,11 +150,8 @@ public class Edge2d {
...
@@ -150,11 +150,8 @@ public class Edge2d {
}
else
if
(!
a
.
equals
(
other
.
a
))
}
else
if
(!
a
.
equals
(
other
.
a
))
return
false
;
return
false
;
if
(
b
==
null
)
{
if
(
b
==
null
)
{
if
(
other
.
b
!=
null
)
return
other
.
b
==
null
;
return
false
;
}
else
return
b
.
equals
(
other
.
b
);
}
else
if
(!
b
.
equals
(
other
.
b
))
}
return
false
;
return
true
;
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/IntersectionPoint2d.java
View file @
1745865f
...
@@ -20,31 +20,14 @@ package de.hft.stuttgart.citydoctor2.math;
...
@@ -20,31 +20,14 @@ package de.hft.stuttgart.citydoctor2.math;
/**
/**
* Result of an intersection calculation
* Result of an intersection calculation
*
* @author Matthias Betz
*
*
* @author Matthias Betz
*/
*/
public
class
IntersectionPoint2d
{
public
record
IntersectionPoint2d
(
Line2d
line
,
double
scalar
)
{
private
Line2d
line
;
private
double
scalar
;
public
IntersectionPoint2d
(
Line2d
line
,
double
scalar
)
{
super
();
this
.
line
=
line
;
this
.
scalar
=
scalar
;
}
public
Vector2d
getIntersectionPoint
()
{
public
Vector2d
getIntersectionPoint
()
{
return
line
.
getPoint
().
plus
(
line
.
getDirection
().
mult
(
scalar
));
return
line
.
point
().
plus
(
line
.
direction
().
mult
(
scalar
));
}
public
Line2d
getLine
()
{
return
line
;
}
}
public
double
getScalar
()
{
return
scalar
;
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/Line2d.java
View file @
1745865f
...
@@ -24,22 +24,6 @@ package de.hft.stuttgart.citydoctor2.math;
...
@@ -24,22 +24,6 @@ package de.hft.stuttgart.citydoctor2.math;
* @author Matthias Betz
* @author Matthias Betz
*
*
*/
*/
public
class
Line2d
{
public
record
Line2d
(
Vector2d
point
,
Vector2d
direction
)
{
private
Vector2d
p
;
private
Vector2d
dir
;
public
Line2d
(
Vector2d
p
,
Vector2d
dir
)
{
this
.
p
=
p
;
this
.
dir
=
dir
;
}
public
Vector2d
getPoint
()
{
return
p
;
}
public
Vector2d
getDirection
()
{
return
dir
;
}
}
}
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/Line3d.java
View file @
1745865f
...
@@ -20,37 +20,13 @@ package de.hft.stuttgart.citydoctor2.math;
...
@@ -20,37 +20,13 @@ package de.hft.stuttgart.citydoctor2.math;
/**
/**
* A line described by a point and a direction
* A line described by a point and a direction
*
* @author Matthias Betz
*
*
* @author Matthias Betz
*/
*/
public
class
Line3d
{
public
record
Line3d
(
Vector3d
point
,
Vector3d
direction
)
{
public
static
final
double
EPSILON
=
0.00001
;
public
static
final
double
EPSILON
=
0.00001
;
private
Vector3d
point
;
private
Vector3d
direction
;
public
Line3d
(
Vector3d
point
,
Vector3d
direction
)
{
super
();
this
.
point
=
point
;
this
.
direction
=
direction
;
}
/**
* @return the point
*/
public
Vector3d
getPoint
()
{
return
point
;
}
/**
* @return the direction
*/
public
Vector3d
getDirection
()
{
return
direction
;
}
public
double
distanceToPoint
(
Vector3d
v
)
{
public
double
distanceToPoint
(
Vector3d
v
)
{
double
x
=
v
.
getX
()
-
point
.
getX
();
double
x
=
v
.
getX
()
-
point
.
getX
();
double
y
=
v
.
getY
()
-
point
.
getY
();
double
y
=
v
.
getY
()
-
point
.
getY
();
...
...
CityDoctorParent/CityDoctorModel/src/main/java/de/hft/stuttgart/citydoctor2/math/Matrix3x3d.java
View file @
1745865f
...
@@ -28,7 +28,7 @@ import java.util.Arrays;
...
@@ -28,7 +28,7 @@ import java.util.Arrays;
*/
*/
public
class
Matrix3x3d
{
public
class
Matrix3x3d
{
private
double
[][]
values
;
private
final
double
[][]
values
;
/**
/**
* Identity matrix
* Identity matrix
...
@@ -123,10 +123,9 @@ public class Matrix3x3d {
...
@@ -123,10 +123,9 @@ public class Matrix3x3d {
*/
*/
public
Matrix3x3d
transpose
()
{
public
Matrix3x3d
transpose
()
{
Matrix3x3d
x
=
new
Matrix3x3d
();
Matrix3x3d
x
=
new
Matrix3x3d
();
double
[][]
copyValues
=
x
.
values
;
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
i
=
0
;
i
<
3
;
i
++)
{
for
(
int
j
=
0
;
j
<
3
;
j
++)
{
for
(
int
j
=
0
;
j
<
3
;
j
++)
{
copyV
alues
[
j
][
i
]
=
values
[
i
][
j
];
x
.
v
alues
[
j
][
i
]
=
values
[
i
][
j
];
}
}
}
}
return
x
;
return
x
;
...
...
Prev
1
2
3
4
5
6
7
8
9
Next
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment