Small float product optimization.

This commit is contained in:
Axel1092 2020-03-30 13:05:53 +02:00 committed by Axel1092
parent e7082fae9f
commit 5c5028aeb3
2 changed files with 5 additions and 5 deletions

View File

@ -40,7 +40,7 @@ void UStopSignComponent::InitializeSign(const carla::road::Map &Map)
// Get 90% of the half size of the width of the lane // Get 90% of the half size of the width of the lane
float BoxSize = static_cast<float>( float BoxSize = static_cast<float>(
0.9*Map.GetLaneWidth(signal_waypoint)/2.0); 0.9*Map.GetLaneWidth(signal_waypoint)*0.5);
// Get min and max // Get min and max
double LaneLength = Map.GetLane(signal_waypoint).GetLength(); double LaneLength = Map.GetLane(signal_waypoint).GetLength();
double LaneDistance = Map.GetLane(signal_waypoint).GetDistance(); double LaneDistance = Map.GetLane(signal_waypoint).GetDistance();
@ -102,7 +102,7 @@ void UStopSignComponent::InitializeSign(const carla::road::Map &Map)
auto CurrentWaypoint = Waypoint; auto CurrentWaypoint = Waypoint;
auto NextWaypoint = CurrentWaypoint; auto NextWaypoint = CurrentWaypoint;
float BoxSize = static_cast<float>( float BoxSize = static_cast<float>(
0.9*Map.GetLaneWidth(NextWaypoint)/2.0); 0.9*Map.GetLaneWidth(NextWaypoint)*0.5);
float UEBoxSize = 100*BoxSize; float UEBoxSize = 100*BoxSize;
GenerateCheckBox(Map.ComputeTransform(NextWaypoint), UEBoxSize); GenerateCheckBox(Map.ComputeTransform(NextWaypoint), UEBoxSize);
while (true) while (true)

View File

@ -267,7 +267,7 @@ void ATrafficLightManager::SpawnTrafficLights()
(GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length(); (GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length();
double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get()); double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get());
if(SignalDistanceToRoad < LaneWidth / 2.0) if(SignalDistanceToRoad < LaneWidth * 0.5)
{ {
UE_LOG(LogCarla, Warning, UE_LOG(LogCarla, Warning,
TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."), TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."),
@ -330,7 +330,7 @@ void ATrafficLightManager::SpawnSignals()
(GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length(); (GetMap()->ComputeTransform(ClosestWaypointToSignal.get()).location - CarlaTransform.location).Length();
double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get()); double LaneWidth = GetMap()->GetLaneWidth(ClosestWaypointToSignal.get());
if(SignalDistanceToRoad < LaneWidth / 2.0) if(SignalDistanceToRoad < LaneWidth * 0.5)
{ {
UE_LOG(LogCarla, Warning, UE_LOG(LogCarla, Warning,
TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."), TEXT("Traffic light %s overlaps a driving lane. Disabling collision..."),
@ -416,7 +416,7 @@ void ATrafficLightManager::GenerateTriggerBoxesForTrafficLights()
// Get 90% of the half size of the width of the lane // Get 90% of the half size of the width of the lane
float BoxSize = static_cast<float>( float BoxSize = static_cast<float>(
0.9*GetMap()->GetLaneWidth(waypoint)/2.0); 0.9f*GetMap()->GetLaneWidth(waypoint)*0.5);
// Get min and max // Get min and max
double LaneLength = GetMap()->GetLane(signal_waypoint).GetLength(); double LaneLength = GetMap()->GetLane(signal_waypoint).GetLength();
double LaneDistance = GetMap()->GetLane(signal_waypoint).GetDistance(); double LaneDistance = GetMap()->GetLane(signal_waypoint).GetDistance();