|
CARLA
|
Road map of the level. More...
#include <RoadMap.h>
Inheritance diagram for URoadMap:Public Member Functions | |
| FRoadMapPixelData | GetDataAt (const FVector &WorldLocation) const |
| Clamps value if lies outside map limits. | |
| FRoadMapPixelData | GetDataAt (uint32 PixelX, uint32 PixelY) const |
| Retrieve the data stored at a given pixel. | |
| uint32 | GetHeight () const |
| uint32 | GetWidth () const |
| FVector | GetWorldLocation (uint32 PixelX, uint32 PixelY) const |
| Return the world location of a given pixel. | |
| FRoadMapIntersectionResult | Intersect (const FTransform &BoxTransform, const FVector &BoxExtent, float ChecksPerCentimeter) const |
| Intersect actor bounds with map. | |
| void | Reset (uint32 Width, uint32 Height, float PixelsPerCentimeter, const FTransform &WorldToMap, const FVector &MapOffset) |
| Resets current map an initializes an empty map of the given size. | |
| bool | SaveAsPNG (const FString &Folder, const FString &MapName) const |
| Save the current map as PNG with the pixel data encoded as color. | |
| void | SetPixelAt (uint32 PixelX, uint32 PixelY, ECityMapMeshTag Tag, const FTransform &Transform, bool bInvertDirection=false) |
| URoadMap (const FObjectInitializer &ObjectInitializer) | |
| Creates a valid empty map (every point is off-road). | |
Private Member Functions | |
| int32 | GetIndex (uint32 PixelX, uint32 PixelY) const |
| bool | IsValid () const |
Private Attributes | |
| uint32 | Height |
| Height of the map in pixels. | |
| FVector | MapOffset |
| Offset of the map in map coordinates. | |
| float | PixelsPerCentimeter |
| Number of pixels per centimeter. | |
| TArray< uint16 > | RoadMapData |
| uint32 | Width |
| Width of the map in pixels. | |
| FTransform | WorldToMap |
| World-to-map transform. | |
Road map of the level.
Contains information in 2D of which areas are road and lane directions.
| URoadMap::URoadMap | ( | const FObjectInitializer & | ObjectInitializer | ) |
Creates a valid empty map (every point is off-road).
Definition at line 71 of file RoadMap.cpp.
References RoadMapData, and FRoadMapPixelData::Value.
| FRoadMapPixelData URoadMap::GetDataAt | ( | const FVector & | WorldLocation | ) | const |
Clamps value if lies outside map limits.
Definition at line 210 of file RoadMap.cpp.
References ClampFloatToUInt(), GetDataAt(), Height, IsValid(), MapOffset, PixelsPerCentimeter, Width, and WorldToMap.
|
inline |
Retrieve the data stored at a given pixel.
Definition at line 132 of file RoadMap.h.
References GetIndex(), IsValid(), and RoadMapData.
Referenced by GetDataAt(), and Intersect().
|
inline |
|
inlineprivate |
Definition at line 165 of file RoadMap.h.
References Width.
Referenced by GetDataAt(), and SetPixelAt().
|
inline |
| FVector URoadMap::GetWorldLocation | ( | uint32 | PixelX, |
| uint32 | PixelY | ||
| ) | const |
Return the world location of a given pixel.
Definition at line 201 of file RoadMap.cpp.
References MapOffset, PixelsPerCentimeter, and WorldToMap.
| FRoadMapIntersectionResult URoadMap::Intersect | ( | const FTransform & | BoxTransform, |
| const FVector & | BoxExtent, | ||
| float | ChecksPerCentimeter | ||
| ) | const |
Intersect actor bounds with map.
Bounds box is projected to the map and checked against it for possible intersections with off-road areas and opposite lanes.
Definition at line 219 of file RoadMap.cpp.
References GetDataAt(), FRoadMapIntersectionResult::OffRoad, and FRoadMapIntersectionResult::OppositeLane.
|
inlineprivate |
Definition at line 170 of file RoadMap.h.
References Height, RoadMapData, and Width.
Referenced by GetDataAt(), and SaveAsPNG().
| void URoadMap::Reset | ( | uint32 | Width, |
| uint32 | Height, | ||
| float | PixelsPerCentimeter, | ||
| const FTransform & | WorldToMap, | ||
| const FVector & | MapOffset | ||
| ) |
Resets current map an initializes an empty map of the given size.
Definition at line 83 of file RoadMap.cpp.
References Height, MapOffset, PixelsPerCentimeter, RoadMapData, Width, and WorldToMap.
Referenced by ACityMapGenerator::GenerateRoadMap().
| bool URoadMap::SaveAsPNG | ( | const FString & | Folder, |
| const FString & | MapName | ||
| ) | const |
Save the current map as PNG with the pixel data encoded as color.
Definition at line 251 of file RoadMap.cpp.
References FRoadMapPixelData::EncodeAsColor(), GetHeight(), GetWidth(), Height, IsValid(), MapOffset, PixelsPerCentimeter, RoadMapData, FPixelReader::SavePixelsToDisk(), Width, and WorldToMap.
Referenced by ACityMapGenerator::GenerateRoadMap().
| void URoadMap::SetPixelAt | ( | uint32 | PixelX, |
| uint32 | PixelY, | ||
| ECityMapMeshTag | Tag, | ||
| const FTransform & | Transform, | ||
| bool | bInvertDirection = false |
||
| ) |
Definition at line 98 of file RoadMap.cpp.
References FRoadMapPixelData::Encode(), carla::geom::Rotation::GetForwardVector(), GetIndex(), and RoadMapData.
Referenced by ACityMapGenerator::GenerateRoadMap().
|
private |
Height of the map in pixels.
Definition at line 193 of file RoadMap.h.
Referenced by GetDataAt(), GetHeight(), IsValid(), Reset(), and SaveAsPNG().
|
private |
Offset of the map in map coordinates.
Definition at line 181 of file RoadMap.h.
Referenced by GetDataAt(), GetWorldLocation(), Reset(), and SaveAsPNG().
|
private |
Number of pixels per centimeter.
Definition at line 185 of file RoadMap.h.
Referenced by GetDataAt(), GetWorldLocation(), Reset(), and SaveAsPNG().
|
private |
Definition at line 196 of file RoadMap.h.
Referenced by GetDataAt(), IsValid(), Reset(), SaveAsPNG(), SetPixelAt(), and URoadMap().
|
private |
Width of the map in pixels.
Definition at line 189 of file RoadMap.h.
Referenced by GetDataAt(), GetIndex(), GetWidth(), IsValid(), Reset(), and SaveAsPNG().
|
private |
World-to-map transform.
Definition at line 177 of file RoadMap.h.
Referenced by GetDataAt(), GetWorldLocation(), Reset(), and SaveAsPNG().