Package org.opentrafficsim.core.geometry
Class Test
java.lang.Object
org.opentrafficsim.core.geometry.Test
Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Peter Knoppers
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) class
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static boolean
Print detailed output. -
Method Summary
Modifier and TypeMethodDescriptionstatic String
Apply all offset methods and check the results.static boolean
checkOffsetLine
(OtsLine3d referenceLine, double offset, OtsLine3d.OffsetMethod offsetMethod) Check the offsetLine method.static void
static void
test1()
Kink near end of design line.static void
test2()
Kink halfway (far from any endpoint).static void
test3()
Kink plus decreasing width.static void
test4()
Two kinks, (too) close together.static void
test5()
Two-segment design line with minimal change of direction.static void
test6()
Straight design line with some noise (sufficiently far from the end points).static void
test7()
Straight design line with more noise (sufficiently far from the end points).static void
test8()
Straight design line with more noise (close to the end points).static String
timeLimitedCheckOffsetLine
(OtsLine3d reference, double offset, OtsLine3d.OffsetMethod offsetMethod, int timeLimitMillis)
-
Field Details
-
printDetails
static boolean printDetailsPrint detailed output.
-
-
Method Details
-
checkAll
Apply all offset methods and check the results.- Parameters:
reference
- OtsLine3d; reference lineoffset
- double; the offset- Returns:
- int; the number of failures
-
timeLimitedCheckOffsetLine
public static String timeLimitedCheckOffsetLine(OtsLine3d reference, double offset, OtsLine3d.OffsetMethod offsetMethod, int timeLimitMillis) - Parameters:
reference
- OtsLine3d; the reference lineoffset
- double; the offsetoffsetMethod
- OtsLine3d.OffsetMethod; the offset methodtimeLimitMillis
- int; maximum running time in milliseconds- Returns:
- String; empty string on success, description of the result on failure
-
main
- Parameters:
args
- String[]; args- Throws:
NetworkException
- on errorOtsGeometryException
- on error
-
checkOffsetLine
public static boolean checkOffsetLine(OtsLine3d referenceLine, double offset, OtsLine3d.OffsetMethod offsetMethod) Check the offsetLine method.- Parameters:
referenceLine
- OtsLine3d; the reference lineoffset
- double; the offsetoffsetMethod
- OtsLine3d.OffsetMethod; the offset method- Returns:
- boolean; false if the result is obviously wrong; true if the result (appears to be) fine
-
test1
Kink near end of design line.- Throws:
OtsGeometryException
- on error
-
test2
Kink halfway (far from any endpoint).- Throws:
OtsGeometryException
- on error
-
test3
Kink plus decreasing width.- Throws:
OtsGeometryException
- on error
-
test4
Two kinks, (too) close together.- Throws:
OtsGeometryException
- on error
-
test5
Two-segment design line with minimal change of direction.- Throws:
OtsGeometryException
- on error
-
test6
Straight design line with some noise (sufficiently far from the end points).- Throws:
OtsGeometryException
- on error
-
test7
Straight design line with more noise (sufficiently far from the end points).- Throws:
OtsGeometryException
- on error
-
test8
Straight design line with more noise (close to the end points).- Throws:
OtsGeometryException
- on error
-