1 package org.opentrafficsim.road.network.lane;
2
3 import java.io.Serializable;
4
5 import org.djunits.value.vdouble.scalar.Length;
6
7 /**
8 * The CrossSectionSlice provides the width and offset at a relative length of a CrossSectionElement.
9 * <p>
10 * Copyright (c) 2013-2023 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br>
11 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>.
12 * </p>
13 * @author <a href="https://github.com/averbraeck">Alexander Verbraeck</a>
14 * @author <a href="https://tudelft.nl/staff/p.knoppers-1">Peter Knoppers</a>
15 */
16 public class CrossSectionSlice implements Serializable
17 {
18 /** */
19 private static final long serialVersionUID = 20151126L;
20
21 /** The relative position from the start, measured along the design line of the parent link. */
22 private final Length relativeLength;
23
24 /** The lateral offset from the design line of the parentLink at the relative length. */
25 private final Length designLineOffset;
26
27 /** The width, positioned <i>symmetrically around</i> the position at the relative length. */
28 private final Length width;
29
30 /**
31 * Construct a new CrossSectionSlice.
32 * @param relativeLength Length; the relative position from the start, measured along the design line of the parent link
33 * @param designLineOffset Length; the lateral offset from the design line of the parentLink at the relative length
34 * @param width Length; the width, positioned <i>symmetrically around</i> the position at the relative length
35 */
36 public CrossSectionSlice(final Length relativeLength, final Length designLineOffset, final Length width)
37 {
38 this.relativeLength = relativeLength;
39 this.designLineOffset = designLineOffset;
40 this.width = width;
41 }
42
43 /**
44 * Retrieve the relative length.
45 * @return Length; the relativeLength
46 */
47 public final Length getRelativeLength()
48 {
49 return this.relativeLength;
50 }
51
52 /**
53 * Retrieve the design line offset.
54 * @return Length; designLineOffset
55 */
56 public final Length getDesignLineOffset()
57 {
58 return this.designLineOffset;
59 }
60
61 /**
62 * Retrieve the width.
63 * @return Length; the width
64 */
65 public final Length getWidth()
66 {
67 return this.width;
68 }
69
70 /** {@inheritDoc} */
71 @Override
72 public final String toString()
73 {
74 return "CrossSectionSlice [relativeLength=" + this.relativeLength + ", designLineOffset=" + this.designLineOffset
75 + ", width=" + this.width + "]";
76 }
77 }