RoadElement

Description

sealed class Tinman.Engine.Scenes.Shapes.RoadElement

Derived from

VersionedBase abstract

Describes a single element of a road.

Road elements are specified in road-space, which is defined as follows:

  • The X-axis is the walk distance from RangeD.Start of ICurve.Range or RoadBuilder.CenterLine, i.e. zero represents the start of the road’s center-line and ICurve.Length represents the end of it.

  • The Y-axis depends on the X-coordinate and is always perpendicular to the center-line curve of the road. Positive Y-coordinates are on the right side of the center-line, negative Y-coordinates are on the left side.

Public / Constructors

Line

2 overloads


public static method Line1 → (5)

position in : float64

X-coordinate of the road line center, in road-space.

width in : float64

[>0]
The road line width, along the X-axis of road-space.

length in : float64

[>0]
The length of the road line, along the Y-axis of road-space.

offset opt : float64 = 0

Optional offset along the Y-axis of road-space. If 0, the road line will be centered at the road’s center-line. Otherwise, it will be displaced accordingly.

marking opt : MarkingType = MarkingType.Default

The marking type to use.

returns → RoadElement

The created RoadElement.

Creates a RoadElement object for a road line that is perpendicular to the center-line.


public static method Line2 → (6)

position in : float64

X-coordinate of the road line center, in road-space.

width in : float64

[>0]
The road line width, along the X-axis of road-space.

length in : float64

[>0]
The length of the road line, along the Y-axis of road-space.

stipple in : LineStipple

The stipple pattern to use, where LineStipple.Scale is used to scale from pattern units to road-space. If the stipple pattern length in road-space (i.e. LineStipple.Range minus LineStipple.Last, multiplied with LineStipple.Scale) is not a multiple of length in, the fitting stipple pattern repetitions will be centered at offset opt.

offset opt : float64 = 0

Optional offset along the Y-axis of road-space. If 0, the road line will be centered at the road’s center-line. Otherwise, it will be displaced accordingly.

marking opt : MarkingType = MarkingType.Default

The marking type to use.

returns → RoadElement [ ]

The created RoadElement.

Creates RoadElement objects for a road line that is perpendicular to the center-line and have a stipple pattern.

Pavement


public static method Pavement → (2)

width in : float64

[>0]
The pavement width.

marking opt : MarkingType = MarkingType.Pavement

The marking type to use.

returns → RoadElement

The created RoadElement.

Creates a RoadElement object for the pavement.

Road​Element


public constructor RoadElement → (4)

bounds opt : Box2D = default(Box2D)

Initial value for Bounds.

marking opt : MarkingType = MarkingType.Default

Initial value for Marking.

step opt : Vec2D = default(Vec2D)

Initial value for Step.

repeat opt : Vec2I = default(Vec2I)

Initial value for Repeat.

Creates a new instance of RoadElement.

Stripe

2 overloads


public static method Stripe1 → (3)

width in : float64

[>0]
The stripe width.

offset opt : float64 = 0

[>=0]
The offset of the stripe center from the road’s center-line. If greater than zero, the stripe will be repeated on the other side of the center-line, creating a double-stripe. Otherwise, there will be a single stripe at the center-line.

marking opt : MarkingType = MarkingType.Default

The marking type to use for the stripe.

returns → RoadElement

The created RoadElement object.

Creates a RoadElement object for common road stripes (single or double) that follow the center-line.


public static method Stripe2 → (4)

width in : float64

[>0]
The stripe width.

stipple in : LineStipple

The stipple pattern to use, where LineStipple.Scale is used to scale from pattern units to road-space.

offset opt : float64 = 0

[>=0]
The offset of the stripe center from the road’s center-line. If greater than zero, the stripe will be repeated on the other side of the center-line, creating a double-stripe. Otherwise, there will be a single stripe at the center-line.

marking opt : MarkingType = MarkingType.Default

The marking type to use for the stripe.

returns → RoadElement [ ]

The created RoadElement objects.

Creates RoadElement objects for common road stripes (single or double) that follow the center-line and have a stipple pattern.

Public / Methods

Copy


public method Copy → ()

returns → RoadElement

The copy.

Creates an independent copy of this RoadElement object.

Flip


public method Flip → ()

returns → RoadElement

The resulting road element.

Flips this road element at the Y-axis of road-space.

Move


public method Move → (2)

in : float64

The amount to move along the X-axis of road-space.

opt : float64 = 0

The amount to move along the Y-axis of road-space.

returns → RoadElement

The resulting road element.

Moves this road element along the axes of road-space.

Public / Attributes

Bounds


public attribute Bounds → (get,set)

value : Box2D

The bounds of this road element.

Specifies the bounds of this road element.

The road element bounds, specify an axis-aligned rectangle in road-space. Shape geometry for the road element bounds is generated with ShapeBuilder.Curve.

Defaults to Box2D.Empty.

Marking


public attribute Marking → (get,set)

value : MarkingType

The marking type.

Specifies the marking type to use for this road element.

Defaults to MarkingType.Default.

Repeat


public attribute Repeat → (get,set)

value : Vec2I

The road element bounds repetition count for each axis.

Specifies the number of times the road element bounds (see Bounds) shall be repeated along the X- and Y-axes of road-space.

Per axis, each repetition is offset by Size + Pad, where Size is the size of Bounds along the axis and Pad is the corresponding value of Step.

Defaults to Vec2I.Zero, i.e. shape geometry is only generated for the road element bounds, without repeating it.

Step


public attribute Step → (get,set)

value : Vec2D

The padding between road element bounds repetitions for each axis.

Specifies the X- and Y-coordinate steps between repetitions of the road element bounds.

Defaults to Vec2D.Zero.